villebro commented on code in PR #31580:
URL: https://github.com/apache/superset/pull/31580#discussion_r1898092413


##########
superset/db_engine_specs/doris.py:
##########
@@ -245,17 +248,47 @@ def adjust_engine_params(
         catalog: Optional[str] = None,
         schema: Optional[str] = None,
     ) -> tuple[URL, dict[str, Any]]:
-        database = uri.database
-        if schema and database:
-            schema = parse.quote(schema, safe="")
-            if "." in database:
-                database = database.split(".")[0] + "." + schema
-            else:
-                database = "internal." + schema
-            uri = uri.set(database=database)
-
+        if catalog:
+            pass
+        elif uri.database and "." in uri.database:
+            catalog, _ = uri.database.split(".", 1)
+        else:
+            catalog = "internal"
+
+        # In Apache Doris, each catalog has an information_schema for BI tool
+        # compatibility. See: https://github.com/apache/doris/pull/28919
+        if schema:
+            adjusted_database = ".".join([catalog or "", schema])
+        else:
+            adjusted_database = ".".join([catalog or "", "information_schema"])
+        uri = uri.set(database=adjusted_database)

Review Comment:
   Schema assignment can be simplified, and I'd prefer to just rename 
`adjusted_database` to `database`:
   ```suggestion
           # In Apache Doris, each catalog has an information_schema for BI tool
           # compatibility. See: https://github.com/apache/doris/pull/28919
           schema = schema or "information_schema"
           database = ".".join([catalog or "", schema])
           uri = uri.set(database=database)
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to