I am trying to insert data into a table in Hive I created. I’ve been struggling, so I’m trying to simplify it as much as possible to get to the root of the issue.
Here is my simplified code for creating a basic table. I basically have an array of structure with a single element.
DROP TABLE IF EXISTS foo.S_FILE_PA_JOB_DATA_T;
CREATE TABLE foo.S_FILE_PA_JOB_DATA_T
PARTITIONED BY (customer_id string)
STORED AS AVRO
TBLPROPERTIES (
'avro.schema.literal'=
'{
"namespace": "com.foo.oozie.foo",
"name": "S_FILE_PA_JOB_DATA_T",
"type": "record",
"fields":
[
{"name":"pa_hwm" ,"type":{
"type":"array",
"items":{
"type":"record",
"name":"pa_hwm_record",
"fields":
[
{"name":"pa_axis" ,"type":["int","null"]}
]
}
}}
]
}');
My problem is I can’t figure out the syntax to insert into the table.
insert into table foo.s_FILE_PA_JOB_DATA_T partition (customer_id) values (0,'a390c1cf-4ee5-4ab9-b7a3-73f5f268b669')
The 0
needs to somehow be an array<struct<int>>
but I can't get the syntax right. Can anyone help? Thanks!