How do you insert a struct into a hive table column using HiveRunner?
+3
−0
If my struct column has the data type of struct<string, integer> then what should be the equivalent java object that should be inserted into that struct column?
I'm trying the following code using HiveRunner
Object val = ? // what should be this object?
shell
.insertInto("source_db", tableName)
.withColumns(column)
.addRow(val)
.commit();
1 answer
+3
−0
Figured it out.
It should be a List. The data type of the list should be object, but the individual objects in the list should be compatible with the data type of the fields of the struct.
For ex. if the struct is struct<string, integer> Then the list should be like this
List<Object> struct = Arrays.asList("My String", 110);
0 comment threads