Member since
05-26-2016
3
Posts
0
Kudos Received
0
Solutions
06-02-2016
06:04 PM
I cannot even say how much this helps me. Thanks so much
... View more
05-31-2016
12:26 AM
Thanks a lot for helping me! I'm still trying to figure this out. So this query:
Select quote_id,
get_json_object(message_full,'$.event.quote.vehicles.coverages.limits.type') as coverage_type
from dcbi_dev
where event_class = 'events.quote.QuoteCreated' and quote_id = '57226f1e01a9c82283d02ff8'
;
Returns this: (see table)
How would I modify my code to return 3 lines with the same quote_id and "Deductible" for the coverage_type for row 1, "PerDay" for row 2, and "PerOccurence" for row 3?
Thanks again for the help
quote_id coverage_type 57226f1e01a9c82283d02ff8 ["Deductible","PerDay","PerOccurrence"]
... View more
05-26-2016
04:49 PM
Hi, I am new to Hive. We are using NIFI to bring data in from JSON messages into Hortonworks HDFS. Our JSON messages are nested many levels deep. Using get_json_object, I am pulling back data from a table that holds coverage data for an insurance policy.
Here is my query:
---------------start query-------------------- with QuoteCreated as
(
Select
quote_id, get_json_object(message_full,'$.event.quote.vehicles.coverages.limits.type') as coverage_type from dcbi_dev where
event_class = 'events.quote.QuoteCreated'
and quote_id = '57226f1e01a9c82283d02ff8'
) select quote_id, coverage_type -- this doesn't work --> explode(coverage_type)
from QuoteCreated; ---------------end query-------------------- When I run this query in Hive (from Ambari), it returns single row with these values:
quote_id = 57226f1e01a9c82283d02ff8 coverage_type =
["BodilyInjury","PropertyDamage","RentalReimbursement"] I want to have, instead, 3 rows with the same quote_id, and each row will have one of the 3 values for the coverage_type I've been attempting to use the Explode function, but when I do, it gives me this error:
"Error while compiling statement: FAILED: SemanticException [Error 10081]: UDTF's are not supported outside the SELECT clause, nor nested in expressions [ERROR_STATUS]" Research led me to believe that my "array" is, in fact, being stored as a string. I've been unable to convert it to an array or figure out how to make this work.
Can anyone help me figure out how to do this? This would be awesome if we could use explode to unfold arrays into multiple rows for queries and reporting.
Thanks very much for any help.
... View more
Labels:
- Labels:
-
Apache Hive