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 e45cdec4d87 [kudu] fix write priv issue (#379)
e45cdec4d87 is described below
commit e45cdec4d87fcc9f974c3d47aaa42d9ddd9604a9
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Sat Feb 7 01:13:51 2026 +0800
[kudu] fix write priv issue (#379)
---
.../SchemaEmulationByTableNameConvention.java | 44 +++-------------------
1 file changed, 6 insertions(+), 38 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 733ee57e7af..2d7c3aaf9a4 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
@@ -25,13 +25,9 @@ import org.apache.kudu.client.CreateTableOptions;
import org.apache.kudu.client.Delete;
import org.apache.kudu.client.KuduException;
import org.apache.kudu.client.KuduOperationApplier;
-import org.apache.kudu.client.KuduScanner;
import org.apache.kudu.client.KuduTable;
-import org.apache.kudu.client.RowResult;
-import org.apache.kudu.client.RowResultIterator;
import org.apache.kudu.client.Upsert;
-import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@@ -113,40 +109,12 @@ public class SchemaEmulationByTableNameConvention
public List<String> listSchemaNames(KuduClientWrapper client)
{
try {
- if (rawSchemasTable == null) {
- // 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();
- RowResultIterator iterator = scanner.nextRows();
- ArrayList<String> result = new ArrayList<>();
- while (iterator != null) {
- for (RowResult row : iterator) {
- result.add(row.getString(0));
- }
- iterator = scanner.nextRows();
- }
- return result;
+ // createAndFillSchemasTable(client);
+ // rawSchemasTable = getSchemasTable(client);
+ // ATTN, sometimes user does not have write priv for kudu,
+ // so we can not create schema table here.
+ // So here we get schema names directly from tablets.
+ return listSchemaNamesFromTablets(client);
}
catch (KuduException e) {
throw new TrinoException(GENERIC_INTERNAL_ERROR, e);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]