Repository navigation
fix(jdbc): derive column type name from decltype (#76) - #141
Merged
Merged
Conversation
Expression columns have no declared type, so getColumnTypeName returns the documented unknown value NUMERIC at every cursor position instead of sampling the first non-null row value. Remove sampleType and its row scan. Keep isSigned xerial-compatible for expression columns by reading the current row's storage class.
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 #76
Contract: Hrana 3
StmtResult.cols[].decltypeis the source of truth for the declared column type;java.sql.ResultSetMetaDatais the JDBC surface; xerial/sqlite-jdbc 3.53.4.0 is the behavioral reference.Change
getColumnTypeNamederives the name fromdecltypeonly. A nulldecltypemarks an expression column and returns the documented unknown valueNUMERICbefore the first row, on a row, and after the last row.sampleTypeand its row scan, so the type name no longer depends on unvisited rows.isSignedfor an expression column now follows the current value's storage class (no scan). Without this,RSMetaDataTest.columTypeWithoutTableregressed because itsCAST(... AS VARCHAR(50))expression reportsNUMERICas its type name. This keeps the xerial per-row answer.Evidence
Base
dbb9749318356c537e95dae078bdee80c17a1714, head7864433c187e3b95f2aba17bf303765e15c1f8fb.expected: "NUMERIC" but was: "INTEGER"from the row-sampling path./tmp/xerial-parity-i76/lane-1-trunk.logLibsqlResultSetMetaDataTest34/34./tmp/xerial-parity-i76/lane-1-head.logRSMetaDataTestpasses 13/13.spotless:check: no violations../mvnw test: BUILD SUCCESS.RSMetaDataTest: 13/13./tmp/xerial-parity-i76/perf.logAll logs are under
/tmp/xerial-parity-i76/.Divergences
NUMERIC; xerial reports the current storage class. Hrana metadata carries no runtime type, and getColumnTypeName samples the first non-null value across all rows #76 requires the type name to be independent of rows.isSignedstill matches xerial's per-row result by reading only the current storage class.cast(... as ...)fallback indeclType()is retained, matching xerial'sgetColumnDeclType. UppercaseCAST(1 AS BOOLEAN)is not matched, so that expression column now returnsNUMERICinstead of its storage-class name.