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

morningman pushed a commit to branch trino-435
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/trino-435 by this push:
     new 5140ae25a6f [fix](kudu) avoid create schema table when no write privc 
(#377)
5140ae25a6f is described below

commit 5140ae25a6f08ba416ab60b1f05f9efcc5529446
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Feb 3 12:49:26 2026 +0800

    [fix](kudu) avoid create schema table when no write privc (#377)
---
 .../SchemaEmulationByTableNameConvention.java      | 23 ++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git 
a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/schema/SchemaEmulationByTableNameConvention.java
 
b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/schema/SchemaEmulationByTableNameConvention.java
index c66f08b3a4f..733ee57e7af 100644
--- 
a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/schema/SchemaEmulationByTableNameConvention.java
+++ 
b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/schema/SchemaEmulationByTableNameConvention.java
@@ -114,8 +114,27 @@ public class SchemaEmulationByTableNameConvention
     {
         try {
             if (rawSchemasTable == null) {
-                createAndFillSchemasTable(client);
-                rawSchemasTable = getSchemasTable(client);
+                // Try to open the schemas table first, only create if it 
doesn't exist
+                try {
+                    rawSchemasTable = client.openTable(rawSchemasTableName);
+                }
+                catch (KuduException e) {
+                    if (e.getStatus().isNotFound()) {
+                        // Table doesn't exist, try to create it (requires 
write permission)
+                        // If creation fails due to permission, fall back to 
scanning table names
+                        try {
+                            createAndFillSchemasTable(client);
+                            rawSchemasTable = getSchemasTable(client);
+                        }
+                        catch (KuduException createException) {
+                            // Fall back to listing schemas from table names 
directly (read-only)
+                            return listSchemaNamesFromTablets(client);
+                        }
+                    }
+                    else {
+                        throw e;
+                    }
+                }
             }
 
             KuduScanner scanner = 
client.newScannerBuilder(rawSchemasTable).build();


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

Reply via email to