You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/15 06:38:22 UTC
[GitHub] [doris] morningman commented on a diff in pull request #15094: [Bug](datev2) Fix wrong result when use datev2 as partition key
morningman commented on code in PR #15094:
URL: https://github.com/apache/doris/pull/15094#discussion_r1049264424
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java:
##########
@@ -721,14 +752,17 @@ private void fromPackedDatetime(long packedTime) {
public void readFields(DataInput in) throws IOException {
super.readFields(in);
short dateLiteralType = in.readShort();
- fromPackedDatetime(in.readLong());
if (dateLiteralType == DateLiteralType.DATETIME.value()) {
+ fromPackedDatetime(in.readLong());
this.type = Type.DATETIME;
} else if (dateLiteralType == DateLiteralType.DATE.value()) {
+ fromPackedDatetime(in.readLong());
this.type = Type.DATE;
} else if (dateLiteralType == DateLiteralType.DATETIMEV2.value()) {
- this.type = ScalarType.createDatetimeV2Type(in.readInt());
+ fromPackedDatetimeV2(in.readLong());
+ this.type = ScalarType.createDatetimeV2Type(in.readShort());
Review Comment:
```suggestion
this.type = ScalarType.createDatetimeV2Type(in.readInt());
```
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java:
##########
@@ -690,10 +721,10 @@ public void write(DataOutput out) throws IOException {
} else if (this.type.getPrimitiveType() == PrimitiveType.DATETIMEV2) {
out.writeShort(DateLiteralType.DATETIMEV2.value());
out.writeLong(makePackedDatetimeV2());
- out.writeInt(((ScalarType) this.type).getScalarScale());
+ out.writeShort(((ScalarType) this.type).getScalarScale());
} else if (this.type.equals(Type.DATEV2)) {
out.writeShort(DateLiteralType.DATEV2.value());
- out.writeLong(makePackedDatetimeV2());
+ out.writeInt(makePackedDateV2());
Review Comment:
This will cause FE fail to restart
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org