Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE on Kudu table created from Impala fails when partitioning information is missing #24661

Open
findinpath opened this issue Jan 8, 2025 · 1 comment · May be fixed by #24674
Open

DELETE on Kudu table created from Impala fails when partitioning information is missing #24661

findinpath opened this issue Jan 8, 2025 · 1 comment · May be fixed by #24674
Assignees
Labels
bug Something isn't working

Comments

@findinpath
Copy link
Contributor

Environment setup

Follow https://kudu.apache.org/docs/quickstart.html

docker-compose -f docker/quickstart.yml up -d

Run Impala by following https://github.com/apache/kudu/tree/master/examples/quickstart/impala

docker exec -it kudu-impala impala-shell

Execute in Impala shell the following command

CREATE EXTERNAL TABLE geoflow_co (
  sale_customer_order_systemid STRING NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  sale_customer_order_number STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  sale_customer_order_status_code STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  PRIMARY KEY (sale_customer_order_systemid)
) COMMENT '' STORED AS KUDU TBLPROPERTIES (
  'replication_factor' = '1',
  'external.table.purge' = 'TRUE'
)

Perform a delete from Impala (should succeed successfully):

DELETE FROM geoflow_co;

Setup Kudu on Trino

kudu.properties

connector.name=kudu

## Defaults to NONE
kudu.authentication.type = NONE

## List of Kudu master addresses, at least one is needed (comma separated)
## Supported formats: example.com, example.com:7051, 192.0.2.1, 192.0.2.1:7051,
##                    [2001:db8::1], [2001:db8::1]:7051, 2001:db8::1
kudu.client.master-addresses=localhost:7051,localhost:7151,localhost:7251

On Trino CLI

trino> show tables in kudu.default;
           Table            
----------------------------
 impala::default.geoflow_co 
 presto::$schemas           
(2 rows)


trino> show create table kudu.default."impala::default.geoflow_co";
                                 Create Table                                  
-------------------------------------------------------------------------------
 CREATE TABLE kudu.default."impala::default.geoflow_co" (                      
    sale_customer_order_systemid varchar COMMENT '' WITH (primary_key = true), 
    sale_customer_order_number varchar COMMENT '' WITH (nullable = true),      
    sale_customer_order_status_code varchar COMMENT '' WITH (nullable = true)  
 )                                                                             
 WITH (                                                                        
    number_of_replicas = 3,                                                    
    range_partitions = '[]'                                                    
 )                                                                             
(1 row)


