-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
优化starrocks的建表sql解析 #5905
- Loading branch information
Showing
8 changed files
with
894 additions
and
74 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
core/src/main/java/com/alibaba/druid/sql/dialect/starrocks/ast/StarRocksIndexDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.alibaba.druid.sql.dialect.starrocks.ast; | ||
|
||
import com.alibaba.druid.sql.ast.SQLName; | ||
import com.alibaba.druid.sql.ast.SQLObjectImpl; | ||
import com.alibaba.druid.sql.ast.statement.SQLTableElement; | ||
import com.alibaba.druid.sql.visitor.SQLASTVisitor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* INDEX index_name (col_name[, col_name, ...]) [USING BITMAP] [COMMENT ''] | ||
* @author lizongbo | ||
* @see <a href="https://docs.starrocks.io/zh/docs/sql-reference/sql-statements/data-definition/CREATE_TABLE/">...</a> | ||
*/ | ||
public class StarRocksIndexDefinition extends SQLObjectImpl implements SQLTableElement { | ||
private SQLName indexName; | ||
private List<SQLName> columns = new ArrayList<SQLName>(); | ||
private boolean usingBitmap; | ||
private String comment; | ||
|
||
public SQLName getIndexName() { | ||
return indexName; | ||
} | ||
|
||
public void setIndexName(SQLName indexName) { | ||
this.indexName = indexName; | ||
} | ||
|
||
public List<SQLName> getColumns() { | ||
return columns; | ||
} | ||
|
||
public void setColumns(List<SQLName> columns) { | ||
this.columns = columns; | ||
} | ||
|
||
public boolean isUsingBitmap() { | ||
return usingBitmap; | ||
} | ||
|
||
public void setUsingBitmap(boolean usingBitmap) { | ||
this.usingBitmap = usingBitmap; | ||
} | ||
|
||
public String getComment() { | ||
return comment; | ||
} | ||
|
||
public void setComment(String comment) { | ||
this.comment = comment; | ||
} | ||
|
||
@Override | ||
protected void accept0(SQLASTVisitor v) { | ||
if (v.visit(this)) { | ||
acceptChild(v, indexName); | ||
acceptChild(v, columns); | ||
} | ||
v.endVisit(this); | ||
|
||
} | ||
|
||
@Override | ||
public StarRocksIndexDefinition clone() { | ||
StarRocksIndexDefinition x = new StarRocksIndexDefinition(); | ||
if (indexName != null) { | ||
x.setIndexName(indexName.clone()); | ||
} | ||
for (SQLName column : columns) { | ||
SQLName columnCloned = column.clone(); | ||
columnCloned.setParent(x); | ||
x.columns.add(columnCloned); | ||
} | ||
x.usingBitmap = usingBitmap; | ||
x.comment = comment; | ||
return x; | ||
} | ||
} |
Oops, something went wrong.