Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Jul 11, 2024
1 parent 05817e5 commit cfe3217
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ case class CustomerColumnarPreRules(session: SparkSession) extends Rule[SparkPla
fileSourceScan.tableIdentifier,
fileSourceScan.disableBucketedScan
)
if (transformer.doValidate().isValid) {
if (transformer.doValidate().ok()) {
transformer
} else {
plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql.execution
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.execution.BasicScanExecTransformer
import org.apache.gluten.extension.GlutenPlan
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags, TRANSFORM_UNSUPPORTED}
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags}
import org.apache.gluten.extension.columnar.heuristic.HeuristicApplier
import org.apache.gluten.extension.columnar.transition.InsertTransitions
import org.apache.gluten.utils.QueryPlanSelector
Expand Down Expand Up @@ -124,17 +124,16 @@ class FallbackStrategiesSuite extends GlutenSQLTestsTrait {

testGluten("Tag not transformable more than once") {
val originalPlan = UnaryOp1(LeafOp(supportsColumnar = true))
FallbackTags.tag(originalPlan, TRANSFORM_UNSUPPORTED(Some("fake reason")))
FallbackTags.add(originalPlan, "fake reason")
val rule = FallbackEmptySchemaRelation()
val newPlan = rule.apply(originalPlan)
val reason = FallbackTags.getTag(newPlan).asInstanceOf[TRANSFORM_UNSUPPORTED].reason
assert(reason.isDefined)
val reason = FallbackTags.get(newPlan).reason()
if (BackendsApiManager.getSettings.fallbackOnEmptySchema(newPlan)) {
assert(
reason.get.contains("fake reason") &&
reason.get.contains("at least one of its children has empty output"))
reason.contains("fake reason") &&
reason.contains("at least one of its children has empty output"))
} else {
assert(reason.get.contains("fake reason"))
assert(reason.contains("fake reason"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ case class CustomerColumnarPreRules(session: SparkSession) extends Rule[SparkPla
fileSourceScan.tableIdentifier,
fileSourceScan.disableBucketedScan
)
if (transformer.doValidate().isValid) {
if (transformer.doValidate().ok()) {
transformer
} else {
plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql.execution
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.execution.BasicScanExecTransformer
import org.apache.gluten.extension.GlutenPlan
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags, TRANSFORM_UNSUPPORTED}
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags}
import org.apache.gluten.extension.columnar.heuristic.HeuristicApplier
import org.apache.gluten.extension.columnar.transition.InsertTransitions
import org.apache.gluten.utils.QueryPlanSelector
Expand Down Expand Up @@ -125,17 +125,16 @@ class FallbackStrategiesSuite extends GlutenSQLTestsTrait {

testGluten("Tag not transformable more than once") {
val originalPlan = UnaryOp1(LeafOp(supportsColumnar = true))
FallbackTags.tag(originalPlan, TRANSFORM_UNSUPPORTED(Some("fake reason")))
FallbackTags.add(originalPlan, "fake reason")
val rule = FallbackEmptySchemaRelation()
val newPlan = rule.apply(originalPlan)
val reason = FallbackTags.getTag(newPlan).asInstanceOf[TRANSFORM_UNSUPPORTED].reason
assert(reason.isDefined)
val reason = FallbackTags.get(newPlan).reason()
if (BackendsApiManager.getSettings.fallbackOnEmptySchema(newPlan)) {
assert(
reason.get.contains("fake reason") &&
reason.get.contains("at least one of its children has empty output"))
reason.contains("fake reason") &&
reason.contains("at least one of its children has empty output"))
} else {
assert(reason.get.contains("fake reason"))
assert(reason.contains("fake reason"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ case class CustomerColumnarPreRules(session: SparkSession) extends Rule[SparkPla
fileSourceScan.tableIdentifier,
fileSourceScan.disableBucketedScan
)
if (transformer.doValidate().isValid) {
if (transformer.doValidate().ok()) {
transformer
} else {
plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql.execution
import org.apache.gluten.backendsapi.BackendsApiManager
import org.apache.gluten.execution.BasicScanExecTransformer
import org.apache.gluten.extension.GlutenPlan
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags, TRANSFORM_UNSUPPORTED}
import org.apache.gluten.extension.columnar.{FallbackEmptySchemaRelation, FallbackTags}
import org.apache.gluten.extension.columnar.heuristic.HeuristicApplier
import org.apache.gluten.extension.columnar.transition.InsertTransitions
import org.apache.gluten.utils.QueryPlanSelector
Expand Down Expand Up @@ -125,17 +125,16 @@ class FallbackStrategiesSuite extends GlutenSQLTestsTrait {

testGluten("Tag not transformable more than once") {
val originalPlan = UnaryOp1(LeafOp(supportsColumnar = true))
FallbackTags.tag(originalPlan, TRANSFORM_UNSUPPORTED(Some("fake reason")))
FallbackTags.add(originalPlan, "fake reason")
val rule = FallbackEmptySchemaRelation()
val newPlan = rule.apply(originalPlan)
val reason = FallbackTags.getTag(newPlan).asInstanceOf[TRANSFORM_UNSUPPORTED].reason
assert(reason.isDefined)
val reason = FallbackTags.get(newPlan).reason()
if (BackendsApiManager.getSettings.fallbackOnEmptySchema(newPlan)) {
assert(
reason.get.contains("fake reason") &&
reason.get.contains("at least one of its children has empty output"))
reason.contains("fake reason") &&
reason.contains("at least one of its children has empty output"))
} else {
assert(reason.get.contains("fake reason"))
assert(reason.contains("fake reason"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ case class CustomerColumnarPreRules(session: SparkSession) extends Rule[SparkPla
fileSourceScan.tableIdentifier,
fileSourceScan.disableBucketedScan
)
if (transformer.doValidate().isValid) {
if (transformer.doValidate().ok()) {
transformer
} else {
plan
Expand Down

0 comments on commit cfe3217

Please sign in to comment.