Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update ver + support deprecated config
  • Loading branch information
vicennial committed Nov 16, 2023
commit 33f72016a654c43ec49592dd02f60dfd9cf20a39
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit

import org.apache.spark.network.util.ByteUnit
import org.apache.spark.sql.connect.common.config.ConnectCommon
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.SQLConf.buildConf

object Connect {
Expand Down Expand Up @@ -213,6 +214,17 @@ object Connect {
.intConf
.createWithDefault(200)

val CONNECT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL =
buildStaticConf("spark.connect.copyFromLocalToFs.allowDestLocal")
.internal()
.doc(s"""
|(Deprecated since Spark 4.0, please set
|'${SQLConf.ARTIFACT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL.key}' instead.
|""".stripMargin)
.version("3.5.0")
.booleanConf
.createWithDefault(false)

val CONNECT_UI_SESSION_LIMIT = buildStaticConf("spark.sql.connect.ui.retainedSessions")
.doc("The number of client sessions kept in the Spark Connect UI history.")
.version("3.5.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4550,6 +4550,9 @@ object SQLConf {
.booleanConf
.createWithDefault(false)

// Deprecate "spark.connect.copyFromLocalToFs.allowDestLocal" in favor of this config. This is
// currently optional because we don't want to break existing users who are using the old config.
// If this config is set, then we override the deprecated config.
val ARTIFACT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL =
buildConf("spark.sql.artifact.copyFromLocalToFs.allowDestLocal")
.internal()
Expand All @@ -4562,7 +4565,7 @@ object SQLConf {
|""".stripMargin)
.version("4.0.0")
.booleanConf
.createWithDefault(false)
.createOptional

val LEGACY_RETAIN_FRACTION_DIGITS_FIRST =
buildConf("spark.sql.legacy.decimal.retainFractionDigitsOnTruncate")
Expand Down Expand Up @@ -4631,7 +4634,9 @@ object SQLConf {
DeprecatedConfig(COALESCE_PARTITIONS_MIN_PARTITION_NUM.key, "3.2",
s"Use '${COALESCE_PARTITIONS_MIN_PARTITION_SIZE.key}' instead."),
DeprecatedConfig(ESCAPED_STRING_LITERALS.key, "4.0",
"Use raw string literals with the `r` prefix instead. ")
"Use raw string literals with the `r` prefix instead. "),
DeprecatedConfig("spark.connect.copyFromLocalToFs.allowDestLocal", "4.0",
s"Use '${ARTIFACT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL.key}' instead.")
)

Map(configs.map { cfg => cfg.key -> cfg } : _*)
Expand Down Expand Up @@ -5460,8 +5465,6 @@ class SQLConf extends Serializable with Logging with SqlApiConf {
def legacyRaiseErrorWithoutErrorClass: Boolean =
getConf(SQLConf.LEGACY_RAISE_ERROR_WITHOUT_ERROR_CLASS)

def allowDestLocalFs: Boolean = getConf(ARTIFACT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL)

/** ********************** SQLConf functionality methods ************ */

/** Set Spark SQL configuration properties. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class SparkSession private(
* Returns an `ArtifactManager` that supports adding, managing and using session-scoped artifacts
* (jars, classfiles, etc).
*
* @since 3.5.1
* @since 4.0.0
*/
@Experimental
@Unstable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ class ArtifactManager(session: SparkSession) extends Logging {
if (fs.isInstanceOf[LocalFileSystem]) {
val allowDestLocalConf =
session.conf.get(SQLConf.ARTIFACT_COPY_FROM_LOCAL_TO_FS_ALLOW_DEST_LOCAL)
.getOrElse(
session.conf.get("spark.connect.copyFromLocalToFs.allowDestLocal").contains("true"))

if (!allowDestLocalConf) {
// To avoid security issue, by default,
Expand Down