使用tispark 查询个别table出现报错 The number of handle columns exceeds the length of `columns_info`


执行的sql语句:

 select t.user_uuid as user_uuid
           ,u.id as user_id
           ,t.servicing_geo_entity_id as servicing_geo_entity_id
           ,t.updated_at as updated_at
            ,u.cdc_region as cdc_region
        from (select * from (select t.user_uuid
                    ,servicing_geo_entity_id
                    ,t.updated_at
                    ,ROW_NUMBER()over(partition by t.user_uuid order by t.updated_at desc) as rn
        from tidb_catalog.xxx.ods_xx_user_entity_migrations_cur t
        where t.status='done'
          and t.updated_at<'2024-07-23'
        )t where rn = 1)t join (select user.uuid,user.id ,user.cdc_region 
                from tidb_catalog.xxx_pii.ods_xx_users_cur user
             ) u on t.user_uuid=u.uuid;

报错信息如下:

24/07/24 07:24:41 INFO DAGScheduler: ShuffleMapStage 4 (count at NativeMethodAccessorImpl.java:0) failed in 0.904 s due to Job aborted due to stage failure: Task 0 in stage 4.0 failed 4 times, most recent failure: Lost task 0.3 in stage 4.0 (TID 6) (100.100.111.233 executor 1): com.pingcap.tikv.exception.TiClientInternalException: Error reading region:
	at com.pingcap.tikv.operation.iterator.DAGIterator.doReadNextRegionChunks(DAGIterator.java:191)
	at com.pingcap.tikv.operation.iterator.DAGIterator.readNextRegionChunks(DAGIterator.java:168)
	at com.pingcap.tikv.operation.iterator.DAGIterator.hasNext(DAGIterator.java:114)
	at org.apache.spark.sql.tispark.TiRowRDD$$anon$1.hasNext(TiRowRDD.scala:70)
	at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage2.columnartorow_nextBatch_0$(Unknown Source)
	at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIteratorForCodegenStage2.processNext(Unknown Source)
	at org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
	at org.apache.spark.sql.execution.WholeStageCodegenExec$$anon$1.hasNext(WholeStageCodegenExec.scala:759)
	at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:458)
	at org.apache.spark.shuffle.sort.BypassMergeSortShuffleWriter.write(BypassMergeSortShuffleWriter.java:140)
	at org.apache.spark.shuffle.ShuffleWriteProcessor.write(ShuffleWriteProcessor.scala:59)
	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:99)
	at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:52)
	at org.apache.spark.scheduler.Task.run(Task.scala:131)
	at org.apache.spark.executor.Executor$TaskRunner.$anonfun$run$3(Executor.scala:506)
	at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1491)
	at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:509)
	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:829)
Caused by: java.util.concurrent.ExecutionException: com.pingcap.tikv.exception.RegionTaskException: Handle region task failed:
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.pingcap.tikv.operation.iterator.DAGIterator.doReadNextRegionChunks(DAGIterator.java:186)
	... 19 more
Caused by: com.pingcap.tikv.exception.RegionTaskException: Handle region task failed:
	at com.pingcap.tikv.operation.iterator.DAGIterator.process(DAGIterator.java:243)
	at com.pingcap.tikv.operation.iterator.DAGIterator.lambda$submitTasks$1(DAGIterator.java:92)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	... 3 more
Caused by: com.pingcap.tikv.exception.GrpcException: [components/tidb_query_executors/src/index_scan_executor.rs:90]: The number of handle columns exceeds the length of `columns_info`
	at com.pingcap.tikv.region.RegionStoreClient.handleCopResponse(RegionStoreClient.java:748)
	at com.pingcap.tikv.region.RegionStoreClient.coprocess(RegionStoreClient.java:689)
	at com.pingcap.tikv.operation.iterator.DAGIterator.process(DAGIterator.java:229)

试一下在 TiDB Server 这里执行有没有报错?

https://github.com/pingcap/tispark/issues/2750

感觉是个bug。

tispark版本是多少

先使用与tidb版本匹配的tispark,然后再进行测试和使用。
经过tidb从7.5升级到8.1后,我们从tispark切换到了jdbc_catalog…

1 个赞

SQL直接查询对不对

@TiDBer_杨大侠 试试 tispark v3.1.6