github-actions[bot] commented on code in PR #64026:
URL: https://github.com/apache/doris/pull/64026#discussion_r3342001442
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/StepPartition.java:
##########
@@ -48,22 +48,32 @@ public StepPartition(boolean ifNotExists, String
partitionName, List<Expression>
@Override
public void validate(Map<String, String> properties) {
super.validate(properties);
- if (fromExpression.stream().anyMatch(MaxValue.class::isInstance)
- || toExpression.stream().anyMatch(MaxValue.class::isInstance))
{
- throw new AnalysisException("MAXVALUE cannot be used in step
partition");
+ for (Expression expression : fromExpression) {
+ if (expression instanceof MaxValue) {
+ throw new AnalysisException("MAXVALUE cannot be used in step
partition");
+ }
+ }
+ for (Expression expression : toExpression) {
+ if (expression instanceof MaxValue) {
+ throw new AnalysisException("MAXVALUE cannot be used in step
partition");
+ }
}
}
/**
* translate to catalog objects.
*/
public MultiPartitionDesc translateToCatalogStyle() {
- List<PartitionValue> fromValues = fromExpression.stream()
- .map(this::toLegacyPartitionValueStmt)
- .collect(Collectors.toList());
- List<PartitionValue> toValues = toExpression.stream()
- .map(this::toLegacyPartitionValueStmt)
- .collect(Collectors.toList());
+ List<PartitionValue> fromValues = new ArrayList<>();
+ for (int i = 0; i < fromExpression.size(); i++) {
+ Expression typedFrom =
fromExpression.get(i).castTo(partitionTypes.get(i));
+ fromValues.add(toLegacyPartitionValueStmt(fromExpression.get(i),
typedFrom));
Review Comment:
`StepPartition` has the same pre-validation cast hazard on the `FROM` bound.
With a single partition column, `FROM (1, 2) TO (3, 4) INTERVAL ...` indexes
`partitionTypes.get(1)` here before `MultiPartitionDesc.trans()` can raise the
intended start/end column-size `AnalysisException`. Add an explicit
`fromExpression`/`toExpression` cardinality check before these casts so
malformed step partitions fail deterministically.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]