-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Background
using the jsqlparser to process the sql , and integrate it to the data processing ,the following case is using the
PRESTO
engine
Describe the bug
ERROR-1
{"state":"ERROR","msg":"Query failed (#20200925_023246_00132_7hun5): line 1:183: mismatched input '200'. Expecting: '%', '*', '+', '-', '.', '/', 'AT', '[', '||', <expression>"}
when entering the function ,this happens when processing with field a.desc
the SQL-1
select
a.data_date,
a.id,
a.mallkey,
a.icon,
a.adicon,
a.name,
a.desc,
a.content,
a.pricetype,
a.originalprice,
a.pricecount,
a.limitbuytype,
a.limitbuycount
from
temp_dev.test_table a
where
a.part_date = '2020-09-24'
limit
200
when process with SQL-1
it will be ERROR-1
when we remove a.desc
, it can pass and process ok , like SQL-2
:
select
a.data_date,
a.id,
a.mallkey,
a.icon,
a.adicon,
a.name,
a.content,
a.pricetype,
a.originalprice,
a.pricecount,
a.limitbuytype,
a.limitbuycount
from
temp_dev.test_table a
where
a.part_date = '2020-09-24'
limit
200
also when we remove two other fields like SQL-3
:
select
a.data_date,
a.id,
a.mallkey,
a.icon,
a.adicon,
a.name,
a.desc,
a.content,
a.pricetype,
a.originalprice,
a.pricecount
from
temp_dev.test_table a
where
a.part_date = '2020-09-24'
limit
200
it can pass and process ok
while when we remove one other fields like SQL-4
:
select
a.data_date,
a.id,
a.mallkey,
a.icon,
a.adicon,
a.name,
a.desc,
a.content,
a.pricetype,
a.originalprice,
a.pricecount,
a.limitbuytype
from
temp_dev.test_table a
where
a.part_date = '2020-09-24'
limit
200
when process with SQL-4
it will be ERROR-1
System
- Database you are using
- Java Version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
- JSqlParser version
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>3.1</version>
</dependency>
this is the code:
private List<String> parseByJsqlParser(String originSql) throws JSQLParserException {
List<String> sqlList = Lists.newArrayList();
if (Strings.isNullOrEmpty(originSql)) {
return sqlList;
}
Statements statements = CCJSqlParserUtil.parseStatements(originSql);// the error happens when entering this function
List<Statement> statementList = statements.getStatements();
statementList.forEach((Statement statement) -> {
sqlList.add(statement.toString());
});
return sqlList;
}
Metadata
Metadata
Assignees
Labels
No labels