Skip to content

Commit

Permalink
Fix gaussdb vacuum clause transfer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
woyumen4597 authored and wenshao committed Dec 13, 2024
1 parent 4087fa9 commit 2648a17
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.alibaba.druid.sql.dialect.gaussdb.ast.stmt.GaussDbCreateTableStatement;
import com.alibaba.druid.sql.dialect.gaussdb.ast.stmt.GaussDbInsertStatement;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGInsertStatement;
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGVacuumStatement;
import com.alibaba.druid.sql.dialect.postgresql.visitor.PGOutputVisitor;

import java.util.List;
Expand Down Expand Up @@ -366,4 +367,14 @@ public boolean visit(SQLIntervalExpr x) {
}
return false;
}

@Override
protected void printVacuumRest(PGVacuumStatement x) {
if (x.isDeltaMerge()) {
print0(ucase ? "DELTAMERGE " : "deltamerge ");
}
if (x.isHdfsDirectory()) {
print0(ucase ? "HDFSDIRECTORY " : "hdfsdirectory ");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ public void setTruncate(boolean truncate) {
protected void accept0(SQLASTVisitor visitor) {
if (visitor instanceof PGASTVisitor) {
accept0((PGASTVisitor) visitor);
} else {
super.accept0(visitor);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2857,16 +2857,14 @@ public boolean visit(PGVacuumStatement x) {
if (x.isTruncate()) {
print0(ucase ? "TRUNCATE " : "truncate ");
}
if (x.isDeltaMerge()) {
print0(ucase ? "DELTAMERGE " : "deltamerge ");
}
if (x.isHdfsDirectory()) {
print0(ucase ? "HDFSDIRECTORY " : "hdfsdirectory ");
}
printVacuumRest(x);
printAndAccept(x.getTableSources(), ", ");
return false;
}

protected void printVacuumRest(PGVacuumStatement x){
}

@Override
public boolean visit(PGAlterDatabaseStatement x) {
print0(ucase ? "ALTER DATABASE " : "alter database ");
Expand Down

0 comments on commit 2648a17

Please sign in to comment.