StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
8.93k stars 1.79k forks source link

Query exception occurs when there is a string literal in the predicate #26988

Closed wg1026688210 closed 1 year ago

wg1026688210 commented 1 year ago

Steps to reproduce the behavior (Required)

  1. select * from laxin_toufang_by_loudou where deviceid='0020B6B1218C83CA785262445B1E99525D8B002F' limit 10

Real behavior (Required)

throw Exception :

2023-07-11 17:19:00,986 WARN (starrocks-mysql-nio-pool-25|3343) [StmtExecutor.execute():615] execute Exception, sql select * from laxin_toufang_by_loudou where deviceid='0020B6B1218C83CA785262445B1E99525D8B002F' limit 10

java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.paimon.data.BinaryString

        at org.apache.paimon.data.GenericRow.getString(GenericRow.java:171) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.data.InternalRow.lambda$createFieldGetter$1b68edea$1(InternalRow.java:174) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.data.serializer.InternalRowSerializer.toBinaryRow(InternalRowSerializer.java:158) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.predicate.BucketSelector.hash(BucketSelector.java:142) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.predicate.BucketSelector.lambda$create$1(BucketSelector.java:134) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.predicate.BucketSelector.assembleRows(BucketSelector.java:156) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.predicate.BucketSelector.create(BucketSelector.java:132) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.operation.AbstractFileStoreScan.withBucketKeyFilter(AbstractFileStoreScan.java:111) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.operation.KeyValueFileStoreScan.withKeyFilter(KeyValueFileStoreScan.java:82) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.table.ChangelogWithKeyFileStoreTable.lambda$nonPartitionFilterConsumer$2(ChangelogWithKeyFileStoreTable.java:187) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.table.source.snapshot.SnapshotSplitReaderImpl.withFilter(SnapshotSplitReaderImpl.java:115) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.table.source.InnerTableScanImpl.withFilter(InnerTableScanImpl.java:47) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at org.apache.paimon.table.source.ReadBuilderImpl.newScan(ReadBuilderImpl.java:71) ~[paimon-bundle-0.4.0-incubating.jar:0.4.0-incubating]

        at com.starrocks.connector.paimon.PaimonMetadata.getRemoteFileInfos(PaimonMetadata.java:176) ~[starrocks-fe.jar:?]

        at com.starrocks.server.MetadataMgr.getRemoteFileInfos(MetadataMgr.java:286) ~[starrocks-fe.jar:?]

        at com.starrocks.connector.paimon.PaimonMetadata.getTableStatistics(PaimonMetadata.java:203) ~[starrocks-fe.jar:?]

        at com.starrocks.server.MetadataMgr.lambda$getTableStatistics$5(MetadataMgr.java:273) ~[starrocks-fe.jar:?]

        at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_92]

        at com.starrocks.server.MetadataMgr.getTableStatistics(MetadataMgr.java:272) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.statistics.StatisticsCalculator.computePaimonScanNode(StatisticsCalculator.java:358) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.statistics.StatisticsCalculator.visitLogicalPaimonScan(StatisticsCalculator.java:346) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.statistics.StatisticsCalculator.visitLogicalPaimonScan(StatisticsCalculator.java:153) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.operator.logical.LogicalPaimonScanOperator.accept(LogicalPaimonScanOperator.java:47) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.statistics.StatisticsCalculator.estimatorStats(StatisticsCalculator.java:169) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.task.DeriveStatsTask.execute(DeriveStatsTask.java:57) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.task.SeriallyTaskScheduler.executeTasks(SeriallyTaskScheduler.java:69) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.Optimizer.memoOptimize(Optimizer.java:504) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.Optimizer.optimizeByCost(Optimizer.java:173) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.optimizer.Optimizer.optimize(Optimizer.java:115) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.StatementPlanner.createQueryPlan(StatementPlanner.java:140) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.StatementPlanner.planQuery(StatementPlanner.java:115) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.StatementPlanner.plan(StatementPlanner.java:90) ~[starrocks-fe.jar:?]

        at com.starrocks.sql.StatementPlanner.plan(StatementPlanner.java:55) ~[starrocks-fe.jar:?]

        at com.starrocks.qe.StmtExecutor.execute(StmtExecutor.java:408) ~[starrocks-fe.jar:?]

        at com.starrocks.qe.ConnectProcessor.handleQuery(ConnectProcessor.java:359) ~[starrocks-fe.jar:?]

        at com.starrocks.qe.ConnectProcessor.dispatch(ConnectProcessor.java:473) ~[starrocks-fe.jar:?]

        at com.starrocks.qe.ConnectProcessor.processOnce(ConnectProcessor.java:739) ~[starrocks-fe.jar:?]

        at com.starrocks.mysql.nio.ReadListener.lambda$handleEvent$0(ReadListener.java:69) ~[starrocks-fe.jar:?]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_92]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_92]

        at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_92]

StarRocks version (Required)

3.1.0-rc01

wg1026688210 commented 1 year ago

I'm willing to submit a PR