Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 05-13-2025 11:45 AM
Dear Community,
I've faced with an issue when i try to send the following query to Apache Hive using ODBC driver:
"-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f
SELECT *
FROM (-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f
select version()) AS Subquery__9
LIMIT 1"
then i get an empty response.
However, if i remove the commented out fragments with Request Id and its uuid then it starts working as expected by returning the version.
What am i missing here or is it an ODBC driver bug?
PS: it's not reproducible when i do the same using JDBC.
Created 05-13-2025 11:23 PM
@AlexDriver,Welcome to our community! To help you get the best possible answer, I have tagged in our Hive experts @asish @smruti who may be able to assist you further.
Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.
Regards,
Vidya Sargur,Created 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-Apa...
Created 05-14-2025 01:55 PM
unfortunately UseNativeQuery=1
hasn't helped.
the issue is still reproducible.
Created 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?
Created 05-15-2025 03:20 PM
here's what i can see in the driver log:
01:09:15.229 INFO 1431732928 Simba::DSI::SharedSingletonManager::LogVersionsAndLocation: SDK Version: 10.02.03.1020
01:09:15.229 INFO 1431732928 Simba::DSI::SharedSingletonManager::LogVersionsAndLocation: DSII Version: 2.7.0.1002
01:09:15.229 INFO 1431732928 Simba::DSI::SharedSingletonManager::LogVersionsAndLocation: Executing binary located at /opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Default Database CHAR Encoding: UTF-8
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Default Database WCHAR Encoding: UTF-8
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Driver ANSI CHAR Encoding: UTF-8
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Driver Manager WCHAR Encoding: UTF-16LE
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Detected Driver Manager: unixODBC, 2.2.14 or 2.3.x branch
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Locale name: en_US
01:09:15.229 INFO 1431732928 Simba::ODBC::Driver::Initialize: Bitness: 64-bit
01:09:15.229 INFO 1431732928 ::CInterface::SQLAllocHandle: Allocating environment handle.
01:09:15.230 INFO 1431732928 Simba::ODBC::Environment::SQLSetEnvAttr: Attribute: SQL_ATTR_ODBC_VERSION (200)
01:09:15.230 INFO 1431732928 Simba::ODBC::EnvironmentAttributes::SetAttribute: Setting ODBC version to: 3
01:09:15.230 INFO 1431732928 Simba::ODBC::Environment::SQLGetEnvAttr: Attribute: SQL_ATTR_ODBC_VERSION (200)
01:09:15.230 INFO 1431732928 ::CInterface::SQLAllocHandle: Allocating connection handle.
01:09:15.439 INFO 1431732928 ::CInterface::SQLAllocHandle: Allocating statement handle.
01:09:15.787 INFO 1431732928 ::CInterface::SQLFreeHandle: Freeing statement handle.
01:09:15.801 INFO 1431732928 ::CInterface::SQLFreeHandle: Freeing connection handle.
01:09:15.801 INFO 1431732928 ::CInterface::SQLFreeHandle: Freeing environment handle.
Does it explain anything?
PS: later on i'll try to get to the hive server logs.
Created 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?
Created on 05-15-2025 03:26 PM - edited 05-15-2025 03:26 PM
when a comment line is in a middle of the query or at the end - it works fine.
the only issue is when the commend is in the first line.
Created 05-16-2025 06:36 AM
Could you please share both versions and mark this thread resolved?
Created 05-16-2025 08:17 AM
like i said in the beginning - this one doesn't work:
"-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f
SELECT *
FROM (-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f
select version()) AS Subquery__9
LIMIT 1"
however, this one works fine:
"SELECT *
FROM (-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f
select version()) AS Subquery__9
LIMIT 1
-- Request ID: 4b9a2e0a-e250-45b7-b9cc-0915f20f848f"
Though our team found a workaround, but I'm afraid this thread can't set this as resolved as the original issue still exists, i.e. any valid multi-line query starting with a comment line - returns empty response. And like i also said - this is not the case when the query is sent through JDBC.