Skip to content

feat(csharp): add shared schema factories and GetInfo builder#2

Open
msrathore-db wants to merge 5 commits intofeat/extract-metadata-utilities-part1from
feat/extract-metadata-utilities-part2
Open

feat(csharp): add shared schema factories and GetInfo builder#2
msrathore-db wants to merge 5 commits intofeat/extract-metadata-utilities-part1from
feat/extract-metadata-utilities-part2

Conversation

@msrathore-db
Copy link
Owner

Summary

  • Add MetadataSchemaFactory with schema factories for Catalogs, Schemas, Tables, Columns, PrimaryKeys, CrossReference
  • Add empty result helpers (CreateEmpty*Result) for each schema type
  • Add BuildPrimaryKeysResult and BuildCrossReferenceResult builders
  • Add BuildGetInfoResult — shared DenseUnionArray builder for GetInfo
  • Refactor HiveServer2Connection.GetInfo to use BuildGetInfoResult (lazy evaluation, ~120 lines removed)

Test plan

  • dotnet build succeeds with 0 warnings
  • Existing unit tests pass
  • GetInfo returns same values as before

🤖 Generated with Claude Code

Stack: 2/2 — depends on #1

@msrathore-db msrathore-db force-pushed the feat/extract-metadata-utilities-part2 branch 3 times, most recently from 8c7dd92 to bb4dc21 Compare March 2, 2026 09:35
eric-wang-1990 and others added 3 commits March 3, 2026 12:37
…ng[PECO-2934] (adbc-drivers#23)

## Summary

- `STRING COLLATE UNICODE_CI_AI` and other collated string types are
valid Databricks column type names returned by `GetColumns`, but were
rejected by `SqlTypeNameParser` with `NotSupportedException: Unsupported
SQL type name`
- Updated `SqlVarcharTypeParser` and `SqlCharTypeParser` regexes to
accept an optional `COLLATE <name>` suffix
- The collation name is parsed but ignored — `BaseTypeName` remains
`STRING`/`VARCHAR`/`CHAR`, and the Arrow type remains `StringType`
- Collation is a server-side concern; clients like Power BI receive the
standard base type as expected

## Test plan

- [ ] Added `CanParseVarcharWithCollation` tests: `STRING COLLATE
UNICODE_CI_AI`, `VARCHAR(255) COLLATE UNICODE_CI_AI`, `STRING COLLATE
UTF8_BINARY`, case-insensitive variant
- [ ] Added `CanParseCharWithCollation` tests: `CHAR(10) COLLATE
UNICODE_CI_AI`, `NCHAR(5) COLLATE UTF8_BINARY`
- [ ] All 272 existing unit tests continue to pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Add MetadataSchemaFactory to MetadataSchemaDefinitions.cs with:
- Schema factories: CreateCatalogsSchema, CreateSchemasSchema,
  CreateTablesSchema, CreateColumnMetadataSchema, CreatePrimaryKeysSchema,
  CreateCrossReferenceSchema
- Empty result helpers: CreateEmpty*Result for each schema type
- Result builders: BuildPrimaryKeysResult, BuildCrossReferenceResult
- BuildGetInfoResult: shared DenseUnionArray builder for GetInfo

Refactor HiveServer2Connection.GetInfo to use BuildGetInfoResult,
replacing ~150 lines of inline DenseUnionArray construction.
Values are now lazily resolved per requested info code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VendorSql → bool, all others → string. The union type is determined
by the code, not by runtime type inspection of the value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@msrathore-db msrathore-db force-pushed the feat/extract-metadata-utilities-part2 branch from 8af9c9c to 9ee6339 Compare March 4, 2026 21:17
msrathore-db and others added 2 commits March 4, 2026 16:20
…r, TableInfo, and shared metadata types (adbc-drivers#21)

## 🥞 Stacked PR

-
[**feat/extract-metadata-utilities-part1**](adbc-drivers#21)
[[Files
changed](https://github.com/adbc-drivers/hiveserver2/pull/21/files)]
-
[feat/extract-metadata-utilities-part2](adbc-drivers#22)
[[Files
changed](https://github.com/adbc-drivers/hiveserver2/pull/22/files/9926495..bb4dc21)]

## Summary

Extract reusable metadata utilities from HiveServer2Connection for
sharing between Thrift and SEA protocols.

### Extracted classes
- **GetObjectsResultBuilder**: async BuildGetObjectsResultAsync
orchestrating depth-based cascade with shared CancellationToken
- **IGetObjectsDataProvider**: async interface (GetCatalogsAsync,
GetSchemasAsync, GetTablesAsync, PopulateColumnInfoAsync) — all accept
CancellationToken from GetObjects caller
- **TableInfo**: shared struct for column metadata
- **HiveInfoArrowStream**: lightweight IArrowArrayStream for metadata
results
- **MetadataColumnNames**: shared column name constants

### Changes to existing code
- HiveServer2Connection implements IGetObjectsDataProvider with
async/await (no .Result blocking)
- GetObjects creates one CancellationToken and passes through the entire
chain
- GetArrowType changed from private to internal static for
cross-protocol reuse
- EnhanceGetColumnsResult inlined back into HiveServer2Statement (was
ColumnsResultEnhancer — Thrift-only, no need for separate class)
- Backward-compatible constant aliases in HiveServer2Connection for
subclass access
- No changes to ImpalaConnection, SparkConnection,
HiveServer2ExtendedConnection behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants