Repository navigation
fix(jdbc): wrap REAL to int like SQLite - #131
Merged
Merged
Conversation
getInt cast a REAL straight to int, which clamps. SQLite converts through int64 and keeps the low 32 bits. Route REAL through long and round INTEGER through double before narrowing to float, matching SQLite's numeric conversion. Fixes #101
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.
Fixes #101
Contract: Hrana 3 is the source of truth for transport and values (
Value.Floatis a 64-bit double,Value.Integera 64-bit signed integer).java.sqlis the source of truth for theResultSetsurface. xerial/sqlite-jdbc is a behavioral reference only.Change
getInton a REAL now uses(int) (long) f.value(), so conversion goes through int64 and keeps the low 32 bits like SQLite instead of clamping to the int range.getFloaton an INTEGER now uses(float) (double) i.value(), matching SQLite's double-then-float rounding.getObject(col, Integer.class)already routed throughgetInt, so it inherits the wrap.getByteandgetShortstill go throughgetLongand are unchanged.Evidence
Red at trunk, source reverted, new cases only (
/tmp/xerial-parity-i101/lane-1-regression.log): 3 failures,3e9returned2147483647instead of-1294967296,4294967296.0returned true, and the large INTEGER returned1.1529216E18finstead of1.1529215E18f.Green at head (
/tmp/xerial-parity-i101/green.log):Tests run: 21, Failures: 0, Errors: 0forLibsqlResultSetTest.Lanes, all at head
bf58589444d954071e0ac168f0815ea3503c373b:lane-1-regression.log).lane-2-specific.log).lane-3-specific.log).lane-4-module-suite.log).lane-5-conformance.log).lane-6-control.log).spotless:check: BUILD SUCCESS (lane-7-spotless.log).lane-8-reactor.log).lane-9-specific.log).lane-10-package.log).Perf:
time ./mvnw -pl libsql-jdbc test, three interleaved runs per side (perf.log). Trunk median 2.301 s, head median 2.277 s, within the 10 percent rule.Divergences
+in the plan's-Dtestexamples is not a Surefire separator, so the combined lanes use commas; the single-class lanes run exactly as written.SHAs
1faf4fca800e8ac4a7d418ad26a1054f5f4182b1bf58589444d954071e0ac168f0815ea3503c373b