[ 
https://issues.apache.org/jira/browse/HIVE-18398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328070#comment-16328070
 ] 

Jyoti commented on HIVE-18398:
------------------------------

We are also hitting the same issue on Hive 1.2.2

Repro steps:

1. Create a table like below:

 
{code:java}
CREATE external TABLE `sample5`(`id1` int,`id2` int) ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ',' ESCAPED BY '\\'
LOCATION 
'hdfs://localhost:9000/user/hive/warehouse/sample';
{code}
2. Get the table schema

 

 
{code:java}
show create table sample5
{code}
Result: 

 

 
{code:java}
+-----------------------------------------------------------------+--+
| createtab_stmt |
+-----------------------------------------------------------------+--+
| CREATE EXTERNAL TABLE `sample5`( |
| `id1` int, |
| `id2` int) |
| ROW FORMAT DELIMITED |
| FIELDS TERMINATED BY ',' |
| WITH SERDEPROPERTIES ( |
| 'escape.delim'='\\') |
| STORED AS INPUTFORMAT |
| 'org.apache.hadoop.mapred.TextInputFormat' |
| OUTPUTFORMAT |
| 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' |
| LOCATION |
| 'hdfs://localhost:9000/user/hive/warehouse/sample' |
| TBLPROPERTIES ( |
| 'COLUMN_STATS_ACCURATE'='false', |
| 'numFiles'='0', |
| 'numRows'='-1', |
| 'rawDataSize'='-1', |
| 'totalSize'='0', |
| 'transient_lastDdlTime'='1515808983') |
+-----------------------------------------------------------------+--+
{code}
Using the above create table command throws the same exception explained above.

 

 

Some more observations:
 # The issue doesnt happen in hive 2.3
 # However the show table command outputs the below result

{code:java}
+----------------------------------------------------+
| createtab_stmt |
+----------------------------------------------------+
| CREATE EXTERNAL TABLE `sample5`( |
| `id1` int, |
| `id2` int) |
| ROW FORMAT SERDE |
| 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' |
| WITH SERDEPROPERTIES ( |
| 'escape.delim'='\\', |
| 'field.delim'=',', |
| 'serialization.format'=',') |
| STORED AS INPUTFORMAT |
| 'org.apache.hadoop.mapred.TextInputFormat' |
| OUTPUTFORMAT |
| 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' |
| LOCATION |
| 'hdfs://localhost:9000/user/hive/warehouse/sample' |
| TBLPROPERTIES ( |
| 'transient_lastDdlTime'='1515807845') |
+----------------------------------------------------+
{code}

 

 

> WITH SERDEPROPERTIES option is broken without 
> org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
> ------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-18398
>                 URL: https://issues.apache.org/jira/browse/HIVE-18398
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.2.1
>            Reporter: Rajkumar Singh
>            Priority: Minor
>
> *Steps to reproduce:*
> 1. Create table 
> {code}
> create table test_serde(id int,value string) ROW FORMAT DELIMITED FIELDS 
> TERMINATED BY '|' ESCAPED BY '\\' 
> {code}
> 2. show create table produce following output
> {code}
> CREATE TABLE `test_serde`(
>   `id` int, 
>   `value` string)
> ROW FORMAT DELIMITED 
>   FIELDS TERMINATED BY '|' 
> WITH SERDEPROPERTIES ( 
>   'escape.delim'='\\') 
> STORED AS INPUTFORMAT 
>   'org.apache.hadoop.mapred.TextInputFormat' 
> OUTPUTFORMAT 
>   'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
> LOCATION
>   'hdfs://hdp262a.hdp.local:8020/apps/hive/warehouse/test_serde'
> TBLPROPERTIES (
>   'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}', 
>   'numFiles'='0', 
>   'numRows'='0', 
>   'rawDataSize'='0', 
>   'totalSize'='0', 
>   'transient_lastDdlTime'='1515448894')
> {code}
> 3. once you run the  create table using the output of show create it ran into 
> the parsing error
> {code}
> NoViableAltException(296@[1876:103: ( tableRowFormatMapKeysIdentifier )?])
>       at org.antlr.runtime.DFA.noViableAlt(DFA.java:158)
>       at org.antlr.runtime.DFA.predict(DFA.java:116)
>       .....
> FAILED: ParseException line 6:0 cannot recognize input near 'WITH' 
> 'SERDEPROPERTIES' '(' in serde properties specification
> {code}
> 4. table create with LazySimpleSerde don't have any such issue.
> {code}
> hive> CREATE TABLE `foo`( 
>     > `col` string) 
>     > ROW FORMAT SERDE 
>     > 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
>     > WITH SERDEPROPERTIES ( 
>     > 'serialization.encoding'='UTF-8') 
>     > STORED AS INPUTFORMAT 
>     > 'org.apache.hadoop.mapred.TextInputFormat' 
>     > OUTPUTFORMAT 
>     > 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' ;
> OK
> Time taken: 0.375 seconds
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to