Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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 @@ -359,8 +359,18 @@ object ViewHelper {
"spark.sql.shuffle.",
"spark.sql.adaptive.")

private val configAllowList = Seq(
SQLConf.DISABLE_HINTS.key
)

/**
* Capture view config either of:
* 1. exists in allowList
* 2. do not exists in denyList
*/
private def shouldCaptureConfig(key: String): Boolean = {
Comment thread
ulysses-you marked this conversation as resolved.
!configPrefixDenyList.exists(prefix => key.startsWith(prefix))
configAllowList.exists(prefix => key.equals(prefix)) ||
!configPrefixDenyList.exists(prefix => key.startsWith(prefix))
}

import CatalogTable._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.spark.sql.execution

import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
import org.apache.spark.sql.catalyst.plans.logical.Repartition
import org.apache.spark.sql.internal.SQLConf._
import org.apache.spark.sql.test.{SharedSparkSession, SQLTestUtils}

Expand Down Expand Up @@ -278,6 +279,20 @@ abstract class SQLViewTestSuite extends QueryTest with SQLTestUtils {
}
}
}

test("SPARK-34613: Fix view does not capture disable hint config") {
withSQLConf(DISABLE_HINTS.key -> "true") {
withView("v1") {
val viewName = createView("v1", "SELECT /*+ repartition(1) */ 1")
assert(
sql("SELECT * FROM v1").queryExecution.analyzed.collect {
Comment thread
ulysses-you marked this conversation as resolved.
Outdated
case e: Repartition => e
}.isEmpty
)
checkViewOutput(viewName, Seq(Row(1)))
}
}
}
}

class LocalTempViewTestSuite extends SQLViewTestSuite with SharedSparkSession {
Expand Down