Reply
New Contributor
Posts: 3
Registered: ‎05-21-2018
Accepted Solution

Getting improper "Unexpected character" using Cloudera ODBC for Impala

[ Edited ]

Are there shortcomings with the ODBC driver around parameters?  Can you help me fix a big problem I'm having?  I'm passing a simple string, like "A123456", into a query with a single parameter.

I've simplified my query as much as possible to avoid confusion.  I get the "unexpected character" error on this query over ODBC using Cloudera ODBC driver 64-bit 2.05.41.1029 for Windows.  (My actual query I want to run is much larger but the same in its essence.)

 

with nextMatchId as (
    select min(match_id) as match_id
    from userTable
    where user_id = ?)
select c.*
from candidateTable c
join nextMatchId on nextMatchId.match_id=c.match_id

 

Supplying a Varchar parameter like "A123456" and running it gives me:
ERROR [HY000] [Cloudera][ImpalaODBC] (110) Error while executing a query in Impala: [HY000] : AnalysisException: Syntax error in line 5:
    where user_id = ?
                    ^
Encountered: Unexpected character
Expected: CASE, CAST, DEFAULT, EXISTS, FALSE, IF, INTERVAL, NOT, NULL, REPLACE, TRUNCATE, TRUE, IDENTIFIER

 

(I get the same error when I use a subquery instead of WITH.)

 

I was able to run this well using Hue and supplying the literal value instead of the "?".

New Contributor
Posts: 3
Registered: ‎05-21-2018

Re: Getting improper "Unexpected character" using Cloudera ODBC for Impala

I've discovered many other variations tha thave the same issue--for example, moving the parameter "?" placeholder outside the subquery still causes the same "Unexpected character" on the question mark, as though the parameter is not being substituted by the ODBC driver:

 

 

with
    nextMatchGroup as (
        select user_id, min(match_id)
	from userTable
        group by user_id
    ) 
select *
from candidateTable
join nextMatchGroup on nextMatchGroup.match_id=c.match_id
where nextMatchGroup.user_id = ?

...gives me the same error. Any ideas how to overcome this apparent failure to substitute?

 

Expert Contributor
Posts: 105
Registered: ‎07-17-2017

Re: Getting improper "Unexpected character" using Cloudera ODBC for Impala

[ Edited ]

HI @Locarno,

Please, what kind of params do you want to pass to ther query via ODBC? Where do you do this? and what is the use cas?
take a look to this link:
https://stackoverflow.com/questions/34093083/query-parameters-with-impala-odbc-driver

Highlighted
New Contributor
Posts: 3
Registered: ‎05-21-2018

Re: Getting improper "Unexpected character" using Cloudera ODBC for Impala

The question mark is a parameter placeholder in ODBC.
Announcements