Skip to content

Commit c0a58c1

Browse files
lingo-xpwenshao
authored andcommitted
Fix holo array output.
1 parent 6024bcf commit c0a58c1

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

core/src/main/java/com/alibaba/druid/sql/dialect/hologres/visitor/HologresOutputVisitor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,8 @@ public void printComment(String comment) {
104104
endLineComment = true;
105105
}
106106
}
107+
108+
public void printArrayExprPrefix() {
109+
print0(ucase ? "ARRAY" : "array");
110+
}
107111
}

core/src/main/java/com/alibaba/druid/sql/dialect/presto/visitor/PrestoOutputVisitor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,8 @@ public boolean visit(PrestoDateTimeExpr x) {
202202
timeZone.accept(this);
203203
return false;
204204
}
205+
206+
public void printArrayExprPrefix() {
207+
print0(ucase ? "ARRAY" : "array");
208+
}
205209
}

core/src/main/java/com/alibaba/druid/sql/visitor/SQLASTOutputVisitor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7650,6 +7650,8 @@ public boolean visit(SQLAlterTableSetSerde x) {
76507650
return false;
76517651
}
76527652

7653+
public void printArrayExprPrefix() {
7654+
}
76537655
@Override
76547656
public boolean visit(SQLArrayExpr x) {
76557657
SQLExpr expr = x.getExpr();
@@ -7661,10 +7663,7 @@ public boolean visit(SQLArrayExpr x) {
76617663
} else if (expr != null) {
76627664
expr.accept(this);
76637665
} else {
7664-
boolean trino = dbType == DbType.trino || dbType == DbType.presto || dbType == DbType.supersql;
7665-
if (trino) {
7666-
print0(ucase ? "ARRAY" : "array");
7667-
}
7666+
printArrayExprPrefix();
76687667
}
76697668

76707669
if (x.getDataType() != null) {

core/src/test/resources/bvt/parser/hologres/0.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
select []
2+
--------------------
3+
SELECT ARRAY[]
4+
------------------------------------------------------------------------------------------------------------------------
15
select cast(($0 + interval $1 week) as date)
26
--------------------
37
SELECT CAST(($0 + INTERVAL '$1' WEEK) AS date)

0 commit comments

Comments
 (0)