Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read
Q&A

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();
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

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);
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »