Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.gluten.execution

import org.apache.spark.SparkConf
import org.apache.spark.sql.{DataFrame, Row, TestUtils}
import org.apache.spark.sql.{DataFrame, GlutenTestUtils, Row}
import org.apache.spark.sql.execution.InputIteratorTransformer
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
import org.apache.spark.sql.execution.aggregate.SortAggregateExec
Expand Down Expand Up @@ -590,7 +590,7 @@ class GlutenClickHouseTPCHBucketSuite
case o => o
})
}
TestUtils.compareAnswers(sortedRes, exceptedResult)
GlutenTestUtils.compareAnswers(sortedRes, exceptedResult)
}

val SQL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.gluten.execution

import org.apache.spark.SparkConf
import org.apache.spark.sql.{Row, TestUtils}
import org.apache.spark.sql.{GlutenTestUtils, Row}
import org.apache.spark.sql.catalyst.optimizer.{BuildLeft, BuildRight}
import org.apache.spark.sql.types.{DecimalType, StructType}

Expand Down Expand Up @@ -342,7 +342,7 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
assert(result.size == 7)
val expected =
Seq(Row(465.0), Row(67.0), Row(160.0), Row(371.0), Row(732.0), Row(138.0), Row(785.0))
TestUtils.compareAnswers(result, expected)
GlutenTestUtils.compareAnswers(result, expected)
}

test("test 'order by' two keys") {
Expand All @@ -358,7 +358,7 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
val result = df.take(3)
val expected =
Seq(Row(0, "ALGERIA", 0), Row(1, "ARGENTINA", 1), Row(2, "BRAZIL", 1))
TestUtils.compareAnswers(result, expected)
GlutenTestUtils.compareAnswers(result, expected)
}
}

Expand All @@ -373,7 +373,7 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
assert(sortExec.size == 1)
val result = df.collect()
val expectedResult = Seq(Row(0), Row(1), Row(2), Row(3), Row(4))
TestUtils.compareAnswers(result, expectedResult)
GlutenTestUtils.compareAnswers(result, expectedResult)
}
}

Expand Down Expand Up @@ -416,7 +416,7 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
new java.math.BigDecimal("123456789.223456789012345678901234567"),
Seq(new java.math.BigDecimal("123456789.123456789012345678901234567"))
))
TestUtils.compareAnswers(result, expectedResult)
GlutenTestUtils.compareAnswers(result, expectedResult)
}

test("test decimal128") {
Expand All @@ -434,8 +434,8 @@ class GlutenClickHouseTPCHSuite extends GlutenClickHouseTPCHAbstractSuite {
.add("b1", DecimalType(38, 27)))

val df2 = spark.createDataFrame(data, schema)
TestUtils.compareAnswers(df2.select("b").collect(), Seq(Row(struct)))
TestUtils.compareAnswers(
GlutenTestUtils.compareAnswers(df2.select("b").collect(), Seq(Row(struct)))
GlutenTestUtils.compareAnswers(
df2.select("a").collect(),
Seq(Row(new java.math.BigDecimal("123456789.123456789012345678901234566"))))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.gluten.execution

import org.apache.spark.SparkConf
import org.apache.spark.sql.{DataFrame, Row, TestUtils}
import org.apache.spark.sql.{DataFrame, GlutenTestUtils, Row}
import org.apache.spark.sql.catalyst.expressions.{Expression, GetJsonObject, Literal}
import org.apache.spark.sql.catalyst.optimizer.{ConstantFolding, NullPropagation}
import org.apache.spark.sql.catalyst.plans.logical.{Filter, LogicalPlan, Project}
Expand Down Expand Up @@ -595,7 +595,7 @@ class GlutenFunctionValidateSuite extends GlutenClickHouseWholeStageTransformerS
// check the result
val result = df.collect()
assert(result.length === exceptedResult.size)
TestUtils.compareAnswers(result, exceptedResult)
GlutenTestUtils.compareAnswers(result, exceptedResult)
}

runSql("select round(0.41875d * id , 4) from range(10);")(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.apache.gluten.sql.shims.SparkShimLoader

import org.apache.spark.SparkConf
import org.apache.spark.scheduler.{SparkListener, SparkListenerStageCompleted}
import org.apache.spark.sql.TestUtils
import org.apache.spark.sql.GlutenTestUtils
import org.apache.spark.sql.execution.{ColumnarInputAdapter, CommandResultExec, InputIteratorTransformer}
import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanHelper, BroadcastQueryStageExec}
import org.apache.spark.sql.execution.exchange.BroadcastExchangeLike
Expand Down Expand Up @@ -219,7 +219,7 @@ class VeloxMetricsSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
}
}

