This is an automated email from the ASF dual-hosted git repository.

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new f41fa0d4a fix(csharp/src/Drivers/Databricks): Add another fallback 
check of GetColumnsExtendedAsync (#3219)
f41fa0d4a is described below

commit f41fa0d4a6fccbeefb126807471e51b047fa3f5d
Author: Jacky Hu <[email protected]>
AuthorDate: Wed Jul 30 06:53:09 2025 -0700

    fix(csharp/src/Drivers/Databricks): Add another fallback check of 
GetColumnsExtendedAsync (#3219)
    
    ## Motivation
    
    Sometimes Databricks DBR or SQL warehouse fails to execute `DESC TABLE
    EXTENDED` due to some internal error on data type parsing and returns
    SQL State `20000 `. In this case, we also want to fallback to the
    `HiveStatement2.GetColumnsExtendedAsync`
    
    ## Change
    Add the fallback condition check on `SqlState==20000` in `Databricks
    GetColumnsExtendedAsync`
    
    ## Testing
    - E2E test
---
 csharp/src/Drivers/Databricks/DatabricksStatement.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/csharp/src/Drivers/Databricks/DatabricksStatement.cs 
b/csharp/src/Drivers/Databricks/DatabricksStatement.cs
index 6598a2d14..705005249 100644
--- a/csharp/src/Drivers/Databricks/DatabricksStatement.cs
+++ b/csharp/src/Drivers/Databricks/DatabricksStatement.cs
@@ -578,9 +578,10 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks
             {
                 descResult = await descStmt.ExecuteQueryAsync();
             }
-            catch (HiveServer2Exception ex) when (ex.SqlState == "42601")
+            catch (HiveServer2Exception ex) when (ex.SqlState == "42601" || 
ex.SqlState == "20000")
             {
                 // 42601 is error code of syntax error, which this command 
(DESC TABLE EXTENDED ... AS JSON) is not supported by current DBR
+                // Sometimes server may also return 20000 (internal error) if 
it fails to convert some data types of the table columns
                 // So we should fallback to base implementation
                 Debug.WriteLine($"[WARN] Failed to run {query} 
(reason={ex.Message}). Fallback to base::GetColumnsExtendedAsync.");
                 return await base.GetColumnsExtendedAsync(cancellationToken);

Reply via email to