Skip to content

Commit

Permalink
add ResolveEncodersInScalaAgg rule to TestHive
Browse files Browse the repository at this point in the history
  • Loading branch information
erikerlandson committed Jul 5, 2020
1 parent a8dd23d commit bc2d880
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.internal.Logging
import org.apache.spark.internal.config
import org.apache.spark.internal.config.UI._
import org.apache.spark.sql.{DataFrame, Dataset, SparkSession, SQLContext}
import org.apache.spark.sql.{DataFrame, Dataset, SparkSession, SparkSessionExtensions, SQLContext}
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation
import org.apache.spark.sql.catalyst.catalog.ExternalCatalogWithListener
import org.apache.spark.sql.catalyst.optimizer.ConvertToLocalRelation
Expand All @@ -46,9 +46,19 @@ import org.apache.spark.sql.execution.command.CacheTableCommand
import org.apache.spark.sql.hive._
import org.apache.spark.sql.hive.client.HiveClient
import org.apache.spark.sql.internal.{SessionState, SharedState, SQLConf, WithTestConf}
import org.apache.spark.sql.internal.StaticSQLConf.{CATALOG_IMPLEMENTATION, WAREHOUSE_PATH}
import org.apache.spark.sql.internal.StaticSQLConf.{CATALOG_IMPLEMENTATION, SPARK_SESSION_EXTENSIONS, WAREHOUSE_PATH}
import org.apache.spark.util.{ShutdownHookManager, Utils}

class TestHiveExtensions extends (SparkSessionExtensions => Unit) {
import org.apache.spark.sql.execution.aggregate.ResolveEncodersInScalaAgg

def apply(e: SparkSessionExtensions): Unit = {
e.injectResolutionRule { session =>
new ResolveEncodersInScalaAgg() // SPARK-32159
}
}
}

// SPARK-3729: Test key required to check for initialization errors with config.
object TestHive
extends TestHiveContext(
Expand All @@ -61,6 +71,7 @@ object TestHive
.set(HiveUtils.HIVE_METASTORE_BARRIER_PREFIXES.key,
"org.apache.spark.sql.hive.execution.PairSerDe")
.set(WAREHOUSE_PATH.key, TestHiveContext.makeWarehouseDir().toURI.getPath)
.set(SPARK_SESSION_EXTENSIONS.key, classOf[TestHiveExtensions].getCanonicalName)
// SPARK-8910
.set(UI_ENABLED, false)
.set(config.UNSAFE_EXCEPTION_ON_MEMORY_LEAK, true)
Expand Down

0 comments on commit bc2d880

Please sign in to comment.