简体   繁体   中英

Parser Error with HIVE ODBC

I'm writing some code in C# to invoke a HIVE script via ODBC. I'm using the Hortonworks Hive ODBC Driver (though I've tried several others as well and I get the same error). I can connect fine via ODBC and simple commands work perfectly (for example SELECT * FROM MyTable LIMIT 10; will do exactly what it should). Where I run into trouble is with longer scripts that we have for processing where they have multiple 'chunks' of SQL (each terminated by a semi-colon). So for example, the first statement usually creates a temp table, the next inserts into it, then maybe another select from a different table, etc, typical SQL. But I keep getting the following error on the line that specifies the S3 location for the file with a parser error:

Error while compiling statement: FAILED: ParseException line 8:85 missing EOF at ';' near ''s3n://somebucket/somefolder/etc'

Here's an example of where this is failing:

CREATE EXTERNAL TABLE IF NOT EXISTS mytesttable(
   id int,
   anotherid int,
   name string   
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
LOCATION 's3n://somebucket/somefolder/etc';

...script continues here with the next chunk of SQL

What am I doing wrong? Also, if I SSH in and run this script from the command line it works perfectly.

Ok, in testing, the hive shell will accept multiple statements in a query. It does this by breaking the query into multiple separate statements and issuing them to Hive as separate queries.

The ODBC drivers do not currently work with multi-statement queries, if you're interested in having that capability added you should contact the distribution you got the ODBC driver from, or you can contact Simba ( http://www.simba.com/connectors/apache-hadoop-hive-driver ) if you're using the Apache distribution as they create the technology used by most distributions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM