PROBLEM
I was trying to create an external table in hive using the following command
CREATE EXTERNAL TABLE tetl_fact_r
(
custid STRING,
value STRING,
ph STRING,
email STRING,
sort STRING,
address STRING,
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\002'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/user/hadoop-blog/abc.text';
and got the following error
FAILED: Parse Error: line <linenum>:4 mismatched input <column name> expecting Identifier in column specification
REASON
From https://issues.cloudera.org/browse/SQOOP-37, I found that this is happening because column name sort is a reserved keyword in hive.
SOLUTION
To be honest, I din't spend much time finding the solution, instead I just renamed my field and it worked after that. Hence the new query looked like
CREATE EXTERNAL TABLE tetl_fact_r
(
custid STRING,
value STRING,
ph STRING,
email STRING,
sorttype STRING,
address STRING,
)
If any of you figure out a way to make this query work without renaming the column then please leave a comment. It will be much appreciated.
I was trying to create an external table in hive using the following command
CREATE EXTERNAL TABLE tetl_fact_r
(
custid STRING,
value STRING,
ph STRING,
email STRING,
sort STRING,
address STRING,
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\002'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/user/hadoop-blog/abc.text';
and got the following error
FAILED: Parse Error: line <linenum>:4 mismatched input <column name> expecting Identifier in column specification
REASON
From https://issues.cloudera.org/browse/SQOOP-37, I found that this is happening because column name sort is a reserved keyword in hive.
SOLUTION
To be honest, I din't spend much time finding the solution, instead I just renamed my field and it worked after that. Hence the new query looked like
CREATE EXTERNAL TABLE tetl_fact_r
(
custid STRING,
value STRING,
ph STRING,
email STRING,
sorttype STRING,
address STRING,
)
If any of you figure out a way to make this query work without renaming the column then please leave a comment. It will be much appreciated.