mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fix for clickhouse ddl output
This commit is contained in:
+27
@@ -109,4 +109,31 @@ public class ClickhouseOutputVisitor extends SQLASTOutputVisitor implements Clic
|
||||
printAndAccept(x.getColumns(), ", ");
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLArrayDataType x) {
|
||||
final List<SQLExpr> arguments = x.getArguments();
|
||||
if (Boolean.TRUE.equals(x.getAttribute("ads.arrayDataType"))) {
|
||||
x.getComponentType().accept(this);
|
||||
print('[');
|
||||
printAndAccept(arguments, ", ");
|
||||
print(']');
|
||||
} else {
|
||||
SQLDataType componentType = x.getComponentType();
|
||||
if (componentType != null) {
|
||||
print0(ucase ? "Array<" : "array<");
|
||||
componentType.accept(this);
|
||||
print('>');
|
||||
} else {
|
||||
print0(ucase ? "Array" : "array");
|
||||
}
|
||||
|
||||
if (arguments.size() > 0) {
|
||||
print('(');
|
||||
printAndAccept(arguments, ", ");
|
||||
print(')');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ public class ClickHouseResourceTest extends OracleTest {
|
||||
exec_test("bvt/parser/clickhouse-13.txt");
|
||||
}
|
||||
|
||||
public void test_14() throws Exception {
|
||||
exec_test("bvt/parser/clickhouse-14.txt");
|
||||
}
|
||||
|
||||
public void exec_test(String resource) throws Exception {
|
||||
System.out.println(resource);
|
||||
InputStream is = null;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE if not exists etda.mytable1
|
||||
(
|
||||
`id` UInt64,
|
||||
`action_parameter_uint64_list` Array(UInt64),
|
||||
`action_parameter_string_list` Array(String)
|
||||
)
|
||||
---------------------------
|
||||
CREATE TABLE IF NOT EXISTS etda.mytable1 (
|
||||
`id` UInt64,
|
||||
`action_parameter_uint64_list` Array(UInt64),
|
||||
`action_parameter_string_list` Array(String)
|
||||
)
|
||||
Reference in New Issue
Block a user