Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

Getting improper "Unexpected character" using Cloudera ODBC for Impala

SOLVED Go to solution

Getting improper "Unexpected character" using Cloudera ODBC for Impala

New Contributor

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 "?".

1 ACCEPTED SOLUTION

Accepted Solutions

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

Expert Contributor

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

3 REPLIES 3

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

New Contributor

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?

 

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

Expert Contributor

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

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

New Contributor
The question mark is a parameter placeholder in ODBC.