Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,25 @@ class SparkSqlExecutor(
sparkEngineSession: SparkEngineSession,
code: String
): Option[SparkSqlMeasure] = {
val sparkMeasureType = engineExecutionContext.getProperties
.getOrDefault(SparkConfiguration.SPARKMEASURE_AGGREGATE_TYPE, "")
.toString

if (sparkMeasureType.nonEmpty) {
val outputPrefix = SparkConfiguration.SPARKMEASURE_OUTPUT_PREFIX.getValue(options)
val outputPath = FsPath.getFsPath(
outputPrefix,
LabelUtil.getUserCreator(engineExecutionContext.getLabels.toList.asJava)._1,
sparkMeasureType,
JobUtils.getJobIdFromMap(engineExecutionContext.getProperties),
new Date().getTime.toString
)
Some(new SparkSqlMeasure(sparkEngineSession.sparkSession, code, sparkMeasureType, outputPath))
} else {
None
}
Option(engineExecutionContext.getProperties.get(SparkConfiguration.SPARKMEASURE_AGGREGATE_TYPE))
.map(_.toString)
.flatMap { sparkMeasureType =>
val userName = LabelUtil.getUserCreator(engineExecutionContext.getLabels.toList.asJava)._1
val outputPrefix = SparkConfiguration.SPARKMEASURE_OUTPUT_PREFIX.getValue(options)
val timestamp = System.currentTimeMillis().toString

val outputPath = FsPath.getFsPath(
outputPrefix,
userName,
sparkMeasureType,
JobUtils.getJobIdFromMap(engineExecutionContext.getProperties),
timestamp
)

Some(
new SparkSqlMeasure(sparkEngineSession.sparkSession, code, sparkMeasureType, outputPath)
)
}
}

override protected def getExecutorIdPreFix: String = "SparkSqlExecutor_"
Expand Down
Loading