Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Change NativeDataFrameAggregateSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed May 27, 2022
1 parent a63a23e commit 07c1c95
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.spark.sql.nativesql

import com.intel.oap.GazellePluginConfig
import com.intel.oap.execution.ColumnarHashAggregateExec

import org.apache.spark.sql.{AnalysisException, Column, DataFrame, QueryTest, Row}

import scala.util.Random
Expand Down Expand Up @@ -1043,6 +1043,7 @@ class NativeDataFrameAggregateSuite extends QueryTest
Seq(true, false).foreach { value =>
test(s"SPARK-31620: agg with subquery (whole-stage-codegen = $value)") {
withSQLConf(
GazellePluginConfig.getSessionConf.ENABLE_HASH_AGG_FOR_STRING_TYPE_KEY -> "false",
SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> value.toString) {
withTempView("t1", "t2") {
sql("create temporary view t1 as select * from values (1, 2) as t1(a, b)")
Expand Down Expand Up @@ -1079,6 +1080,27 @@ class NativeDataFrameAggregateSuite extends QueryTest
}
}

Seq(true, false).foreach { value =>
test(s"Force to use hash agg for string type with (whole-stage-codegen = $value)") {
withSQLConf(
GazellePluginConfig.getSessionConf.ENABLE_HASH_AGG_FOR_STRING_TYPE_KEY -> "true",
SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> value.toString) {
withTempView("t1") {
sql("create temporary view t1 as select * from values('A'), ('B'), ('C') as t1(col1)")
// test hashAggregateExec
var df = sql("select max(col1) from t1")
assert(find(df.queryExecution.executedPlan)(
_.isInstanceOf[ColumnarHashAggregateExec]).isDefined)
checkAnswer(df, Row("C") :: Nil)
df = sql("select first(col1) from t1")
assert(find(df.queryExecution.executedPlan)(
_.isInstanceOf[ColumnarHashAggregateExec]).isDefined)
checkAnswer(df, Row("A") :: Nil)
}
}
}
}

test("SPARK-32038: NormalizeFloatingNumbers should work on distinct aggregate") {
withTempView("view") {
val nan1 = java.lang.Float.intBitsToFloat(0x7f800001)
Expand Down

0 comments on commit 07c1c95

Please sign in to comment.