我已經在SerDe上處理過我的XML數據,並且爲XML數據創建了自定義的InputFormat和RecordRedaer。Hadoop hive serde - 輸入格式必須實現InputFormat
下面是類的簽名 -
SERDE類 -
public class XMLSerde extends AbstractSerDe {
InputFormat -
public class XMLInputFormat extends FileInputFormat<LongWritable, BookWritable> {
@Override
public RecordReader<LongWritable, BookWritable> createRecordReader(InputSplit arg0,
TaskAttemptContext arg1) throws IOException, InterruptedException {
// TODO Auto-generated method stub
return new XMLRecordReader();
}
RecordReader -
public class XMLRecordReader extends RecordReader<LongWritable, BookWritable> {
BookWritable是自定義Wr的我創造的可愛的類。
現在,當我使用下面這個SERDE -
CREATE TABLE xml_items(Author STRING, Title STRING, ISBN STRING) ROW FORMAT SERDE 'com.xml.serde.XMLSerde' STORED AS INPUTFORMAT 'com.xml.serde.XMLInputFormat';
我得到以下錯誤,同時運行在該表上選擇查詢。
FAILED: SemanticException 1:14 Input format must implement InputFormat. Error encountered near token 'books'
請建議。 AJ
任何幫助,請... – AJ84