Skip to content
Open
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 @@ -742,7 +742,9 @@ class VeloxTestSettings extends BackendTestSettings {
enableSuite[GlutenSQLFunctionSuite]
enableSuite[GlutenSQLJsonProtocolSuite]
enableSuite[GlutenShufflePartitionsUtilSuite]
// TODO: 4.x enableSuite[GlutenSimpleSQLViewSuite] // 1 failure
enableSuite[GlutenSimpleSQLViewSuite]
// Velox returns a native FILE_NOT_FOUND error instead of Spark's structured error condition.
.exclude("alter temporary view should follow current storeAnalyzedPlanForView config")
enableSuite[GlutenSparkPlanSuite]
.exclude("SPARK-37779: ColumnarToRowExec should be canonicalizable after being (de)serialized")
enableSuite[GlutenSparkPlannerSuite]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,45 @@
*/
package org.apache.spark.sql.execution

import org.apache.spark.sql.GlutenSQLTestsTrait
import org.apache.spark.SparkException
import org.apache.spark.sql.{GlutenSQLTestsTrait, Row}
import org.apache.spark.sql.internal.SQLConf.STORE_ANALYZED_PLAN_FOR_VIEW

class GlutenSimpleSQLViewSuite extends SimpleSQLViewSuite with GlutenSQLTestsTrait {}
class GlutenSimpleSQLViewSuite extends SimpleSQLViewSuite with GlutenSQLTestsTrait {
import testImplicits._

private def assertMissingFileError(f: => Unit): Unit = {
val exception = intercept[SparkException](f)
val messages = Iterator
.iterate[Throwable](exception)(_.getCause)
.takeWhile(_ != null)
.flatMap(e => Option(e.getMessage))

assert(messages.exists(_.contains("FILE_NOT_FOUND")))
}
Comment on lines +26 to +34

testGluten("alter temporary view should follow current storeAnalyzedPlanForView config") {
withTable("t") {
Seq(2, 3, 1).toDF("c1").write.format("parquet").saveAsTable("t")
withView("v1") {
withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "true") {
sql("CREATE TEMPORARY VIEW v1 AS SELECT * FROM t")
Seq(4, 6, 5).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
assertMissingFileError(sql("SELECT * FROM v1").collect())
}

withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "false") {
sql("ALTER VIEW v1 AS SELECT * FROM t")
Seq(1, 3, 5).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
checkAnswer(sql("SELECT * FROM v1"), Seq(Row(1), Row(3), Row(5)))
}

withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "true") {
sql("ALTER VIEW v1 AS SELECT * FROM t")
Seq(2, 4, 6).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
assertMissingFileError(sql("SELECT * FROM v1").collect())
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,9 @@ class VeloxTestSettings extends BackendTestSettings {
enableSuite[GlutenSQLFunctionSuite]
enableSuite[GlutenSQLJsonProtocolSuite]
enableSuite[GlutenShufflePartitionsUtilSuite]
// TODO: 4.x enableSuite[GlutenSimpleSQLViewSuite] // 1 failure remains after GLUTEN-11917 fix
enableSuite[GlutenSimpleSQLViewSuite]
// Velox returns a native FILE_NOT_FOUND error instead of Spark's structured error condition.
.exclude("alter temporary view should follow current storeAnalyzedPlanForView config")
enableSuite[GlutenSparkPlanSuite]
.exclude("SPARK-37779: ColumnarToRowExec should be canonicalizable after being (de)serialized")
enableSuite[GlutenSparkPlannerSuite]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,45 @@
*/
package org.apache.spark.sql.execution

import org.apache.spark.sql.GlutenSQLTestsTrait
import org.apache.spark.SparkException
import org.apache.spark.sql.{GlutenSQLTestsTrait, Row}
import org.apache.spark.sql.internal.SQLConf.STORE_ANALYZED_PLAN_FOR_VIEW

class GlutenSimpleSQLViewSuite extends SimpleSQLViewSuite with GlutenSQLTestsTrait {}
class GlutenSimpleSQLViewSuite extends SimpleSQLViewSuite with GlutenSQLTestsTrait {
import testImplicits._

private def assertMissingFileError(f: => Unit): Unit = {
val exception = intercept[SparkException](f)
val messages = Iterator
.iterate[Throwable](exception)(_.getCause)
.takeWhile(_ != null)
.flatMap(e => Option(e.getMessage))

assert(messages.exists(_.contains("FILE_NOT_FOUND")))
}
Comment on lines +26 to +34

testGluten("alter temporary view should follow current storeAnalyzedPlanForView config") {
withTable("t") {
Seq(2, 3, 1).toDF("c1").write.format("parquet").saveAsTable("t")
withView("v1") {
withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "true") {
sql("CREATE TEMPORARY VIEW v1 AS SELECT * FROM t")
Seq(4, 6, 5).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
assertMissingFileError(sql("SELECT * FROM v1").collect())
}

withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "false") {
sql("ALTER VIEW v1 AS SELECT * FROM t")
Seq(1, 3, 5).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
checkAnswer(sql("SELECT * FROM v1"), Seq(Row(1), Row(3), Row(5)))
}

withSQLConf(STORE_ANALYZED_PLAN_FOR_VIEW.key -> "true") {
sql("ALTER VIEW v1 AS SELECT * FROM t")
Seq(2, 4, 6).toDF("c1").write.mode("overwrite").format("parquet").saveAsTable("t")
assertMissingFileError(sql("SELECT * FROM v1").collect())
}
}
}
}
}
Loading