mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved clickhouse support, fix #4043
This commit is contained in:
@@ -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
|
||||
)
|
||||
Reference in New Issue
Block a user