Repository navigation
Conversation
terrymanu
left a comment
There was a problem hiding this comment.
Summary
This PR fixes memory query results returning Java-serialized bytes by returning raw bytes, LOB streams, or encoded text, and correctly handling SQL NULL. The approach addresses the serialization problem, but Ascii text streams still use the wrong encoding.
Result
Review Result: Not Mergeable
Feedback Mode: Change Request
Blocking Issues: 1
Blocking Issues
-
[P2] Preserve ASCII encoding for Ascii text streams
- Evidence: AbstractMemoryQueryResult.java:108 ignores
typeand always uses UTF-8. The project-selected pgjdbc 42.7.13 explicitly uses US-ASCII forgetAsciiStream. - Impact: For a PostgreSQL VARCHAR value of
é, the memory path producesC3 A9, while the native driver path produces3F. The stream content therefore changes with the connection mode. The added non-ASCII test covers onlyUnicodeand cannot detect this issue. - Required Change: Apply the correct ASCII conversion for
Asciirequests and add a regression test with non-ASCII input. The missing original column charset does not prevent converting an already-materialized String to ASCII.
- Evidence: AbstractMemoryQueryResult.java:108 ignores
Coverage
Public PR head: d8f5f61a7b3b28beea14492477646c920c1914ec. All 4 changed files were reviewed, with two independent assessments and coordinator evidence verification.
Local Spotless and Checkstyle passed, covering all 3 changed Java files. Unit-test attempts timed out during Maven prerequisites, so no test results were obtained.
This conclusion covers code correctness only; CI was not reviewed.
getInputStream ignored the stream type and always encoded text values as UTF-8, so getAsciiStream on a memory query result returned C3 A9 for "é" while pgjdbc returns 3F. Encode text values with US-ASCII for Ascii requests and keep UTF-8 for the other stream types.
|
@terrymanu Thanks for the review. Done in |
terrymanu
left a comment
There was a problem hiding this comment.
Summary
This PR fixes memory query results returning Java-serialized data by returning column bytes, LOB streams, or encoded text directly. ASCII encoding for ordinary text is now corrected, but Unicode encoding and SQLXML ASCII conversion remain incorrect.
Result
Review Result: Not Mergeable
Feedback Mode: Change Request
Blocking Issues: 2
Blocking Issues
-
[P2] Use the required encoding for Unicode streams
- Evidence: AbstractMemoryQueryResult.java:108 uses UTF-8 for
Unicode, while the JDBC contract requires two-byte Unicode characters, high byte first. A probe using the exact candidate source returnedC3 A9foré, instead of00 E9. The added test also asserts the incorrect encoding. - Impact: Under
CONNECTION_STRICTLY,getUnicodeStream()returns data that cannot be decoded correctly according to its public contract. - Required Change: Handle Unicode conversion separately, use the required byte layout, and correct the test expectations. Pgjdbc’s UTF-8 implementation and the method’s deprecated status do not supersede that contract.
- Evidence: AbstractMemoryQueryResult.java:108 uses UTF-8 for
-
[P2] Honor ASCII requests in the SQLXML branch
- Evidence: AbstractMemoryQueryResult.java:104–105 unconditionally calls
SQLXML#getBinaryStream()and returns before reaching the ASCII conversion. A probe using actual pgjdbc 42.7.13 classes showed that, for<foo>é</foo>, the native ASCII getter convertséto3F, while the memory path returns UTF-8 bytesC3 A9. - Impact: With a default PostgreSQL UTF-8 connection, SQLXML ASCII streams still contain non-ASCII bytes, and their contents change with the connection mode.
- Required Change: Honor ASCII requests in the SQLXML branch and add a regression test containing non-ASCII XML. The existing SQLXML test covers only Binary.
- Evidence: AbstractMemoryQueryResult.java:104–105 unconditionally calls
Both issues already existed at the previously reviewed head, d8f5f61. They were missed in the previous review and were not introduced by the latest commit.
Coverage
Reviewed all 4 changed files at public PR head 4805c95ec97a71795e77326b57d76817e76a12df, with two independent assessments and coordinator verification.
Local Spotless and Checkstyle passed for all 3 changed Java files. Source and driver probes reproduced the issues above. Both focused Maven test attempts timed out before test execution, so no unit-test results were obtained.
This conclusion covers code correctness only; CI was not reviewed. Repository files and pre-existing workspace changes were preserved.
getUnicodeStream requires two-byte Unicode characters with the high byte first, so Unicode streams now encode the column text (including Clob and SQLXML values) as UTF-16BE instead of UTF-8. SQLXML Ascii streams now convert the XML string to US-ASCII instead of returning the binary stream.
|
@terrymanu Thanks. Fixed in 03d189f: |
terrymanu
left a comment
There was a problem hiding this comment.
Summary
This PR fixes memory query results returning Java-serialized data by returning column bytes, LOB streams, or encoded text, and correctly handling SQL NULL. The previous text Unicode and SQLXML ASCII issues are fixed, but binary values still bypass the requested stream-type conversion.
Result
Review Result: Not Mergeable
Feedback Mode: Change Request
Blocking Issues: 1
Oracle RAW ASCII/Unicode streams still return incorrect content.
Blocking Issues
-
[P2] Preserve Oracle RAW ASCII/Unicode conversions
- Evidence: AbstractMemoryQueryResult.java:95 returns
byte[]immediately, ignoringtype. Oracle RAW values reach this branch throughResultSetMapper#getBytes. The Oracle documentation specifies hexadecimal representations for character streams. Probes using the Oracle 23.6 driver converter and the exact candidate source confirmed that, for inputCA FE, the native ASCII/Unicode conversions return the stringCAFEencoded as ASCII/UTF-16BE, respectively, while the current candidate returns the raw bytesCA FEfor both. - Impact: Under
CONNECTION_STRICTLY, supported RAW character-stream reads still violate their conversion contracts. - Required Change: Apply the appropriate ASCII/Unicode conversion for the database and column type, preserve raw bytes for Binary requests, and add Oracle RAW regression coverage.
This branch already existed at the previously reviewed head,
4805c95. It was missed in the previous review and was not introduced by the latest commit. - Evidence: AbstractMemoryQueryResult.java:95 returns
Coverage
Reviewed all 4 changed files and the relevant call paths at the latest head, 03d189fdab679a3d5394e75041aa614ae07ec312, with independent assessments and coordinator verification.
Local Checkstyle and Spotless passed for all 3 changed Java files. The focused Maven test attempt timed out during dependency prerequisites before executing tests. Driver verification used source inspection and converter probes; no Oracle database was started.
This conclusion covers code correctness only; CI was not reviewed. Repository files and Git state were preserved.
Oracle returns the hexadecimal text of RAW and LONG RAW values for getAsciiStream and getUnicodeStream, and the raw bytes only for getBinaryStream. The memory query result returned the raw bytes for every stream type. Add DialectResultSetMapper#isHexadecimalBinaryCharacterStream, true for Oracle, and use it in JDBCMemoryQueryResult so byte[] values are encoded as uppercase hexadecimal in US-ASCII or UTF-16BE for those streams.
|
@terrymanu Thanks. |
terrymanu
left a comment
There was a problem hiding this comment.
Summary
This PR fixes memory query results returning Java-serialized data under CONNECTION_STRICTLY by returning column bytes, LOB streams, or encoded text, and adds Oracle RAW conversion. The direction is sound, but two text-encoding defects and two testing-standard violations remain.
Result
Review Result: Not Mergeable
Feedback Mode: Change Request
Blocking Issues: 4
Blocking Issues
-
[P2] Preserve Oracle text ASCII conversion semantics
- Evidence: AbstractMemoryQueryResult.java:119 universally uses US-ASCII, while the Oracle documentation specifies ISO-Latin-1 for its ASCII streams. An actual ojdbc8 23.6 converter returns
E9foré; the current memory path returns3F. - Impact: Oracle VARCHAR characters become question marks, making results depend on the connection mode. The new RAW branch does not handle String values.
- Required Change: Preserve dialect-specific text ASCII conversion and add non-ASCII regression coverage.
- Evidence: AbstractMemoryQueryResult.java:119 universally uses US-ASCII, while the Oracle documentation specifies ISO-Latin-1 for its ASCII streams. An actual ojdbc8 23.6 converter returns
-
[P2] Preserve Binary bytes for non-UTF-8 text
- Evidence: The same return branch forces UTF-8 for Binary streams. Connector/J 8.4.0 reads through its raw-byte factory. An actual driver probe returned
E9for a latin1 VARCHAR containingé, while the memory path re-encoded it asC3 A9. - Impact:
getBinaryStream()returns different column contents depending on the connection mode. The charset TODO does not establish a contract allowing this difference. - Required Change: Preserve the original bytes or actual result charset, and add a non-UTF-8 text regression case.
- Evidence: The same return branch forces UTF-8 for Binary streams. Connector/J 8.4.0 reads through its raw-byte factory. An actual driver probe returned
-
[P2] Remove the constant-only test
- Evidence: OracleResultSetMapperTest.java:81 only asserts that a method unconditionally returns
true, contrary to the testing standards. - Impact: The new test violates an explicit repository rule.
- Required Change: Remove this standalone test and its unused import, while retaining the stream-conversion tests.
- Evidence: OracleResultSetMapperTest.java:81 only asserts that a method unconditionally returns
-
[P2] Use the applicable static mocking extension
- Evidence: JDBCMemoryQueryResultTest.java:426 directly calls
mockStaticwithout satisfying the documented exception conditions. Isolated verification confirmed that all 54 tests still pass using the existing extension with explicit default stubbing. - Impact: The new tests bypass the applicable project testing mechanism.
- Required Change: Use
AutoMockExtension, preserving the existing default mappings and stubbing semantics.
- Evidence: JDBCMemoryQueryResultTest.java:426 directly calls
Issues 1 and 2 already existed at the previous head, 03d189fd, and were missed in previous reviews. Issues 3 and 4 were introduced by the latest commit.
Coverage
Reviewed all 8 changed files at public head 97422d41b964670122c5094b98e1e13dc3a99358, with two independent assessments and coordinator verification.
Local Checkstyle and Spotless passed for all 7 Java files (exit 0). The current memory-result test class passed 54/54 tests in isolation; driver probes reproduced the encoding differences.
The Maven reactor test attempt timed out during project scanning (exit 124), so full testing remains incomplete. Probes did not connect to a database. This conclusion covers code correctness only; CI was not reviewed.
Add DialectResultSetMapper#getAsciiStreamCharset, defaulting to US-ASCII, and return ISO-8859-1 for Oracle so that ASCII streams of character values in memory query results match the Oracle driver. Remove the constant-only Oracle mapper test, and switch JDBCMemoryQueryResultTest to AutoMockExtension with explicit default stubbing of DatabaseTypedSPILoader.
|
@terrymanu Thanks. Issues 1, 3 and 4 are addressed in b308ea6: a new For issue 2, the memory loader keeps character columns as the |
Fixes #40523.
Changes proposed in this pull request:
AbstractMemoryQueryResult#getInputStreamserialized every value withObjectOutputStream, sogetBinaryStream,getAsciiStreamandgetUnicodeStreamreturned Java-serialized bytes underCONNECTION_STRICTLY.nullfor SQL NULL, and the raw bytes forbyte[]andBlob#getBinaryStream(), matching thegetCharacterStreamhandling from Fix getCharacterStream of memory query results reading column index #40431.byte[](RAW and LONG RAW) values as uppercase hexadecimal text forAscii(US-ASCII) andUnicode(UTF-16BE) streams, as the Oracle driver does, and keep the raw bytes forBinary. The dialect opts in through a newDialectResultSetMapper#isHexadecimalBinaryCharacterStreamdefault method (falseelsewhere).Unicodestreams as two-byte characters, high byte first (UTF-16BE), asResultSet#getUnicodeStreamrequires, for text,ClobandSQLXMLvalues.Clob#getAsciiStream(),SQLXML#getBinaryStream()(or its string in the ASCII stream charset forAscii), and encode other values fromtoString()in the ASCII stream charset forAsciistreams, and as UTF-8 forBinaryunder the existing character encoding TODO. The ASCII stream charset comes from a newDialectResultSetMapper#getAsciiStreamCharsetdefault method: US-ASCII by default, as pgjdbc'sgetAsciiStreamdoes, and ISO-8859-1 for Oracle, as the Oracle driver does.throws SQLExceptionon the override (already declared byQueryResult), since theBlob/Clob/SQLXMLstream getters throw it.QueryResult#getInputStreamJavadoc:typeis the stream type, and SQL NULL returnsnull.UnicodeandAscii), VARBINARY (Ascii, and hexadecimalAscii,UnicodeandBinary), BLOB, CLOB (AsciiandUnicode), SQLXML (Binary, and non-ASCIIAsciiandUnicode) and NULL cases toJDBCMemoryQueryResultTest; the hexadecimal VARBINARY cases fail without the Oracle change, the rest without the fix. Add a non-ASCII VARCHARAsciicase with an ISO-8859-1 dialect charset, which fails without the dialect charset. The old test compared only the first serialized byte.AI assistance: Claude Code was used to draft the change and its unit tests in
infra/executoranddatabase/connector(core and Oracle dialect). I reviewed, verified, and take responsibility for every line submitted.Before committing this PR, I'm sure that I have checked the following options:
type: bug.)./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e. (Full build not run. Ranspotless:apply,checkstyle:checkandapache-rat:checkwith-Pcheck -pl infra/executor(anddatabase/connector/core,database/connector/dialect/oracle), then./mvnw install -pl infra/executor -am -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -eand./mvnw test -pl infra/merge -am, all passing on JDK 21 withrelease8.)