Skip to content

Commit

Permalink
[GLUTEN-7690][CORE][CH][VL] GlutenConfig should support runtime confi…
Browse files Browse the repository at this point in the history
…guration changes
  • Loading branch information
beliefer committed Nov 6, 2024
1 parent 4fecd1d commit fcb53a1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions shims/common/src/main/scala/org/apache/gluten/GlutenConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.apache.gluten

import org.apache.spark.internal.Logging
import org.apache.spark.network.util.ByteUnit
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.internal.SQLConf

import com.google.common.collect.ImmutableList
Expand All @@ -34,9 +35,13 @@ case class GlutenNumaBindingInfo(
totalCoreRange: Array[String] = null,
numCoresPerExecutor: Int = -1) {}

class GlutenConfig(conf: SQLConf) extends Logging {
class GlutenConfig(sessionOpt: Option[SparkSession] = None) extends Logging {
import GlutenConfig._

def this(spark: SparkSession) = this(Some(spark))

def conf: SQLConf = sessionOpt.map(_.sessionState.conf).getOrElse(SQLConf.get)

def enableAnsiMode: Boolean = conf.ansiEnabled

def enableGluten: Boolean = conf.getConf(GLUTEN_ENABLED)
Expand Down Expand Up @@ -648,9 +653,7 @@ object GlutenConfig {

var ins: GlutenConfig = _

def getConf: GlutenConfig = {
new GlutenConfig(SQLConf.get)
}
def getConf: GlutenConfig = new GlutenConfig()

@deprecated
def getTempFile: String = synchronized {
Expand Down

0 comments on commit fcb53a1

Please sign in to comment.