JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

`LOAD` statement

Open LeBronChen1 opened this issue 2 years ago • 3 comments

Hi: when use JSqlParser to parse sql then occur exception

Test load data into table code like below:

@test public void testLoadDataTable() throws JSQLParserException { String sqlString = “load data hdfs bulkload into table dbtest.HTTP options('inpath'='..')"; Statement statement = CCJSqlParserUtil.parse(sqlString); }

Exception like blew:

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

Was expecting one of: "(" "ALTER" "CALL" "COMMENT" "COMMIT" "CREATE" "DECLARE" "DELETE" ...

LeBronChen1 avatar Dec 05 '23 11:12 LeBronChen1

Greetings.

LOAD statement is not supported and you will need to provide or sponsor an implementation when you are interested in this.

manticore-projects avatar Dec 05 '23 11:12 manticore-projects

Hi: when use JSqlParser to parse sql then occur exception

Test load data into table code like below:

@test public void testLoadDataTable() throws JSQLParserException { String sqlString = “load data hdfs bulkload into table dbtest.HTTP options('inpath'='..')"; Statement statement = CCJSqlParserUtil.parse(sqlString); }

Exception like blew:

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

Was expecting one of: "(" "ALTER" "CALL" "COMMENT" "COMMIT" "CREATE" "DECLARE" "DELETE" ...

Can you provide more SQL statement and more infomation like which db or which db version? @LeBronChen1

SheldonKubor avatar Feb 07 '24 03:02 SheldonKubor

LOAD is a Postgres specific statement to read data in bulk into a table (from CSV, flatfile etc.). Its a kind of data pump.

In general I am not a big fan of implementing and/or maintaining such very specific DDL statements because I don't understand why its AST was needed. In which scenario would you like to traverse the AST of this statement?

manticore-projects avatar Feb 07 '24 03:02 manticore-projects

See UnsupportedStatements as explain in #1945 (unless you will sponsor or provide a specific implementation of this feature.)

manticore-projects avatar Apr 18 '24 12:04 manticore-projects