PrimaryKey table returns different results for the same TIME value when performing lookup and scan operations
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 625
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 97
Description
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.
### Fluss version
main (development)
### Please describe the bug 🐞
When write `TIME` values to Fluss, lookup and scan will return different results of the same row. The following code reproduce the problem:
```java
@Test
void testUpsert() throws Exception {
LocalTime time = LocalTime.of(10, 10, 10, 123000000);
long mill = time.toNanoOfDay() / 1_000_000;
System.out.println("write time: " + mill);
Schema schema =
Schema.newBuilder()
.column("a", DataTypes.TIME())
.column("b", DataTypes.INT())
.primaryKey("a", "b")
.build();
TablePath tablePath =
TablePath.of("test_db_1", "test_pk_table_1");
TableDescriptor tableDescriptor =
TableDescriptor.builder().schema(schema).distributedBy(1)
.partitionedBy("a")
.build();
createTable(tablePath, tableDescriptor, false);
try (Table table = conn.getTable(tablePath)) {
UpsertWriter upsertWriter = table.newUpsert().createWriter();
upsertWriter.upsert(row((int) mill, 1)).get();
upsertWriter.flush();
LogScanner logScanner = createLogScanner(table);
// subscribeFromBeginning(logScanner, table);
logScanner.subscribe(0, 0, 0);
ScanRecords scanRecords = logScanner.poll(Duration.ofSeconds(1));
for (ScanRecord scanRecord : scanRecords) {
InternalRow row = scanRecord.getRow();
System.out.println("scan result:" + row.getInt(0));
}
Lookuper lookuper = table.newLookup().createLookuper();
ProjectedRow keyRow = ProjectedRow.from(schema.getPrimaryKeyIndexes());
keyRow.replaceRow(row((int) mill, 1));
InternalRow singletonRow = lookuper.lookup(keyRow).get().getSingletonRow();
System.out.println("lookup result:" + singletonRow.getInt(0));
}
}
```
The result is:
```
write time: 36610123
scan result:36610000
lookup result:36610123
```
### Solution
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.