-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature]Support add/drop field for struct column(part2) (backport #4…
…6619) (#47206) Signed-off-by: sevev <[email protected]> Co-authored-by: zhangqiang <[email protected]>
- Loading branch information
1 parent
d9f1792
commit 4546416
Showing
14 changed files
with
882 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
46 changes: 46 additions & 0 deletions
46
fe/fe-core/src/main/java/com/starrocks/sql/ast/AddFieldClause.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,46 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.starrocks.sql.ast; | ||
|
||
import com.starrocks.alter.AlterOpType; | ||
import com.starrocks.sql.ast.StructFieldDesc; | ||
import com.starrocks.sql.parser.NodePosition; | ||
|
||
import java.util.Map; | ||
|
||
// clause which is used to add one field to | ||
public class AddFieldClause extends AlterTableColumnClause { | ||
private final String colName; | ||
private final StructFieldDesc fieldDesc; | ||
|
||
public String getColName() { | ||
return colName; | ||
} | ||
|
||
public StructFieldDesc getFieldDesc() { | ||
return fieldDesc; | ||
} | ||
|
||
public AddFieldClause(String colName, StructFieldDesc fieldDesc, Map<String, String> properties) { | ||
super(AlterOpType.SCHEMA_CHANGE, null, properties, NodePosition.ZERO); | ||
this.colName = colName; | ||
this.fieldDesc = fieldDesc; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) { | ||
return visitor.visitAddFieldClause(this, context); | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
fe/fe-core/src/main/java/com/starrocks/sql/ast/DropFieldClause.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,53 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
|
||
package com.starrocks.sql.ast; | ||
|
||
import com.starrocks.alter.AlterOpType; | ||
import com.starrocks.sql.parser.NodePosition; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class DropFieldClause extends AlterTableColumnClause { | ||
private final String colName; | ||
private final String fieldName; | ||
private final List<String> nestedFieldName; | ||
|
||
public String getColName() { | ||
return colName; | ||
} | ||
|
||
public String getFieldName() { | ||
return fieldName; | ||
} | ||
|
||
public List<String> getNestedFieldName() { | ||
return nestedFieldName; | ||
} | ||
|
||
public DropFieldClause(String colName, String fieldName, List<String> nestedFieldName, | ||
Map<String, String> properties) { | ||
super(AlterOpType.SCHEMA_CHANGE, null, properties, NodePosition.ZERO); | ||
this.colName = colName; | ||
this.fieldName = fieldName; | ||
this.nestedFieldName = nestedFieldName; | ||
} | ||
|
||
@Override | ||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) { | ||
return visitor.visitDropFieldClause(this, context); | ||
} | ||
} |
Oops, something went wrong.