Member since
06-09-2017
7
Posts
5
Kudos Received
0
Solutions
06-12-2017
03:28 PM
Hive does support literals for complex types. I didnt find any documentation for it, but I have the syntax that works.
... View more
06-12-2017
03:56 PM
I created the table using the statement (this statement uses the default delimiters, ^A, ^B etc.): create table delimiter_test( c1 struct< l1a:struct<l2a:string, l2b:string>, l1b:struct<l2c:array<string>, l2d:string> >, c2 array<struct<l1a:struct<l2a:string, l2b:string>, l1b:string>> ) row format delimited STORED AS TEXTFILE; I inserted one row using the statement: insert into table delimiter_test select named_struct("l1a",named_struct("l2a","111", "l2b","222"), "l1b",named_struct("l2c",array("333", "333"), "l2d","444")),
array(named_struct("l1a",named_struct("l2a","555", "l2b","666"), "l1b","777"), named_struct("l1a",named_struct("l2a","888", "l2b","999"), "l1b","000"))
from z_dummy; Note the above sample data does not have any default delimiters in it. Next, I go to the underlying HDFS file and edit it, so that the data has default delimiters. When I put a delimiter in the data, I also put an escape char \ in front of it. I have attached the screenshots of the data in hex, before and after editing it. Contents of file before editing to have a delimiter in the data. Contents of file after editing to have a delimiter in the data. Once I have default delimiters in the data, it becomes unreadable (escaping didnt help)
... View more