IBM / trino-db2

Db2 JDBC connector for Trino
Apache License 2.0
18 stars 30 forks source link

Not able to delete or update #45

Open shawnzhu opened 4 years ago

shawnzhu commented 4 years ago

What happened

Given prestosql cluster configured with this connector to a db2 warehouse:

delete from <catalog_name>.<schema_name>.xxxxxx WHERE dt_month='2020-04'

It reports error information as USER_ERROR:

io.prestosql.spi.PrestoException: This connector does not support updates or deletes
    at io.prestosql.spi.connector.ConnectorMetadata.getUpdateRowIdColumnHandle(ConnectorMetadata.java:451)
    at io.prestosql.metadata.MetadataManager.getUpdateRowIdColumnHandle(MetadataManager.java:816)
    at io.prestosql.sql.planner.QueryPlanner.plan(QueryPlanner.java:266)
    at io.prestosql.sql.planner.LogicalPlanner.createDeletePlan(LogicalPlanner.java:557)
    at io.prestosql.sql.planner.LogicalPlanner.planStatementWithoutOutput(LogicalPlanner.java:243)
    at io.prestosql.sql.planner.LogicalPlanner.planStatement(LogicalPlanner.java:224)
    at io.prestosql.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:190)
    at io.prestosql.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:185)
    at io.prestosql.sql.planner.LogicalPlanner.plan(LogicalPlanner.java:180)
    at io.prestosql.execution.SqlQueryExecution.doPlanQuery(SqlQueryExecution.java:395)
    at io.prestosql.execution.SqlQueryExecution.planQuery(SqlQueryExecution.java:383)
    at io.prestosql.execution.SqlQueryExecution.start(SqlQueryExecution.java:338)
    at io.prestosql.$gen.Presto_331____20200401_203625_2.run(Unknown Source)
    at io.prestosql.execution.SqlQueryManager.createQuery(SqlQueryManager.java:240)
    at io.prestosql.dispatcher.LocalDispatchQuery.lambda$startExecution$7(LocalDispatchQuery.java:132)
    at io.prestosql.$gen.Presto_331____20200401_203625_2.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

Expected result

It should work since it supports updates statement via this connector already.

shawnzhu commented 3 years ago

The Update statement is not supported in base JDBC client. Need to figure out whether the base JDBC client support DELETE statement