eric-wang-1990 opened a new pull request, #2894: URL: https://github.com/apache/arrow-adbc/pull/2894
## PR Description ### Description This PR fixes an issue with foreign key handling in the `GetColumnsExtended` method by refactoring the cross-reference lookup process. It extracts the foreign key lookup logic into a dedicated method and improves the handling of empty result sets. ### Changes - Created a new `GetCrossReferenceAsForeignTableAsync` method to encapsulate the logic for retrieving cross-reference data where the current table is treated as a foreign table - Added constants for primary and foreign key field names and prefixes to improve maintainability - Implemented proper handling for empty result sets in `GetColumnsExtendedAsync` by creating a helper method `CreateEmptyExtendedColumnsResult` - Extended the Databricks driver to override the new `GetCrossReferenceAsForeignTableAsync` method to maintain consistency with the empty result handling logic - Added TODOs for future logging improvements ### Motivation The existing implementation had several issues: 1. The foreign key lookup logic was embedded directly in the `GetColumnsExtendedAsync` method, making it difficult to maintain and extend, it also does not go through the child class DatabricksStatement overriden function. 2. Empty result sets were not handled properly, potentially causing errors when no columns were returned 3. The code lacked consistency in how it handled relationship data ### Testing The changes have been tested with both empty and populated tables to ensure proper handling of all scenarios. The refactored code maintains the same functionality while improving code organization and error handling. ### Related Issues This PR is related to the ongoing improvements in primary and foreign key metadata handling in the ADBC drivers. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org