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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import java.nio.channels.Channels
import org.apache.spark.api.java.JavaRDD
import org.apache.spark.api.python.PythonRDDServer
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{DataFrame, Dataset, SQLContext}
import org.apache.spark.sql.{DataFrame, SQLContext}
import org.apache.spark.sql.catalyst.analysis.FunctionRegistry
import org.apache.spark.sql.catalyst.expressions.ExpressionInfo
import org.apache.spark.sql.catalyst.parser.CatalystSqlParser
Expand All @@ -42,6 +42,8 @@ private[sql] object PythonSQLUtils {

def listSQLConfigs(): Array[(String, String, String, String)] = {
val conf = new SQLConf()
// Force to build StaticSQLConf, which is a little bit hacky here
conf.warehousePath
// Py4J doesn't seem to translate Seq well, so we convert to an Array.
conf.getAllDefinedConfs.toArray
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark.sql.api.python

import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.internal.{SQLConf, StaticSQLConf}

class PythonSQLUtilsSuite extends SparkFunSuite {

test("list sql configurations should include all public one") {
val configs = PythonSQLUtils.listSQLConfigs()

// static sql configurations
assert(configs.exists(entry => entry._1 == StaticSQLConf.SPARK_SESSION_EXTENSIONS.key),
"listSQLConfigs should contain public static sql configuration")
assert(!configs.exists(entry => entry._1 == StaticSQLConf.DEBUG_MODE.key),
"listSQLConfigs should not contain internal static sql configuration")

// dynamic sql configurations
assert(configs.exists(entry => entry._1 == SQLConf.DYNAMIC_PARTITION_PRUNING_ENABLED.key),
"listSQLConfigs should contain public dynamic sql configuration")
assert(!configs.exists(entry => entry._1 == SQLConf.ANALYZER_MAX_ITERATIONS.key),
"listSQLConfigs should not contain internal dynamic sql configuration")

// spark core configurations
assert(!configs.exists(entry => entry._1 == "spark.master"),
"listSQLConfigs should not contain internal dynamic sql configuration")
}
}