fix(csharp): canonicalize identifier case in SEA get_primary_keys (PECO-3045) [SEA]#471
Open
eric-wang-1990 wants to merge 1 commit into
Open
fix(csharp): canonicalize identifier case in SEA get_primary_keys (PECO-3045) [SEA]#471eric-wang-1990 wants to merge 1 commit into
eric-wang-1990 wants to merge 1 commit into
Conversation
…CO-3045) [SEA] The SEA path of GetPrimaryKeysAsync used the user-provided input names (_metadataCatalogName / _metadataSchemaName / _metadataTableName) verbatim when building result rows. When callers pass non-canonical case (e.g. catalog="MAIN" for a server-lowercase catalog "main") the result columns echo back the input case instead of the canonical lowercase form. The Thrift path returns canonical names from the server and JDBC reads the catalogName/namespace/tableName columns from SHOW KEYS, so SEA was the outlier. Fix: prefer the catalogName / namespace / tableName columns returned by SHOW KEYS for each row, falling back to a lowercased copy of the user input only if those columns are missing or null. Mirrors how SHOW FOREIGN KEYS already populates parent identifiers in the same file. PECO-3045
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.
What's Changed
The SEA path of
GetPrimaryKeysAsyncused the user-provided input names(
_metadataCatalogName/_metadataSchemaName/_metadataTableName)verbatim when building result rows. When callers pass non-canonical case
(e.g.
catalog=\"MAIN\"for a server-lowercase catalogmain) theTABLE_CAT/TABLE_SCHEM/TABLE_NAMEresult columns echo back theinput case instead of the canonical lowercase form. The Thrift path
returns canonical names from the server, and JDBC's SDK path reads
catalogName/namespace/tableNamefrom the SHOW KEYS response —so SEA was the outlier.
This change makes SEA read those three columns from each SHOW KEYS
record batch and use them when populating result rows, with a defensive
fallback to a lowercased copy of the user input if the columns are
missing or null. It mirrors how
FetchCrossReferenceAsyncalreadyreads
parentCatalogName/parentNamespace/parentTableNamefromSHOW FOREIGN KEYS in the same file.
Why
PECO-3045 — D17: SEA echoes input case in
get_primary_keysresultcolumns; Thrift returns canonical names. JDBC spec says results should
be canonical.
Red → Green proof
Before fix (
SEA_GetPrimaryKeys_ReturnsCanonicalCase_InResultColumns):After fix:
Full
SeaMetadataE2ETestsclass — 19/19 pass post-fix.Files touched
csharp/src/StatementExecution/StatementExecutionStatement.cs— read canonical names from SHOW KEYS columns; lowercase fallback.csharp/test/E2E/StatementExecution/SeaMetadataE2ETests.cs— addedSEA_GetPrimaryKeys_ReturnsCanonicalCase_InResultColumns.Manual verification
pecotestingwarehouseSeaMetadataE2ETestsclass passes (19/19)dotnet buildclean onnetstandard2.0,net472,net8.0