Skip to content

Commit 003ed3a

Browse files
committed
Merge PR #68853 updates
2 parents 6317008 + 4f4d90a commit 003ed3a

22 files changed

Lines changed: 492 additions & 272 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,6 @@ private List<Column> checkAndPrepareMaterializedView(CreateMaterializedViewComma
629629
}
630630

631631
for (Column column : newMVColumns) {
632-
if (column.getType().typeContainsFile()) {
633-
throw new DdlException(
634-
"Do not support FILE type or types containing FILE in materialized view columns");
635-
}
636632
// check c.2
637633
if (column.isKey() && column.getType().isFloatingPointType()) {
638634
throw new DdlException("Do not support float/double type on key column, you can change it to decimal");

‎fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ public static void checkDistributionColumnType(String columnName, Type type) thr
6565
if (type.isStructType()) {
6666
throw new DdlException("Struct Type should not be used in distribution column[" + columnName + "].");
6767
}
68-
if (type.typeContainsFile()) {
69-
throw new DdlException("FILE Type should not be used in distribution column[" + columnName + "]");
70-
}
7168
if (type.isJsonbType()) {
7269
throw new DdlException("JsonType type should not be used in distribution column[" + columnName + "].");
7370
}

‎fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PlanTranslatorContext.java‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ public class PlanTranslatorContext {
173173

174174
private final Set<SlotId> virtualColumnIds = Sets.newHashSet();
175175

176+
/**
177+
* Constructor for testing purposes with default values.
178+
*/
179+
@VisibleForTesting
180+
public PlanTranslatorContext() {
181+
this(Config.be_exec_version);
182+
}
183+
184+
@VisibleForTesting
185+
PlanTranslatorContext(int beExecVersion) {
186+
this.connectContext = null;
187+
this.statementContext = new StatementContext();
188+
this.statementContext.initializeBeExecVersion(beExecVersion);
189+
this.scanContext = ScanContext.builder().beExecVersion(beExecVersion).build();
190+
this.translator = null;
191+
this.topnFilterContext = new TopnFilterContext();
192+
this.descTable = new DescriptorTable();
193+
}
194+
176195
/** PlanTranslatorContext */
177196
public PlanTranslatorContext(CascadesContext ctx) {
178197
this(ctx, new DescriptorTable());
@@ -207,25 +226,6 @@ public Map<String, TS3Resource> getS3Resources() {
207226
return resources;
208227
}
209228

210-
/**
211-
* Constructor for testing purposes with default values.
212-
*/
213-
@VisibleForTesting
214-
public PlanTranslatorContext() {
215-
this(Config.be_exec_version);
216-
}
217-
218-
@VisibleForTesting
219-
PlanTranslatorContext(int beExecVersion) {
220-
this.connectContext = null;
221-
this.statementContext = new StatementContext();
222-
this.statementContext.initializeBeExecVersion(beExecVersion);
223-
this.scanContext = ScanContext.builder().beExecVersion(beExecVersion).build();
224-
this.translator = null;
225-
this.topnFilterContext = new TopnFilterContext();
226-
this.descTable = new DescriptorTable();
227-
}
228-
229229
public int getBeExecVersion() {
230230
return statementContext.getBeExecVersion();
231231
}

‎fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/check/CheckCast.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ public static boolean check(DataType originalType, DataType targetType, boolean
396396
public static boolean check(DataType originalType, DataType targetType,
397397
boolean isStrictMode, boolean looseAggState) {
398398
if (originalType.typeContainsFile() || targetType.typeContainsFile()) {
399-
return !targetType.isAggStateType()
400-
&& (originalType.isNullType() || originalType.equals(targetType));
399+
return false;
401400
}
402401
if (originalType instanceof ConnectorComputeVariantType && targetType.isVariantType()) {
403402
// The connector marker and ordinary Variant share the V2 runtime carrier. Allow the

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,7 @@ public TypeCheckResult checkInputDataTypes() {
191191
return commonCheckResult;
192192
}
193193
}
194-
TypeCheckResult result = checkInputDataTypesInternal();
195-
if (result.success()) {
196-
ExpressionUtils.checkFileExpression(this);
197-
}
198-
return result;
194+
return checkInputDataTypesInternal();
199195
}
200196

201197
public int fastChildrenHashCode() {

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/InSubquery.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919

2020
import org.apache.doris.nereids.exceptions.UnboundException;
2121
import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
22+
import org.apache.doris.nereids.trees.expressions.typecoercion.TypeCheckResult;
2223
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
2324
import org.apache.doris.nereids.trees.plans.logical.LogicalPlan;
2425
import org.apache.doris.nereids.types.BooleanType;
2526
import org.apache.doris.nereids.types.DataType;
27+
import org.apache.doris.nereids.util.ExpressionUtils;
2628

2729
import com.google.common.base.Preconditions;
2830
import com.google.common.collect.ImmutableList;
@@ -63,6 +65,13 @@ public DataType getDataType() throws UnboundException {
6365
return BooleanType.INSTANCE;
6466
}
6567

68+
@Override
69+
protected TypeCheckResult checkInputDataTypesInternal() {
70+
ExpressionUtils.checkFileKey(getCompareExpr(), "IN");
71+
ExpressionUtils.checkFileKey(getSubqueryOutput(), "IN");
72+
return TypeCheckResult.SUCCESS;
73+
}
74+
6675
@Override
6776
public boolean nullable() throws UnboundException {
6877
return super.nullable() || this.child().nullable();

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/WindowExpression.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
import org.apache.doris.nereids.exceptions.UnboundException;
2121
import org.apache.doris.nereids.trees.UnaryNode;
22+
import org.apache.doris.nereids.trees.expressions.typecoercion.TypeCheckResult;
2223
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
2324
import org.apache.doris.nereids.types.DataType;
25+
import org.apache.doris.nereids.util.ExpressionUtils;
2426

2527
import com.google.common.base.Preconditions;
2628
import com.google.common.collect.ImmutableList;
@@ -273,6 +275,13 @@ public DataType getDataType() throws UnboundException {
273275
return function.getDataType();
274276
}
275277

278+
@Override
279+
protected TypeCheckResult checkInputDataTypesInternal() {
280+
partitionKeys.forEach(key -> ExpressionUtils.checkFileKey(key, "window PARTITION BY"));
281+
orderKeys.forEach(key -> ExpressionUtils.checkFileKey(key.child(), "window ORDER BY"));
282+
return TypeCheckResult.SUCCESS;
283+
}
284+
276285
public boolean isSkew() {
277286
return isSkew;
278287
}

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/ColumnDefinition.java‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,18 @@ private void checkKeyColumnType(boolean isOlap) {
390390
}
391391
}
392392

393+
private void validateDataType() {
394+
try {
395+
type.validateDataType();
396+
if (type.typeContainsFile()) {
397+
throw new AnalysisException("FILE and types containing FILE cannot be used as table columns");
398+
}
399+
} catch (AnalysisException e) {
400+
throw new AnalysisException("Invalid type " + type.toCatalogDataType().toSql()
401+
+ " for column '" + name + "': " + e.getMessage(), e);
402+
}
403+
}
404+
393405
/**
394406
* validate column definition and analyze
395407
*/
@@ -433,11 +445,7 @@ private void validateInternal(boolean isOlap, Set<String> keysSet, Set<String> c
433445
throw new AnalysisException(
434446
"Cannot use `VARIANT` type column named with a `.` character: " + name);
435447
}
436-
type.validateDataType();
437-
if (type.typeContainsFile()) {
438-
throw new AnalysisException(isOlap ? "FILE columns are not supported in internal tables"
439-
: "FILE columns are not supported in external tables");
440-
}
448+
validateDataType();
441449
type = updateCharacterTypeLength(type);
442450
if (!isSystemGeneratedTable && isOlap && keysType != KeysType.AGG_KEYS && isAggregateTableOnlyType()
443451
&& !Config.enable_non_aggregate_table_state_types) {

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,7 @@ public void analyze(ConnectContext ctx) throws Exception {
191191

192192
// analyze distribute
193193
Map<String, ColumnDefinition> columnMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
194-
columns.forEach(c -> {
195-
if (c.getType().typeContainsFile()) {
196-
throw new AnalysisException("FILE columns are not supported in internal tables");
197-
}
198-
columnMap.put(c.getName(), c);
199-
});
194+
columns.forEach(c -> columnMap.put(c.getName(), c));
200195
// Which key model the MV is built on settles its distribution: the unique-key model is maintained
201196
// through a row-id, so it is distributed on that unless the user hashed on something themselves,
202197
// while an append-only detail MV holds the query's own rows and is distributed like any other DUP

‎fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/DistributionDescriptor.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ public void validate(Map<String, ColumnDefinition> columnMap, KeysType keysType)
103103
});
104104
for (String columnName : cols) {
105105
ColumnDefinition columnDefinition = columnMap.get(columnName);
106-
if (columnDefinition.getType().toCatalogDataType().typeContainsFile()) {
107-
throw new AnalysisException(
108-
"FILE Type should not be used in distribution column[" + columnName + "]");
109-
}
110106
if (!columnDefinition.isKey()
111107
&& (keysType == KeysType.UNIQUE_KEYS || keysType == KeysType.AGG_KEYS)) {
112108
throw new AnalysisException("Distribution column[" + columnName + "] is not key column");

0 commit comments

Comments
 (0)