improved clickhouse support, fix #4043

This commit is contained in:
高铁
2020-11-15 10:25:50 +08:00
parent 32492da97c
commit 11d7346380
4 changed files with 20 additions and 2 deletions
@@ -1116,7 +1116,7 @@ public class SQLExprParser extends SQLParser {
}
throw new ParserException("ERROR. " + lexer.info());
case LBRACKET:
if (dbType == DbType.odps) {
if (dbType == DbType.odps || dbType == DbType.clickhouse) {
SQLArrayExpr array = new SQLArrayExpr();
lexer.nextToken();
this.exprList(array.getValues(), array);
@@ -2476,7 +2476,9 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
return false;
}
}
exp.accept(this);
if (exp != null) {
exp.accept(this);
}
return false;
}
@@ -40,6 +40,10 @@ public class ClickHouseResourceTest extends OracleTest {
exec_test("bvt/parser/clickhouse-0.txt");
}
public void test_1() throws Exception {
exec_test("bvt/parser/clickhouse-1.txt");
}
public void exec_test(String resource) throws Exception {
System.out.println(resource);
InputStream is = null;
@@ -0,0 +1,12 @@
select * from data_all dsa where dsa.sign='1' and dsa.number in ( select DISTINCT number
from dc_clients do
where hasAny(splitByString(',',cast(do.df_time as String)),[?,?])=1 )
---------------------------
SELECT *
FROM data_all dsa
WHERE dsa.sign = '1'
AND dsa.number IN (
SELECT DISTINCT number
FROM dc_clients do
WHERE hasAny(splitByString(',', CAST(do.df_time AS String)), [?, ?]) = 1
)