[ https://issues.apache.org/jira/browse/HIVE-21144?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume updated HIVE-21144: ----------------------------- Description: I am trying to execute a very simple query, using python/pyodbc on Windows (with a working system-wide odbc DSN: HiveProd): {code:java} import pyodbc cnxn = pyodbc.connect('DSN=HiveProd', autocommit=True) cursor = cnxn.cursor() # works q="select ? as lic, ? as cpg" # fails q="with init as (select ? as lic, ? as cpg) select * from init" cursor.execute(q, '1', 'some string') for row in cursor: print(row.lic, row.cpg) {code} Basically, create an odbc connection, run a query with a prepared statement and print the result. A basic query works fine. If I put this query inside a CTE, I get: {{ cursor.execute("with init as (select ? as lic, ? as cpg) select * from init", '1', 'some string') pyodbc.ProgrammingError: ('42000', "[42000] [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error while compiling statement: FAILED: ParseException line 1:21 can not recognize input near '?' 'as' 'lic' in select clause (80) (SQLPrepare)")}} This is not specific to python as I get the same issue with .Net. Trying the same with JDBC works fine. Testing on Hive 3.1.0 from Hdp 3.1.0 was: I am trying to execute a very simple query, using python/pyodbc on Windows (with a working system-wide odbc DSN: HiveProd): {code:java} import pyodbc cnxn = pyodbc.connect('DSN=HiveProd', autocommit=True) cursor = cnxn.cursor() # works q="select ? as lic, ? as cpg" # fails q="with init as (select ? as lic, ? as cpg) select * from init" cursor.execute(q, '1', 'some string') for row in cursor: print(row.lic, row.cpg) {code} Basically, create an odbc connection, run a query with a prepared statement and print the result. A basic query works fine. If I put this query inside a CTE, I get: {{ cursor.execute("with init as (select ? as lic, ? as cpg) select * from init", '1', 'some string') pyodbc.ProgrammingError: ('42000', "[42000] [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while executing query. Error message from server: Error while compiling statement: FAILED: ParseException line 1:21 can not recognize input near '?' 'as' 'lic' in select clause (80) (SQLPrepare)")}} This is not specific to python as I get the same issue with .Net. Trying the same with JDBC works fine. Testing on Hive 3.1.0 from Hdp 3.1.0 > ODBC with prepared statement fail inside a CTE > ---------------------------------------------- > > Key: HIVE-21144 > URL: https://issues.apache.org/jira/browse/HIVE-21144 > Project: Hive > Issue Type: Bug > Components: ODBC > Affects Versions: 3.1.0 > Reporter: Guillaume > Priority: Major > > I am trying to execute a very simple query, using python/pyodbc on Windows > (with a working system-wide odbc DSN: HiveProd): > {code:java} > import pyodbc cnxn = pyodbc.connect('DSN=HiveProd', autocommit=True) > cursor = cnxn.cursor() > # works > q="select ? as lic, ? as cpg" > # fails > q="with init as (select ? as lic, ? as cpg) select * from init" > cursor.execute(q, '1', 'some string') > for row in cursor: > print(row.lic, row.cpg) > {code} > Basically, create an odbc connection, run a query with a prepared statement > and print the result. > A basic query works fine. If I put this query inside a CTE, I get: > {{ cursor.execute("with init as (select ? as lic, ? as cpg) select * from > init", '1', 'some string') pyodbc.ProgrammingError: ('42000', "[42000] > [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server > while executing query. Error message from server: Error while compiling > statement: FAILED: ParseException line 1:21 can not recognize input near '?' > 'as' 'lic' in select clause (80) (SQLPrepare)")}} > This is not specific to python as I get the same issue with .Net. > Trying the same with JDBC works fine. > Testing on Hive 3.1.0 from Hdp 3.1.0 > -- This message was sent by Atlassian JIRA (v7.6.3#76005)