JSqlParser
JSqlParser copied to clipboard
use arrayMap function when Mybatis-plus integrated clickhouse appear: optimize this sql to a count sql has exception net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
Describe the bug use clickhouse database arrayMap function
To Reproduce Steps to reproduce the behavior:
-
Example SQL select card_type, origin_account, trade_account, // 异常情况在执行arrayMap处 arrayMap(x -> (toDecimal128(x,15) * toDecimal128(transfer_preference_amount,15)),prefer_path_ratio) as merge_line_ratio FROM t_xxx
-
Exception // 1 optimize this sql to a count sql has exception,sql:" select card_type, origin_account, trade_account, arrayMap(x->(toDecimal128(x,15) * toDecimal128(transfer_preference_amount,15)),prefer_path_ratio) as merge_line_ratio FROM t_xxx"
// 2 exception: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "(" at line 161, column 25.
Was expecting one of:
"&" ")" "," "::" "<<" ">>" "ACTION" "ANY" "AS" "BYTE" "CASCADE" "CAST" "CHANGE" "CHAR" "CHARACTER" "COLLATE" "COLUMN" "COLUMNS" "COMMENT" "COMMIT" "CONNECT" "CYCLE" "DESC" "DESCRIBE" "DISABLE" "DIV" "DO" "DUPLICATE" "ENABLE" "END" "EXCEPT" "EXCLUDE" "EXTRACT" "FALSE" "FIRST" "FN" "FOLLOWING" "FOR" "FORMAT" "FROM" "GROUP" "HAVING" "INDEX" "INSERT" "INTERSECT" "INTERVAL" "INTO" "ISNULL" "KEY" "LAST" "MATERIALIZED" "MINUS" "NEXTVAL" "NO" "NOLOCK" "NULLS" "OF" "OPEN" "ORDER" "OVER" "PARTITION" "PATH" "PERCENT" "PRECISION" "PRIMARY" "PRIOR" "RANGE" "READ" "REPLACE" "ROW" "ROWS" "SCHEMA" "SEPARATOR" "SEQUENCE" "SESSION" "SIBLINGS" "SIZE" "START" "TABLE" "TEMP" "TEMPORARY" "TO" "TOP" "TRUE" "TRUNCATE" "TYPE" "UNION" "UNSIGNED" "VALIDATE" "VALUE" "VALUES" "VIEW" "WHERE" "WINDOW" "XML" "ZONE" "[" "^" "|" <K_DATETIMELITERAL> <K_DATE_LITERAL> <S_CHAR_LITERAL> <S_IDENTIFIER> <S_QUOTED_IDENTIFIER>
Expected behavior Does not allow for warn log when Example this SQL
System
- Database you are using:clickhouse
- Java Version:JDK1.8
- JSqlParser version:jsqlparser-4.0
The clickhouse specific -> operator is not supported in the context of higher order functions and lambda functions. In JSQLParser, the -> operator is used for JSON.
thanks ! so this problem is can't solve? it will be support this operator in new version?
JSQLParser is open source software and you challenge can be solved, when there is enough interest in supporting the Clickhouse specific dialect.
You best option was to provide a Pull Request or to sponsor an implementation.
JSQLParser is open source software and you challenge can be solved, when there is enough interest in supporting the Clickhouse specific dialect.
You best option was to provide a Pull Request or to sponsor an implementation.
Thanks! i get it!
Closed, since no further question has been asked.