Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @BellaSnow5378,
If you have just one Object Array in the schema, then explode the Object itself and then use the outer query to fetch the attribute value:
Say the object array name is transactionDetails, and there are string fields (transactionAmt, transactionChannel) inside it, then your query will look like this:
select aa.transactionAmt, aa.transactionChannel,... from (select explode(transactionDetails) as aa from table_name);
If you have multiple string arrays in the schema, you may need to explode one array first, and then wrap that SELECT with another SELECT to explode:
select distinct aa, explode (column_name2) as bb, eventType timestamp from (select explode(column_name1) as aa, eventType from table_name);
Note: explode() will explode one array into multiple records, duplicating the fields that are not part of the explode. You can nest queries including the aggregation (use Distinct or Group by).
Regards,
Kumar Saurabh
Hi @BellaSnow5378,
If you have just one Object Array in the schema, then explode the Object itself and then use the outer query to fetch the attribute value:
Say the object array name is transactionDetails, and there are string fields (transactionAmt, transactionChannel) inside it, then your query will look like this:
select aa.transactionAmt, aa.transactionChannel,... from (select explode(transactionDetails) as aa from table_name);
If you have multiple string arrays in the schema, you may need to explode one array first, and then wrap that SELECT with another SELECT to explode:
select distinct aa, explode (column_name2) as bb, eventType timestamp from (select explode(column_name1) as aa, eventType from table_name);
Note: explode() will explode one array into multiple records, duplicating the fields that are not part of the explode. You can nest queries including the aggregation (use Distinct or Group by).
Regards,
Kumar Saurabh
Views
Likes
Replies