Skip to content

[Bug] truncate partition with NPE #9340

Description

@morningman

Search before asking

  • I had searched in the issues and found no similar issues.

Version

1.0.0

What's Wrong?

CREATE TABLE tbl (
`date_id` date NULL,
`column2` tinyint(4) NULL
) ENGINE=OLAP
DUPLICATE KEY(`date_id`, `column2`)
PARTITION BY RANGE(`date_id`)
(
PARTITION p20200809 VALUES [('2020-08-09'), ('2020-08-10')),
PARTITION P20200810 VALUES [('2020-08-10'), ('2020-08-11')),
PARTITION P20200811 VALUES [('2020-08-11'), ('2020-08-12')),
PARTITION p20200812 VALUES [('2020-08-12'), ('2020-08-13')),
)
DISTRIBUTED BY HASH(`client_id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
truncate table tbl partition(P20200809);

Error:

java.lang.NullPointerException: null
at org.apache.doris.catalog.Catalog.truncateTable(Catalog.java:6782) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.DdlExecutor.execute(DdlExecutor.java:246) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.StmtExecutor.handleDdlStmt(StmtExecutor.java:1520) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:432) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:307) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:212) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.ConnectProcessor.dispatch(ConnectProcessor.java:349) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.qe.ConnectProcessor.processOnce(ConnectProcessor.java:538) ~[palo-fe.jar:1.0-SNAPSHOT]
at org.apache.doris.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:50) ~[palo-fe.jar:1.0-SNAPSHOT]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_131]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_131]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_131]

What You Expected?

truncate ok

How to Reproduce?

This is because the real partition name is p20200809, but in truncate stmt,
it is P20200809.
The partition name is case insensitive, but we didn't handle it correctly in truncate operation.

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions