toddmeng-db commented on code in PR #2896:
URL: https://github.com/apache/arrow-adbc/pull/2896#discussion_r2124391655


##########
csharp/src/Drivers/Databricks/DatabricksConnection.cs:
##########
@@ -374,6 +370,27 @@ protected override TOpenSessionReq CreateSessionRequest()
             return req;
         }
 
+
+        protected override async Task 
HandleOpenSessionResponse(TOpenSessionResp? session)
+        {
+            await base.HandleOpenSessionResponse(session);
+            if (session != null)
+            {
+                if (session.__isset.initialNamespace) {
+                    _defaultNamespace = session.InitialNamespace;
+                } else if (_defaultNamespace != null && 
!string.IsNullOrEmpty(_defaultNamespace.SchemaName)) {
+                    // server version is too old. Explicitly set the schema 
using queries
+                    await SetSchema(_defaultNamespace.SchemaName);
+                }
+            }
+        }
+
+        private async Task SetSchema(string schemaName) {
+            using var statement = new DatabricksStatement(this);
+            statement.SqlQuery = $"USE {schemaName}";

Review Comment:
   I'll do what @eric-wang-1990  mentioned and cut a ticket to handle escape



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to