Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: sevev <[email protected]>
  • Loading branch information
sevev committed Jun 19, 2024
1 parent 0985e80 commit 76a28a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public Void visitAddFieldClause(AddFieldClause clause, ConnectContext context) {
throw new SemanticException(PARSER_ERROR_MSG.invalidColFormat(columnName));
}

if (!(table instanceof OlapTable)) {
if (!table.isOlapTable()) {
throw new SemanticException("Add field only support olap table");
}

Expand All @@ -741,7 +741,7 @@ public Void visitDropFieldClause(DropFieldClause clause, ConnectContext context)
throw new SemanticException(PARSER_ERROR_MSG.invalidColFormat(columnName));
}

if (!(table instanceof OlapTable)) {
if (!table.isOlapTable()) {
throw new SemanticException("Drop field only support olap table");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public StructFieldDesc getFieldDesc() {
return fieldDesc;
}

public AddFieldClause(String colName, StructFieldDesc fieldDesc, String rollupName, Map<String, String> properties) {
super(AlterOpType.SCHEMA_CHANGE, rollupName, properties, NodePosition.ZERO);
public AddFieldClause(String colName, StructFieldDesc fieldDesc, Map<String, String> properties) {
super(AlterOpType.SCHEMA_CHANGE, null, properties, NodePosition.ZERO);
this.colName = colName;
this.fieldDesc = fieldDesc;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public List<String> getNestedFieldName() {
}

public DropFieldClause(String colName, String fieldName, List<String> nestedFieldName,
String rollupName, Map<String, String> properties) {
super(AlterOpType.SCHEMA_CHANGE, rollupName, properties, NodePosition.ZERO);
Map<String, String> properties) {
super(AlterOpType.SCHEMA_CHANGE, null, properties, NodePosition.ZERO);
this.colName = colName;
this.fieldName = fieldName;
this.nestedFieldName = nestedFieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4107,13 +4107,12 @@ public ParseNode visitAddFieldClause(StarRocksParser.AddFieldClauseContext conte
throw new ParsingException("add field clause name is null");
}
StructFieldDesc fieldDesc = new StructFieldDesc(fieldName, parts, typeDef, fieldPosition);
return new AddFieldClause(columnName, fieldDesc, null, getProperties(context.properties()));
return new AddFieldClause(columnName, fieldDesc, getProperties(context.properties()));
}

@Override
public ParseNode visitDropFieldClause(StarRocksParser.DropFieldClauseContext context) {
String columnName = getIdentifierName(context.identifier());
String rollupName = null;
List<String> parts = getFieldName(context.nestedFieldName());
String fieldName = null;
if (parts != null && !parts.isEmpty()) {
Expand All @@ -4123,7 +4122,7 @@ public ParseNode visitDropFieldClause(StarRocksParser.DropFieldClauseContext con
if (fieldName == null) {
throw new ParsingException("drop field clause name is null");
}
return new DropFieldClause(columnName, fieldName, parts, rollupName, getProperties(context.properties()));
return new DropFieldClause(columnName, fieldName, parts, getProperties(context.properties()));
}

@Override
Expand Down

0 comments on commit 76a28a8

Please sign in to comment.