Member since
10-28-2020
591
Posts
46
Kudos Received
40
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
944 | 02-17-2025 06:54 AM | |
5173 | 07-23-2024 11:49 PM | |
917 | 05-28-2024 11:06 AM | |
1478 | 05-05-2024 01:27 PM | |
949 | 05-05-2024 01:09 PM |
05-17-2025
04:34 PM
@AlexDriver I tried this with latest ODBC driver 2.8.2. Used it with pyodbc, and I can reproduce the issue. The error I get is : Traceback (most recent call last):
File "/hive/pyodbc_test.py", line 13, in <module>
for row in cursor.fetchall():
^^^^^^^^^^^^^^^^^
pyodbc.ProgrammingError: No results. Previous SQL was not a query. I have raised an enhancement request with the driver team.
... View more
05-16-2025
11:25 AM
@AlexDriver could you share the ODBC driver version you are using, so that we can test this?
... View more
05-16-2025
06:36 AM
Could you please share both versions and mark this thread resolved?
... View more
05-15-2025
01:04 PM
Could you test with multiline comment, just to see if it works? SELECT *
FROM (/* Request ID: ... */ SELECT version()) AS Subquery__9
LIMIT 1; What's the ODBC driver version that you are using? Is it from Cloudera?
... View more
05-15-2025
12:49 PM
@AlexDriver is it possible to enable trace logging in the driver and share the logs, and also see how the query shows up in the hiveserver2 logs?
... View more
05-13-2025
11:47 PM
@AlexDriver So our query is essentially this: SELECT *
FROM (
SELECT version()
) AS Subquery__9
LIMIT 1; I think the driver connector is unable to parse the comment. You may enable Native Query by setting UseNativeQuery=1, this way driver does not try to transform the query, and it runs directly in Hive. Try this and see if it works. Driver user guide - https://downloads.cloudera.com/connectors/Cloudera_Hive_ODBC_2.8.2.1002/Cloudera-ODBC-Driver-for-Apache-Hive-Install-Guide.pdf
... View more
02-17-2025
06:54 AM
ahh @Rich_Learner please use the following query. I just tested. It should work. WITH json_extract AS (
SELECT
get_json_object(xml_data, '$.app.Id') AS ID,
get_json_object(xml_data, '$.app.apply[0].flag') AS Flag,
regexp_replace(regexp_replace(get_json_object(xml_data, '$.app.apply[0].Product'), '\\[|\\]', ''), '\\}\\,\\{', '\\}\\;\\{') AS products
FROM check
)
SELECT
ID,
Flag,
get_json_object(product_data, '$.Code') AS Code,
get_json_object(product_data, '$.Line') AS Line,
get_json_object(product_data, '$.status') AS Status
FROM json_extract
LATERAL VIEW explode(split(products, ';')) p AS product_data;
... View more
02-13-2025
08:54 AM
Try : WITH json_extract AS (
SELECT
get_json_object(xml_data, '$.app.Id') AS ID,
get_json_object(xml_data, '$.app.apply[0].flag') AS Flag,
get_json_object(xml_data, '$.app.apply[0].Product') AS products
FROM check
)
SELECT
ID,
Flag,
get_json_object(product_data, '$.Code') AS Code,
get_json_object(product_data, '$.Line') AS Line,
get_json_object(product_data, '$.status') AS Status
FROM json_extract
LATERAL VIEW OUTER EXPLODE(SPLIT(products, '},')) p AS product_data;
... View more
02-13-2025
02:57 AM
Try something like this : WITH json_extract AS (
SELECT
get_json_object(xml_data, '$.app.Id') AS ID,
get_json_object(xml_data, '$.app.apply[0].flag') AS Flag,
get_json_object(xml_data, '$.app.apply[0].Product') AS products_json
FROM check
)
SELECT
ID,
Flag,
get_json_object(product_item, '$.Code') AS Code,
get_json_object(product_item, '$.Line') AS Line,
get_json_object(product_item, '$.status') AS Status
FROM json_extract
LATERAL VIEW OUTER EXPLODE(split(regexp_replace(regexp_replace(products_json, '\\[|\\]', ''), '\\}\\s*,\\s*\\{', '}|{'), '|')) p AS product_item;
... View more
02-13-2025
01:04 AM
@Rich_Learner could you please share your table definition? show create table <table_name> I wanted to see if you are using textfile or json serde. Also I could try replicating the issue with that info.
... View more