- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Impala JDBC driver does not parse table aliases with space correctly in some situations
- Labels:
-
Apache Impala
Created on ‎10-22-2015 08:00 AM - edited ‎09-16-2022 02:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the query contains a subquery in the FROM clause and the alias to the subquery contains space,
select `alias with space`.code from (select * from sample_07) `alias with space`
the JDBC driver throws exception
Exception in thread "main" java.sql.SQLException: [Simba][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Syntax error in line 1:
...lt`.`sample_07`) AS alias with space
^
Encountered: WITH
Expected: CROSS, FROM, FULL, GROUP, HAVING, INNER, JOIN, LEFT, LIMIT, OFFSET, ON, ORDER, RIGHT, UNION, USING, WHERE, COMMA
CAUSED BY: Exception: Syntax error
), Query: SELECT `alias with space`.`code` FROM (SELECT `sample_07`.`code`, `sample_07`.`description`, `sample_07`.`total_emp`, `sample_07`.`salary` FROM `default`.`sample_07`) AS alias with space.
at com.cloudera.impala.hivecommon.api.HS2Client.executeStatementInternal(Unknown Source)
at com.cloudera.impala.hivecommon.api.HS2Client.executeStatement(Unknown Source)
at com.cloudera.impala.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.executeQuery(Unknown Source)
at com.cloudera.impala.hivecommon.dataengine.HiveJDBCDSIExtQueryExecutor.execute(Unknown Source)
at com.cloudera.impala.jdbc.common.SStatement.executeNoParams(Unknown Source)
at com.cloudera.impala.jdbc.common.SStatement.executeQuery(Unknown Source)
Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Simba][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Syntax error in line 1:
...lt`.`sample_07`) AS alias with space
^
Encountered: WITH
Expected: CROSS, FROM, FULL, GROUP, HAVING, INNER, JOIN, LEFT, LIMIT, OFFSET, ON, ORDER, RIGHT, UNION, USING, WHERE, COMMA
CAUSED BY: Exception: Syntax error
), Query: SELECT `alias with space`.`code` FROM (SELECT `sample_07`.`code`, `sample_07`.`description`, `sample_07`.`total_emp`, `sample_07`.`salary` FROM `default`.`sample_07`) AS alias with space.
... 6 more
Is this a known issue?
/Saravana
Created ‎10-30-2015 01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
useNativeQuery option is an workaround for this problem. Filed this as a bug in Jira IMPALA-2609.
Created ‎10-26-2015 12:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Saravana,
thanks for your report! Looks like a new isue. Would you mind filing a JIRA for it so we can assign and track it?
As a possible workaround, could you try running the query with "use native query" enabled in the JDBC driver?
The driver will send the query to Impala verbatim (sometimes the driver may make some changes to the SQL).
Alex
Created ‎10-30-2015 01:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
useNativeQuery option is an workaround for this problem. Filed this as a bug in Jira IMPALA-2609.