trino> DELETE FROM kudu.default."impala::default.geoflow_co";
Query 20250108_212225_00008_t777n failed: Cannot invoke "java.util.List.isEmpty()" because "hashColumns" is null
java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because "hashColumns" is null
	at io.trino.plugin.kudu.properties.KuduTableProperties.getPartitionDesign(KuduTableProperties.java:141)
	at io.trino.plugin.kudu.KuduMetadata.beginMerge(KuduMetadata.java:448)
	at io.trino.tracing.TracingConnectorMetadata.beginMerge(TracingConnectorMetadata.java:760)
	at io.trino.metadata.MetadataManager.beginMerge(MetadataManager.java:1367)
	at io.trino.tracing.TracingMetadata.beginMerge(TracingMetadata.java:830)
	at io.trino.sql.planner.optimizations.BeginTableWrite$Rewriter.createWriterTarget(BeginTableWrite.java:251)
	at io.trino.sql.planner.optimizations.BeginTableWrite$Rewriter.visitTableFinish(BeginTableWrite.java:175)
	at io.trino.sql.planner.optimizations.BeginTableWrite$Rewriter.visitTableFinish(BeginTableWrite.java:93)
	at io.trino.sql.planner.plan.TableFinishNode.accept(TableFinishNode.java:105)
	at io.trino.sql.planner.plan.SimplePlanRewriter$RewriteContext.rewrite(SimplePlanRewriter.java:81)
	at io.trino.sql.planner.plan.SimplePlanRewriter$RewriteContext.lambda$defaultRewrite$0(SimplePlanRewriter.java:72)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:423)
	at io.trino.sql.planner.plan.SimplePlanRewriter$RewriteContext.defaultRewrite(SimplePlanRewriter.java:72)
	at io.trino.sql.planner.plan.SimplePlanRewriter.visitPlan(SimplePlanRewriter.java:37)
	at io.trino.sql.planner.plan.SimplePlanRewriter.visitPlan(SimplePlanRewriter.java:21)
	at io.trino.sql.planner.plan.PlanVisitor.visitOutput(PlanVisitor.java:49)
	at io.trino.sql.planner.plan.OutputNode.accept(OutputNode.java:82)
	at io.trino.sql.planner.plan.SimplePlanRewriter.rewriteWith(SimplePlanRewriter.java:31)
	at io.trino.sql.planner.optimizations.BeginTableWrite.optimize(BeginTableWrite.java:78)
	at io.trino.sql.planner.LogicalPlanner.runOptimizer(LogicalPlanner.java:308)
	at io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:272)
	at io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:244)
	at io.trino.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:239)
	at io.trino.execution.SqlQueryExecution.doPlanQuery(SqlQueryExecution.java:503)
	at io.trino.execution.SqlQueryExecution.planQuery(SqlQueryExecution.java:482)
	at io.trino.execution.SqlQueryExecution.start(SqlQueryExecution.java:420)
	at io.trino.execution.SqlQueryManager.createQuery(SqlQueryManager.java:272)
	at io.trino.dispatcher.LocalDispatchQuery.startExecution(LocalDispatchQuery.java:150)
	at io.trino.dispatcher.LocalDispatchQuery.lambda$waitForMinimumWorkers$2(LocalDispatchQuery.java:134)
	at io.airlift.concurrent.MoreFutures.lambda$addSuccessCallback$12(MoreFutures.java:570)
	at io.airlift.concurrent.MoreFutures$3.onSuccess(MoreFutures.java:545)
	at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1139)
	at io.trino.$gen.Trino_dev____20250108_211226_2.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1575)
	Suppressed: java.lang.Exception: Current plan:
                Output[columnNames = [rows]]
                │   Layout: [rows:bigint]
                └─ TableCommit[target = kudu:default.impala::default.geoflow_co]
                   │   Layout: [rows:bigint]
                   └─ LocalExchange[partitioning = SINGLE]
                      │   Layout: [partialrows:bigint, fragment:varbinary]
                      └─ RemoteExchange[type = GATHER]
                         │   Layout: [partialrows:bigint, fragment:varbinary]
                         └─ MergeWriter[table = kudu:default.impala::default.geoflow_co]
                            │   Layout: [partialrows:bigint, fragment:varbinary]
                            └─ LocalExchange[partitioning = SINGLE]
                               │   Layout: [sale_customer_order_systemid:varchar, operation:tinyint, case_number:integer, field:varbinary, insert_from_update:tinyint]
                               └─ RemoteExchange[partitionCount = 100, type = REPARTITION]
                                  │   Layout: [sale_customer_order_systemid:varchar, operation:tinyint, case_number:integer, field:varbinary, insert_from_update:tinyint]
                                  └─ ScanProject[table = kudu:default.impala::default.geoflow_co]
                                         Layout: [sale_customer_order_systemid:varchar, operation:tinyint, case_number:integer, field:varbinary, insert_from_update:tinyint]
                                         sale_customer_order_systemid := null::varchar
                                         operation := tinyint '2'
                                         case_number := integer '0'
                                         insert_from_update := tinyint '0'
                                         field := KuduColumnHandle[name=row_uuid, ordinalPosition=-1, type=varbinary]

		at io.trino.sql.planner.optimizations.BeginTableWrite.optimize(BeginTableWrite.java:84)
		... 17 more
@findinpath findinpath added the bug Something isn't working label Jan 8, 2025
@findinpath findinpath changed the title DELETE on Kudu table created from Impala fails DELETE on Kudu table created from Impala fails Jan 8, 2025
@findinpath findinpath changed the title DELETE on Kudu table created from Impala fails DELETE on Kudu table created from Impala fails when partitioning information is missing Jan 8, 2025
@findinpath
Copy link
Contributor Author

findinpath commented Jan 9, 2025

Related issue https://issues.apache.org/jira/browse/IMPALA-5546

Kudu represents this as a table that is range partitioned on no columns.
Because unpartitioned Kudu tables are inefficient for large data
sizes, and because the syntax doesn't make it explicit that the table
will be unpartitioned, there is a warning issued to encourage users
to created partitioned tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants