diff --git a/core/src/main/resources/filodb-defaults.conf b/core/src/main/resources/filodb-defaults.conf index 27032f5d68..565c21ddd2 100644 --- a/core/src/main/resources/filodb-defaults.conf +++ b/core/src/main/resources/filodb-defaults.conf @@ -610,6 +610,9 @@ filodb { # These labels will be dropped from every exported row. drop-labels = ["_ws_", "drop-label1"] + # default label value to export when an expected dynamic column does not exist + default-dynamic-column-value = "none" + # Each row's labels are compared against all rule-group keys. If a match is found, # the row's labels are compared *sequentially* against each of the group's rules until # a rule meets both of the following criteria: diff --git a/spark-jobs/src/main/scala/filodb/downsampler/chunk/BatchExporter.scala b/spark-jobs/src/main/scala/filodb/downsampler/chunk/BatchExporter.scala index faa37adde8..b16c288a1a 100644 --- a/spark-jobs/src/main/scala/filodb/downsampler/chunk/BatchExporter.scala +++ b/spark-jobs/src/main/scala/filodb/downsampler/chunk/BatchExporter.scala @@ -161,7 +161,7 @@ case class BatchExporter(downsamplerSettings: DownsamplerSettings, userStartTime // append all dynamic column values exportTableConfig.labelColumnMapping.foreach { pair => val labelValue = exportData.labels.get(pair._1) - dataSeq.append(labelValue.getOrElse("")) + dataSeq.append(labelValue.getOrElse(downsamplerSettings.exportDefaultDynamicColumnValue)) } // append all fixed column values dataSeq.append( diff --git a/spark-jobs/src/main/scala/filodb/downsampler/chunk/DownsamplerSettings.scala b/spark-jobs/src/main/scala/filodb/downsampler/chunk/DownsamplerSettings.scala index dcc8cdddab..aec6bf1d83 100644 --- a/spark-jobs/src/main/scala/filodb/downsampler/chunk/DownsamplerSettings.scala +++ b/spark-jobs/src/main/scala/filodb/downsampler/chunk/DownsamplerSettings.scala @@ -86,6 +86,9 @@ class DownsamplerSettings(conf: Config = ConfigFactory.empty()) extends Serializ @transient lazy val exportDropLabels = downsamplerConfig.as[Seq[String]]("data-export.drop-labels") + @transient lazy val exportDefaultDynamicColumnValue = + downsamplerConfig.as[String]("data-export.default-dynamic-column-value") + @transient lazy val exportKeyToRules = { val keyRulesPairs = downsamplerConfig.as[Seq[Config]]("data-export.groups").map { group => val key = group.as[Seq[String]]("key")