@@ -21,7 +21,8 @@ import org.apache.hadoop.fs.Path
2121import org .apache .spark .sql .functions .lit
2222import org .apache .spark .sql .{DataFrame , SparkSession }
2323import org .slf4j .LoggerFactory
24- import za .co .absa .pramen .api .{ExternalChannelFactory , MetastoreReader , Sink , SinkResult }
24+ import za .co .absa .pramen .api .{ExternalChannelFactoryV2 , MetastoreReader , Sink , SinkResult }
25+ import za .co .absa .pramen .core .config .Keys .NEVER_REPAIR_PARTITIONS
2526import za .co .absa .pramen .core .utils .ConfigUtils
2627import za .co .absa .pramen .core .utils .hive .HiveQueryTemplates .TEMPLATES_DEFAULT_PREFIX
2728import za .co .absa .pramen .core .utils .hive ._
@@ -149,7 +150,8 @@ import scala.util.{Failure, Success, Try}
149150 */
150151class EnceladusSink (sinkConfig : Config ,
151152 enceladusConfig : EnceladusConfig ,
152- hiveHelper : HiveHelper ) extends Sink {
153+ hiveHelper : HiveHelper ,
154+ neverRepairPartitions : Boolean ) extends Sink {
153155
154156 import za .co .absa .pramen .extras .sink .EnceladusSink ._
155157
@@ -449,7 +451,7 @@ class EnceladusSink(sinkConfig: Config,
449451
450452 val schema = dfForHiveSchema.schema
451453
452- hiveHelper.createOrUpdateHiveTable(publishBase, HiveFormat .Parquet , schema, Seq (" enceladus_info_date" , " enceladus_info_version" ), enceladusConfig.hiveDatabase, hiveTable, neverRepairPartitions = false )
454+ hiveHelper.createOrUpdateHiveTable(publishBase, HiveFormat .Parquet , schema, Seq (" enceladus_info_date" , " enceladus_info_version" ), enceladusConfig.hiveDatabase, hiveTable, neverRepairPartitions)
453455 }
454456 }
455457
@@ -486,7 +488,7 @@ class EnceladusSink(sinkConfig: Config,
486488 }
487489}
488490
489- object EnceladusSink extends ExternalChannelFactory [EnceladusSink ] {
491+ object EnceladusSink extends ExternalChannelFactoryV2 [EnceladusSink ] {
490492 val OUTPUT_PATH_KEY = " path"
491493 val INFO_VERSION_KEY = " info.version"
492494 val DATASET_NAME_KEY = " dataset.name"
@@ -500,15 +502,16 @@ object EnceladusSink extends ExternalChannelFactory[EnceladusSink] {
500502
501503 val INFO_VERSION_AUTO_VALUE = " auto"
502504
503- override def apply (conf : Config , parentPath : String , spark : SparkSession ): EnceladusSink = {
505+ override def apply (conf : Config , workflowConfig : Config , parentPath : String , spark : SparkSession ): EnceladusSink = {
504506 val enceladusConfig = EnceladusConfig .fromConfig(conf)
505507 val alwaysEscapeColumnNames = ConfigUtils .getOptionBoolean(conf, HIVE_ALWAYS_ESCAPE_COLUMN_NAMES ).getOrElse(true )
506508
507509 val hiveTemplates = HiveQueryTemplates .fromConfig(ConfigUtils .getOptionConfig(conf, TEMPLATES_DEFAULT_PREFIX ))
508510 val queryExecutor = QueryExecutorSpark (spark)
509511
510512 val hiveHelper = new HiveHelperSql (queryExecutor, hiveTemplates, alwaysEscapeColumnNames)
513+ val neverRepairPartitions = ConfigUtils .getOptionBoolean(workflowConfig, NEVER_REPAIR_PARTITIONS ).getOrElse(false )
511514
512- new EnceladusSink (conf, enceladusConfig, hiveHelper)
515+ new EnceladusSink (conf, enceladusConfig, hiveHelper, neverRepairPartitions )
513516 }
514517}
0 commit comments