Skip to content

Conversation

@eric-wang-1990
Copy link
Contributor

@eric-wang-1990 eric-wang-1990 commented Jun 6, 2025

Improve metadata query handling in C# drivers

Summary

This PR makes several improvements to metadata query handling in the C# drivers:

  1. Removes underscore escaping for exact match queries (GetPrimaryKeys, GetCrossReference) in the Hive driver
  2. Fixes cross-reference handling in the Databricks driver to check both primary and foreign catalogs
  3. Updates tests to handle different integer types (Int16/Int32) in FK_INDEX column
  4. Adds implementation for foreign key table creation in Databricks tests
  5. Adds special character handling in table names for Databricks tests to ensure proper escaping

Motivation

The current implementation incorrectly escapes underscores in exact match queries, which can lead to incorrect results when querying metadata for tables with underscores in their names. Additionally, the Databricks driver was not properly handling cross-references when one catalog was valid but the other was invalid.

The added special character handling in tests ensures that our drivers correctly handle table names with special characters, which is important for real-world scenarios.

Testing

  • Updated existing tests to handle the different integer types that may be returned
  • Added implementation for foreign key table creation in Databricks tests
  • Enhanced test coverage by including special characters in table names
  • Passing existing PrimaryKey/ForeignKey tests.

- Remove underscore escaping for exact match queries in Hive driver
- Fix cross-reference handling in Databricks driver to check both catalogs
- Update tests to handle different integer types in FK_INDEX column
- Add implementation for foreign key table creation in Databricks tests
@github-actions github-actions bot added this to the ADBC Libraries 19 milestone Jun 6, 2025
@eric-wang-1990 eric-wang-1990 changed the title fix(csharp/driver): improve metadata query handling fix(csharp/drivers/apache): improve metadata query handling Jun 6, 2025
- Override CreateNewTableName in Databricks tests to include special characters
- Fix comment formatting in Apache Common tests
@eric-wang-1990 eric-wang-1990 changed the title fix(csharp/drivers/apache): improve metadata query handling fix(csharp/src/drivers/apache): improve metadata query handling Jun 6, 2025
@CurtHagenlocher CurtHagenlocher changed the title fix(csharp/src/drivers/apache): improve metadata query handling fix(csharp/src/Drivers/Apache): improve metadata query handling Jun 6, 2025
Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@CurtHagenlocher CurtHagenlocher merged commit 7a6fb76 into apache:main Jun 6, 2025
6 of 10 checks passed
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.

2 participants