Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
How do you insert a struct into a hive table column using HiveRunner?
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
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