Skip to content

Commit

Permalink
Add agg mode to fix read tifalsh fail (#2793)
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 authored Nov 8, 2024
1 parent 8f7901e commit 7a0e940
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
23 changes: 23 additions & 0 deletions core/src/test/scala/org/apache/spark/sql/IssueTestSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ import org.apache.spark.sql.functions.{col, sum}

class IssueTestSuite extends BaseTiSparkTest {

test("test read tiflash not null error") {
if (!enableTiFlashTest) {
cancel("tiflash test not enabled")
}
val dbTable = "test.tiflash_not_null"
tidbStmt.execute(s"drop table if exists $dbTable")
tidbStmt.execute(s"CREATE TABLE $dbTable (`a` int NOT NULL)")
tidbStmt.execute(s"ALTER TABLE $dbTable SET TIFLASH REPLICA 1")

Thread.sleep(5 * 1000)

val prev = spark.conf.getOption(TiConfigConst.ISOLATION_READ_ENGINES)
try {
spark.conf
.set(TiConfigConst.ISOLATION_READ_ENGINES, TiConfigConst.TIFLASH_STORAGE_ENGINE)
spark.sql(s"select max(a) from tidb_catalog.$dbTable").show()
} finally {
spark.conf.set(
TiConfigConst.ISOLATION_READ_ENGINES,
prev.getOrElse(TiConfigConst.DEFAULT_STORAGE_ENGINES))
}
}

test("test column mismatch, issue 2750") {
val dbTable = "tispark_test.column_mismatch"
tidbStmt.execute(s"drop table if exists $dbTable")
Expand Down
2 changes: 1 addition & 1 deletion tikv-client/scripts/proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ kvproto_hash=4d69c6f95e683dfb5859277563bf896aca06ec34

raft_rs_hash=b9891b673573fad77ebcf9bbe0969cf945841926

tipb_hash=45e60c77588fefe421d0f6f29426a36b5b15171d
tipb_hash=29e23c62eeace5912f696d1b184b63d5dc3edcce

if [ -d "kvproto" ]; then
cd kvproto; git fetch -p; git checkout ${kvproto_hash}; cd ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.pingcap.tikv.expression.visitor;

import static com.pingcap.tidb.tipb.AggFunctionMode.Partial1Mode;
import static java.util.Objects.requireNonNull;

import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -350,6 +351,7 @@ protected Expr visit(AggregateFunction node, Object context) {
}

builder.setFieldType(toPBFieldType(getType(node)));
builder.setAggFuncMode(Partial1Mode);
return builder.build();
}

Expand Down

0 comments on commit 7a0e940

Please sign in to comment.