TestUtils.withListener(spark.sparkContext, inputMetricsListener) {
GlutenTestUtils.withListener(spark.sparkContext, inputMetricsListener) {
_ =>
val df = spark.sql("""
|select /*+ BROADCAST(part) */ * from part join lineitem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.apache.gluten.config.GlutenConfig
import org.apache.gluten.config.VeloxConfig

import org.apache.spark.SparkConf
import org.apache.spark.sql.{DataFrame, Row, TestUtils}
import org.apache.spark.sql.{DataFrame, GlutenTestUtils, Row}
import org.apache.spark.sql.execution.{ColumnarShuffleExchangeExec, FormattedMode}

import org.apache.commons.io.FileUtils
Expand Down Expand Up @@ -265,7 +265,7 @@ class VeloxTPCHDistinctSpillSuite extends VeloxTPCHTableSupport {

test("distinct spill") {
val df = spark.sql("select count(distinct *) from lineitem limit 1")
TestUtils.compareAnswers(df.collect(), Seq(Row(60175)))
GlutenTestUtils.compareAnswers(df.collect(), Seq(Row(60175)))
}
}

Expand All @@ -287,7 +287,7 @@ class VeloxTPCHMiscSuite extends VeloxTPCHTableSupport {
val result = df.collect()
df.explain(true)
val expectedResult = Seq(Row(0), Row(1), Row(2), Row(3), Row(4))
TestUtils.compareAnswers(result, expectedResult)
GlutenTestUtils.compareAnswers(result, expectedResult)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ package org.apache.spark.sql

import org.apache.gluten.exception.GlutenException

import org.apache.spark.{TestUtils => SparkTestUtils}
import org.apache.spark.SparkContext
import org.apache.spark.TestUtils
import org.apache.spark.scheduler.SparkListener
import org.apache.spark.sql.test.SQLTestUtils

object TestUtils {
object GlutenTestUtils {
def compareAnswers(actual: Seq[Row], expected: Seq[Row], sort: Boolean = false): Unit = {
val result = SQLTestUtils.compareAnswers(actual, expected, sort)
if (result.isDefined) {
Expand All @@ -32,6 +32,6 @@ object TestUtils {
}

def withListener[L <: SparkListener](sc: SparkContext, listener: L)(body: L => Unit): Unit = {
SparkTestUtils.withListener(sc, listener)(body)
TestUtils.withListener(sc, listener)(body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ object ClickHouseSQLQueryTestSettings extends SQLQueryTestSettings {
"window.sql",
"udf/udf-window.sql",
"group-by.sql",
"udf/udf-group-by.sql - Scala UDF"
"udf/udf-group-by.sql - Scala UDF",
"udaf/udaf-group-analytics.sql",
"udaf/udaf-group-by-ordinal.sql",
"udaf/udaf-group-by.sql"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ object VeloxSQLQueryTestSettings extends SQLQueryTestSettings {
"typeCoercion/native/promoteStrings.sql",
"typeCoercion/native/widenSetOperationTypes.sql",
"typeCoercion/native/windowFrameCoercion.sql",
"udaf/udaf.sql",
"udaf/udaf.sql - Grouped Aggregate Pandas UDF",
"udf/udf-union.sql - Scala UDF",
"udf/udf-intersect-all.sql - Scala UDF",
"udf/udf-except-all.sql - Scala UDF",
Expand Down
Loading