wzx140 commented on code in PR #7003: URL: https://github.com/apache/hudi/pull/7003#discussion_r1029472039
########## hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/HoodieSparkSqlTestBase.scala: ########## @@ -170,4 +174,44 @@ class HoodieSparkSqlTestBase extends FunSuite with BeforeAndAfterAll { val fs = FSUtils.getFs(filePath, spark.sparkContext.hadoopConfiguration) fs.exists(path) } + + protected def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = { + val conf = spark.sessionState.conf + val currentValues = pairs.unzip._1.map { k => + if (conf.contains(k)) { + Some(conf.getConfString(k)) + } else None + } + pairs.foreach { case(k, v) => conf.setConfString(k, v) } + try f finally { + pairs.unzip._1.zip(currentValues).foreach { + case (key, Some(value)) => conf.setConfString(key, value) + case (key, None) => conf.unsetConf(key) + } + } + } + + protected def withRecordType(recordConfig: Map[HoodieRecordType, Map[String, String]]=Map.empty)(f: => Unit) { + Seq(HoodieRecordType.AVRO, HoodieRecordType.SPARK).foreach { recordType => + val (merger, format) = recordType match { + case HoodieRecordType.SPARK => (classOf[HoodieSparkRecordMerger].getName, "parquet") + case _ => (classOf[HoodieAvroRecordMerger].getName, "avro") Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org