-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid OffsetDateTime comparison accounting for offset differences #536
Comments
May be this is not a problem of a client, but the Java Time API itself and the way we use it in evitaDB. See following explanation from chatGPT which we verified manually by our tests. For values:
Which are logically equal: When you're using In the case of the timestamps you provided:
Although they represent the same absolute point in time, their offsets differ. According to the
This means that an If your goal is to compare only the instants (ignoring the offsets), you should convert these import java.time.OffsetDateTime;
import java.time.Instant;
OffsetDateTime dateTime1 = OffsetDateTime.parse("2024-04-24T11:07:11.677467736Z");
OffsetDateTime dateTime2 = OffsetDateTime.parse("2024-04-24T13:07:11.677467736+02:00");
Instant instant1 = dateTime1.toInstant();
Instant instant2 = dateTime2.toInstant();
int result = instant1.compareTo(instant2); // This should return 0, indicating equality. This conversion to |
I think it's not entirely possible to pass the original form of the date time over different protocols from different clients and this may be also the case of evitaLab (waiting for confirmation from @lukashornych). |
…es into account Equal date times: - `2024-04-24T11:07:11.677467736Z` - `2024-04-24T13:07:11.677467736+02:00` were considered different. Also, the filter index didn't take string collations into account, so less than & greater than didn't work properly for strings containing national characters. The fix changed the format of the stored data, so I had to include a backward compatible deserializer so that existing data is loaded correctly. When the data is saved again, it has the correct new format. The old format should be automatically removed by compaction.
…version-on-the-way-from-the-client-to-the-server fix (#536): Invalid OffsetDateTime comparison taking offset difference into an account
…es into account The comparator was not updated in "changes" delta layer which lead to invalid sequence for collated strings. This corrupted also stored data so we have to work around the non-monotonic rows of values on start.
There is probably some bug in sending the OffsetDateTime over the wire:
The data in the end looks like that:
And this doesn't work well for the equality comparison although there were correct data at the start of the query.
The text was updated successfully, but these errors were encountered: