Repository navigation
Conversation
The engine now stores TIMESTAMP values from year 0000 to 9999, but the JNI layer moved a timestamp as i64 nanoseconds, which only reaches 1677 to 2262. A query that returned a far value failed as a whole, and a far parameter was refused before it reached the engine. I changed the wire format between Rust and Java to seconds (i64) plus nanoseconds (u32), the way java.time.Instant holds a time. It costs four bytes per value and drops a division when decoding; a read of 200k timestamps and a bind-and-query loop measured the same before and after. The engine now decides what it stores, so sub-microsecond digits outside 1680 to 2254 surface as its own type error. The new tests read and bind the far values and the nanosecond edges through the native API and JDBC. The 0.5.1 engine cannot store years outside 1677 to 2262, so the tests that store them skip there; the parameter round trips and the type error run on both engines.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The engine after 0.5.1 stores TIMESTAMP values from year 0000 to 9999 (stoolap#1309), but the JNI layer moved a timestamp as i64 nanoseconds, which only reaches 1677-09-21 to 2262-04-11. A query that returned a far value failed as a whole, and a far parameter was refused before it reached the engine.
What changed
java.time.Instantholds it (jni/src/lib.rs,BulkDecoder,ParamEncoder).java.sql.Timestampbefore 1582-10-15 prints in the Julian calendar while holding the same instant.Cost
Four more bytes per TIMESTAMP value, and one division less when decoding. Reading 200k timestamps measured 28 to 36 ns per row before and 29 to 32 after; a bind-and-query loop measured 983 to 985 ns before and 984 to 987 after.
Tests
DriverFeaturesTestandJdbcConformanceTestread and bind 1500-06-15 12:00:00.123456, 0001-01-01, 9999-12-31 23:59:59.999999 and the nanosecond edges 1680-01-01 00:00:00.000000001 and 2253-12-31 23:59:59.999999999 through the native API and JDBC, and check the engine's type error for sub-microsecond digits outside their range. All six failed before the change.-D warningsand the unit tests pass on both engines.