i having some issue with combining two columns fields into single fields as STruct type.
below code i tried but still getting the same issue?
create table dummy_TBL2 (id int,fname string ,lname string) ;
insert into dummy_TBL2 (id,fname,lname) values(1,'bhau','anna') ; //dummy side
now below show the struct table:-
create table data_TBL2 (id int, name struct<fname:string,lname:string>)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;//in this table i took name as struct type
___inserting the data from dummy into struct type-----
insert into table data_TBL2
from dummy_TBL2 limit 1;
this is my output data structure from a JSON we required:-
"use": "official", //here "tab1.use" is column and value
"family": "family",//here "tab1.family" is column and value
"given": [ //this column we need to create and add value from "tab1.fn&ln"
"first1", //here "first1" is coming from tab1.fname
"last1" //here "last1"is coming from tab1.lname
"use": "usual", //here "tab2.use" is column and value
"given": [ //here we need to create column with fn&ln
"first1 last1" //here "first1 last1" is coming from tab1.fname &tab1.lname
here we want to create a column(name) from above columns :-
above data is JSON structure but i want in Hive with table columns.
then further we can convert the same into JSON in my use cases.
Note :- structure is matter here.