Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL] Add schema validation for all operators #6406

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -258,6 +258,16 @@ class TestOperator extends VeloxWholeStageTransformerSuite with AdaptiveSparkPla
checkLengthAndPlan(df, 5)
}

testWithSpecifiedSparkVersion("coalesce validation", Some("3.4")) {
withTempPath {
path =>
val data = "2019-09-09 01:02:03.456789"
val df = Seq(data).toDF("strTs").selectExpr(s"CAST(strTs AS TIMESTAMP_NTZ) AS ts")
df.coalesce(1).write.format("parquet").save(path.getCanonicalPath)
spark.read.parquet(path.getCanonicalPath).collect
}
}

test("groupby") {
val df = runQueryAndCompare(
"select l_orderkey, sum(l_partkey) as sum from lineitem " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
package org.apache.gluten.execution

import org.apache.gluten.extension.GlutenPlan
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.extension.{GlutenPlan, ValidationResult}

import org.apache.spark.{Partition, SparkContext, TaskContext}
import org.apache.spark.rdd.RDD
Expand All @@ -32,6 +33,16 @@ case class ColumnarCoalesceExec(numPartitions: Int, child: SparkPlan)

override def supportsColumnar: Boolean = true

override protected def doValidateInternal(): ValidationResult = {
BackendsApiManager.getValidatorApiInstance
.doSchemaValidate(child.schema)
.map {
reason =>
ValidationResult.notOk(s"Found schema check failure for ${child.schema}, due to: $reason")
}
.getOrElse(ValidationResult.ok)
}

override def output: Seq[Attribute] = child.output

override def outputPartitioning: Partitioning = {
Expand Down
Loading