You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by cu...@apache.org on 2025/08/27 23:24:45 UTC

(arrow-adbc) branch main updated: fix(csharp/src/Drivers/Databricks): PECO-2562 Use "default" schema in open session request (#3359)

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 b31a824f6 fix(csharp/src/Drivers/Databricks): PECO-2562 Use "default" schema in open session request (#3359)
b31a824f6 is described below

commit b31a824f6447f13a6467000e3033437dde2de442
Author: Todd Meng <to...@databricks.com>
AuthorDate: Wed Aug 27 16:24:40 2025 -0700

    fix(csharp/src/Drivers/Databricks): PECO-2562 Use "default" schema in open session request (#3359)
    
    If user does not pass in schema, use "default for session schema".
    
    This is most likely a no-op, since dbr already sets this default session
    schema even without explicit client request.
    This does not affect subsequent metadata calls, since session schema is
    not used for metadata request's schema.
---
 csharp/src/Drivers/Databricks/DatabricksConnection.cs | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/csharp/src/Drivers/Databricks/DatabricksConnection.cs b/csharp/src/Drivers/Databricks/DatabricksConnection.cs
index 9e5d05a98..07f31ceed 100644
--- a/csharp/src/Drivers/Databricks/DatabricksConnection.cs
+++ b/csharp/src/Drivers/Databricks/DatabricksConnection.cs
@@ -47,6 +47,8 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks
         /// </summary>
         public const string DefaultConfigEnvironmentVariable = "DATABRICKS_CONFIG_FILE";
 
+        public const string DefaultInitialSchema = "default";
+
         internal static readonly Dictionary<string, string> timestampConfig = new Dictionary<string, string>
         {
             { "spark.thriftserver.arrowBasedRowSet.timestampAsString", "false" },
@@ -329,16 +331,13 @@ namespace Apache.Arrow.Adbc.Drivers.Databricks
             // In newer DBR versions with Unity Catalog, the default catalog is typically hive_metastore.
             // Passing null here allows the runtime to fall back to the workspace-defined default catalog for the session.
             defaultCatalog = HandleSparkCatalog(defaultCatalog);
+            var ns = new TNamespace();
 
-            if (!string.IsNullOrWhiteSpace(defaultCatalog) || !string.IsNullOrWhiteSpace(defaultSchema))
-            {
-                var ns = new TNamespace();
-                if (!string.IsNullOrWhiteSpace(defaultCatalog))
-                    ns.CatalogName = defaultCatalog!;
-                if (!string.IsNullOrWhiteSpace(defaultSchema))
-                    ns.SchemaName = defaultSchema;
-                _defaultNamespace = ns;
-            }
+            ns.SchemaName = string.IsNullOrWhiteSpace(defaultSchema) ? DefaultInitialSchema : defaultSchema;
+
+            if (!string.IsNullOrWhiteSpace(defaultCatalog))
+                ns.CatalogName = defaultCatalog!;
+            _defaultNamespace = ns;
 
             // Parse trace propagation options
             if (Properties.TryGetValue(DatabricksParameters.TracePropagationEnabled, out string? tracePropagationEnabledStr))