Created 04-17-2023 01:33 AM
I ran into an issue last week, which seems to be an issue related to the Cloudera ODBC Driver for Impala.
First I thought it was an issue with pyodbc, but after submitting the issue on their github we figured out that it was a driver issue. For reference: pyodbc github issue 1197
Simply put, executing query1 and query2 should produce the same results, but it doesn't:
query1 = """SELECT
col1, col2 as col2_orig,
(CASE WHEN col2 IS NOT NULL THEN col2
ELSE 0 END) AS col2_1,
(CASE WHEN col2 IS NULL THEN 0
ELSE col2 END) AS col2_2
FROM sandbox.jk_test"""
query2 = f"""WITH wrapped_table AS ({query1}) SELECT * FROM wrapped_table"""
It results in two different sets:
['col1', 'col2_orig', 'col2_1', 'col2_2']
['1 ', '1 ', '1 ', '1 ']
['2 ', 'None ', 'None ', '0 ']
['col1', 'col2_orig', 'col2_1', 'col2_2']
['1 ', '1 ', '1 ', '1 ']
['2 ', 'None ', '0 ', '0 ']
The 2nd result is the expected one.
* See the github issue for the code used to run these queries.
Running the queries with CData's driver solves the issue, as does connecting using a JDBC connection.
My Environment:
Created 10-11-2023 08:42 AM
Hi @JKarount ,
To close the loop, this has been resolved in the latest Cloudera Impala ODBC driver 2.7.0, see the Resolved Issues section in the Release Notes:
https://docs.cloudera.com/documentation/other/connectors/impala-odbc/2-7-0/Release-Notes-Impala-ODBC...
"[IMP-946][02795738] The connector does not generate the last COALESCE
parameter from the ELSE expression in the CASE statement."
You can download it from:
https://www.cloudera.com/downloads/connectors/impala/odbc/2-7-0.html
I hope this will help you to implement your usecases as expected.
Best regards
Miklos Szurap
Customer Operations Engineer, Cloudera
Created 04-21-2023 12:49 AM
@JKarount, If any of the replies from @mszurap has helped you reach a solution, can you please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future?
Regards,
Vidya Sargur,