Skip to content

Commit

Permalink
bugfix: fix unittest assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
lfyzjck committed Apr 1, 2024
1 parent a622379 commit c600c84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected Timestamp decodeNotNullForBatchWrite(int flag, CodecDataInput cdi) {
@Override
public Object getOriginDefaultValue(String value, long version) {
// avoid exception: org.joda.time.IllegalFieldValueException: Cannot parse "0000-00-00 00:00:00": Value 0 for monthOfYear must be in the range [1,12]
if (value != null && value.equals(TIMESTAMP_NULL_DEFAULT)) {
if (TIMESTAMP_NULL_DEFAULT.equals(value)) {
value = null;
}
return super.getOriginDefaultValue(value, version);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.tidb.bigdata.tidb.meta;

import static org.junit.Assert.assertEquals;

import io.tidb.bigdata.tidb.types.TimestampType;
import org.junit.Test;

Expand All @@ -15,12 +17,13 @@ public void testToProto() {
TimestampType.TIMESTAMP,
SchemaState.StatePublic,
"0000-00-00 00:00:00",
"0000-00-00 00:00:00",
"2024-04-01 00:00:00",
"0000-00-00 00:00:00",
"timestamp",
1,
"",
false);
System.out.println(columnInfo.getOriginDefaultValueAsByteString());
assertEquals(
"\000", columnInfo.getOriginDefaultValueAsByteString().toStringUtf8());
}
}

0 comments on commit c600c84

Please sign in to comment.