starocean999 commented on code in PR #64026:
URL: https://github.com/apache/doris/pull/64026#discussion_r3418575600
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionValue.java:
##########
@@ -17,42 +17,40 @@
package org.apache.doris.analysis;
-import org.apache.doris.catalog.Type;
-import org.apache.doris.common.AnalysisException;
-
import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
public class PartitionValue {
public static final PartitionValue MAX_VALUE = new PartitionValue();
- private String value;
+ private LiteralExpr value;
+ private String stringValue;
private boolean isNullPartition = false;
private PartitionValue() {
-
+ this.value = MaxLiteral.MAX_VALUE;
+ this.stringValue = "MAXVALUE";
}
- public PartitionValue(String value) {
- this.value = value;
+ public PartitionValue(LiteralExpr value) {
+ this(value, false, value.getStringValue());
}
- public PartitionValue(Long value) {
- this.value = value.toString();
+ public PartitionValue(LiteralExpr value, boolean isNullPartition) {
+ this(value, isNullPartition, value == null ? null :
value.getStringValue());
}
- public PartitionValue(String value, boolean isNullPartition) {
- this.value = value;
+ public PartitionValue(LiteralExpr value, boolean isNullPartition, String
stringValue) {
+ if (isNullPartition) {
+ Preconditions.checkArgument(value instanceof NullLiteral);
+ }
+ this.value = Preconditions.checkNotNull(value);
this.isNullPartition = isNullPartition;
+ this.stringValue = stringValue != null ? stringValue :
this.value.getStringValue();
}
- public LiteralExpr getValue(Type type) throws AnalysisException {
- if (isNullPartition) {
- return new NullLiteral();
- }
- if (isMax()) {
- return LiteralExprUtils.createInfinity(type, true);
- }
- return LiteralExprUtils.createLiteral(value, type);
+ public LiteralExpr getValue() {
+ return value;
}
public boolean isMax() {
Review Comment:
Original code compare string value directly, this keeps behavior as original
code like '__HIVE_DEFAULT_PARTITION__'
--
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]