Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lgbo-ustc committed Aug 23, 2024
1 parent 4db26ba commit 0fff3e2
Show file tree
Hide file tree
Showing 20 changed files with 33 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ object CHJoinValidateUtil extends Logging {
condition.isDefined && hasTwoTableColumn(leftOutputSet, rightOutputSet, condition.get)
val shouldFallback = joinStrategy match {
case SortMergeJoinStrategy(joinType) =>
joinType.sql.contains("SEMI") || joinType.sql.contains("ANTI") || joinType.toString
.contains("ExistenceJoin") || hasMixedFilterCondition
if (!joinType.isInstanceOf[ExistenceJoin] && joinType.sql.contains("INNER")) {
false
} else {
joinType.sql.contains("SEMI") || joinType.sql.contains("ANTI") || joinType.toString
.contains("ExistenceJoin") || hasMixedFilterCondition
}
case UnknownJoinStrategy(joinType) =>
throw new IllegalArgumentException(s"Unknown join type $joinStrategy")
case _ => false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class GlutenClickHouseColumnarMemorySortShuffleSuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class GlutenClickHouseColumnarShuffleAQESuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class GlutenClickHouseDSV2ColumnarShuffleSuite extends GlutenClickHouseTPCHAbstr
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class GlutenClickHouseDSV2Suite extends GlutenClickHouseTPCHAbstractSuite {
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class GlutenClickHouseDecimalSuite
decimalTPCHTables.foreach {
dt =>
{
val fallBack = (sql_num == 16 || sql_num == 21)
val fallBack = (sql_num == 16)
val compareResult = !dt._2.contains(sql_num)
val native = if (fallBack) "fallback" else "native"
val compare = if (compareResult) "compare" else "noCompare"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class GlutenClickHouseTPCHNullableColumnarShuffleSuite extends GlutenClickHouseT
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class GlutenClickHouseTPCHNullableSuite extends GlutenClickHouseTPCHAbstractSuit
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,6 @@ class GlutenClickHouseTPCDSParquetColumnarShuffleAQESuite
| LIMIT 100 ;
|""".stripMargin
// There are some BroadcastHashJoin with NOT condition
compareResultsAgainstVanillaSpark(sql, true, { df => }, false)
compareResultsAgainstVanillaSpark(sql, true, { df => })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class GlutenClickHouseTPCDSParquetGraceHashJoinSuite extends GlutenClickHouseTPC
.set("spark.io.compression.codec", "snappy")
.set("spark.sql.shuffle.partitions", "5")
.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
.set("spark.memory.offHeap.size", "8g")
.set("spark.memory.offHeap.size", "6g")
.set("spark.gluten.sql.columnar.backend.ch.runtime_settings.join_algorithm", "grace_hash")
.set("spark.gluten.sql.columnar.backend.ch.runtime_settings.max_bytes_in_join", "314572800")
.setMaster("local[2]")
}

executeTPCDSTest(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ class GlutenClickHouseTPCDSParquetSortMergeJoinSuite extends GlutenClickHouseTPC
.set("spark.shuffle.manager", "sort")
.set("spark.io.compression.codec", "snappy")
.set("spark.sql.shuffle.partitions", "5")
.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
.set("spark.memory.offHeap.size", "8g")
.set("spark.sql.autoBroadcastJoinThreshold", "-1")
.set("spark.memory.offHeap.size", "6g")
.set("spark.gluten.sql.columnar.forceShuffledHashJoin", "false")
.setMaster("local[2]")
}

executeTPCDSTest(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class GlutenClickHouseTPCHColumnarShuffleParquetAQESuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) {
runTPCHQuery(21) {
df =>
val plans = collect(df.queryExecution.executedPlan) {
case scanExec: BasicScanExecTransformer => scanExec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class GlutenClickHouseTPCHParquetAQEConcurrentSuite
.set("spark.shuffle.manager", "sort")
.set("spark.io.compression.codec", "snappy")
.set("spark.sql.shuffle.partitions", "5")
.set("spark.sql.autoBroadcastJoinThreshold", "10MB")
.set("spark.sql.adaptive.enabled", "true")
.set("spark.sql.autoBroadcastJoinThreshold", "-1")
}
Expand Down Expand Up @@ -82,5 +81,4 @@ class GlutenClickHouseTPCHParquetAQEConcurrentSuite
queries.map(queryId => runTPCHQuery(queryId) { df => })

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class GlutenClickHouseTPCHParquetAQESuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ class GlutenClickHouseTPCHSaltNullParquetSuite extends GlutenClickHouseTPCHAbstr
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("GLUTEN-2115: Fix wrong number of records shuffle written") {
Expand Down
2 changes: 1 addition & 1 deletion cpp-ch/local-engine/Common/QueryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@ double currentThreadGroupMemoryUsageRatio()
}
return static_cast<double>(CurrentThread::getGroup()->memory_tracker.get()) / CurrentThread::getGroup()->memory_tracker.getSoftLimit();
}
}
}
13 changes: 7 additions & 6 deletions cpp-ch/local-engine/Parser/JoinRelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,14 +681,14 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
auto optional_keys = parse_join_keys(current_expr);
if (!optional_keys)
{
LOG_ERROR(getLogger("JoinRelParser"), "Not equal comparison for keys from both tables");
LOG_INFO(getLogger("JoinRelParser"), "Not equal comparison for keys from both tables");
return false;
}
join_on_clause.addKey(optional_keys->first, optional_keys->second, false);
}
else
{
LOG_ERROR(getLogger("JoinRelParser"), "And or equals function is expected");
LOG_INFO(getLogger("JoinRelParser"), "And or equals function is expected");
return false;
}
}
Expand All @@ -701,7 +701,8 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
expression_stack.pop_back();
if (!check_function("or", current_expr))
{
LOG_ERROR(getLogger("JoinRelParser"), "Not an or expression");
LOG_INFO(getLogger("JoinRelParser"), "Not an or expression");
return false;
}

auto get_current_join_on_clause = [&]()
Expand All @@ -719,7 +720,7 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
auto optional_keys = parse_join_keys(arg.value());
if (!optional_keys)
{
LOG_ERROR(getLogger("JoinRelParser"), "Not equal comparison for keys from both tables");
LOG_INFO(getLogger("JoinRelParser"), "Not equal comparison for keys from both tables");
return false;
}
get_current_join_on_clause()->addKey(optional_keys->first, optional_keys->second, false);
Expand All @@ -728,7 +729,7 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
{
if (!parse_and_expression(arg.value(), *get_current_join_on_clause()))
{
LOG_ERROR(getLogger("JoinRelParser"), "Parse and expression failed");
LOG_INFO(getLogger("JoinRelParser"), "Parse and expression failed");
return false;
}
}
Expand All @@ -738,7 +739,7 @@ bool JoinRelParser::couldRewriteToMultiJoinOnClauses(
}
else
{
LOG_ERROR(getLogger("JoinRelParser"), "Unknow function");
LOG_INFO(getLogger("JoinRelParser"), "Unknow function");
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class GlutenClickHouseRSSColumnarMemorySortShuffleSuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class GlutenClickHouseRSSColumnarShuffleAQESuite
}

test("TPCH Q21") {
runTPCHQuery(21, noFallBack = false) { df => }
runTPCHQuery(21) { df => }
}

test("TPCH Q22") {
Expand Down

0 comments on commit 0fff3e2

Please sign in to comment.