feat(csharp/src/Drivers/Apache): enhance GetColumns with BASE_TYPE_NAME column#2695
Merged
CurtHagenlocher merged 7 commits intoApr 21, 2025
Conversation
birschick-bq
approved these changes
Apr 15, 2025
| int rowCount = HiveServer2Reader.GetRowCount(rowSet, columnCount); | ||
|
|
||
| // Get metadata again to ensure we have the latest | ||
| TGetResultSetMetadataResp metadata = await HiveServer2Connection.GetResultSetMetadataAsync(OperationHandle!, Connection.Client, cancellationToken); |
Contributor
There was a problem hiding this comment.
This looks like a duplicate call with the call to GetResultSetSchemaAsync. Is there any way to avoid the extra call?
Contributor
Author
There was a problem hiding this comment.
Thanks for catching this, changed
CurtHagenlocher
requested changes
Apr 16, 2025
Contributor
CurtHagenlocher
left a comment
There was a problem hiding this comment.
As per Bruce's comment, the else clause of GetColumnsAsync should be modified to call GetResultSetSchemaAsync only once and then compute the Arrow schema based on the result of that call by using SchemaParser.GetArrowSchema.
CurtHagenlocher
requested changes
Apr 21, 2025
Contributor
CurtHagenlocher
left a comment
There was a problem hiding this comment.
Thanks! Please clean up a little extra whitespace that the linter doesn't like and then this can be checked in.
CurtHagenlocher
approved these changes
Apr 21, 2025
colin-rogers-dbt
pushed a commit
to dbt-labs/arrow-adbc
that referenced
this pull request
Jun 10, 2025
…ME column (apache#2695) ## Summary This PR enhances the C# ADBC driver's `GetColumns` functionality by adding a new `BASE_TYPE_NAME` column to the result set. This column provides the base type name without parameters or decorations, making it easier for clients to identify the fundamental data type regardless of its parameterization. ## Proposed Changes - Added a new `BASE_TYPE_NAME` column to the `GetColumns` result schema - Enhanced the `HiveServer2Statement` class to process and populate the `BASE_TYPE_NAME` column - Changed visibility modifiers for several methods from `protected` to `public` or `internal` to enable the enhancement - Added support for the `VARIANT` SQL type in the `SqlTypeNameParser` - Created comprehensive unit tests to verify the functionality with various data types ## Implementation Details The implementation: 1. Intercepts `GetColumns` query results 2. Processes each row to extract the base type name using the existing `SetPrecisionScaleAndTypeName` method 3. Adds the base type name as a new column in the result set 4. Preserves and potentially enhances precision and scale information for parameterized types ## Benefits - Simplifies client code that needs to identify base types (e.g., all DECIMAL types regardless of precision/scale) - Maintains compatibility with existing code as this is an additive change - Improves developer experience by providing clearer type information ## Testing Added comprehensive unit tests that verify: - The presence of the BASE_TYPE_NAME column in GetColumns results - Correct base type extraction for simple types - Correct base type extraction for complex types (DECIMAL, INTERVAL, MAP, ARRAY, STRUCT) - Precision and scale preservation for DECIMAL types - Proper handling of type aliases (INT vs INTEGER)
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.
Summary
This PR enhances the C# ADBC driver's
GetColumnsfunctionality by adding a newBASE_TYPE_NAMEcolumn to the result set. This column provides the base type name without parameters or decorations, making it easier for clients to identify the fundamental data type regardless of its parameterization.Proposed Changes
BASE_TYPE_NAMEcolumn to theGetColumnsresult schemaHiveServer2Statementclass to process and populate theBASE_TYPE_NAMEcolumnprotectedtopublicorinternalto enable the enhancementVARIANTSQL type in theSqlTypeNameParserImplementation Details
The implementation:
GetColumnsquery resultsSetPrecisionScaleAndTypeNamemethodBenefits
Testing
Added comprehensive unit tests that verify: