JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

[BUG] JSQLParser Version : 5.0 RDBMS : Hive syntax is not supported INSERT OVERWRITE PARTITION (dtime = '20220403')CASE WHEN condition THEN END ELSE ...

Open loevingerx opened this issue 1 year ago • 1 comments

Grammar or Syntax Description

-Hive syntax is not supported: INSERT OVERWRITE And PARTITION (dtime = '20220403') -Hive syntax is not supported: CASE WHEN condition THEN END ELSE ...

SQL Example

  • Simplified Query Example, focusing on the failing feature
INSERT OVERWRITE TABLE sjzt.dws_country_orders PARTITION (dtime = '20220403')
SELECT
code,
name,
last30day_country_order_count,
last30day_country_sales_amount,
last30day_country_average_amount
FROM fact_order_detail

Additional context

Test JSQLParser Version 5.0

error info

Exception in thread "main" net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "dws_country_orders" <S_IDENTIFIER> at line 1, column 24.

Was expecting one of:

"("
"OUTPUT"
"SET"
"VALUE"
"VALUES"
"WITH"
<K_SELECT>

at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:350)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:123)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:89)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:62)
at com.ctsi.CCJSqlParserUtilTest.main(CCJSqlParserUtilTest.java:23)

Caused by: java.util.concurrent.ExecutionException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "dws_country_orders" <S_IDENTIFIER> at line 1, column 24.

Was expecting one of:

"("
"OUTPUT"
"SET"
"VALUE"
"VALUES"
"WITH"
<K_SELECT>

at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:206)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:343)
... 4 more

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "dws_country_orders" <S_IDENTIFIER> at line 1, column 24.

Was expecting one of:

"("
"OUTPUT"
"SET"
"VALUE"
"VALUES"
"WITH"
<K_SELECT>

at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:39603)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:39427)
at net.sf.jsqlparser.parser.CCJSqlParser.Insert(CCJSqlParser.java:4439)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:383)
at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:296)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:339)
at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:336)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

loevingerx avatar Dec 05 '24 11:12 loevingerx

Greetings!

HIVE has many exotic syntax and is not too well supported in JSQLParser right now. You will have to provide or sponsor an implementation for improving the Hive support.

What is you concern about the CASE ... expression?

manticore-projects avatar Dec 06 '24 10:12 manticore-projects