Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] load flink-conf bug fixed. #4110

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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 @@ -88,17 +88,26 @@ private[flink] class FlinkStreamingInitializer(args: Array[String], apiType: Api
case file => file
}
val configMap = parseConfig(config)
val properConf = extractConfigByPrefix(configMap, KEY_FLINK_PROPERTY_PREFIX)
val appFlinkConf = extractConfigByPrefix(configMap, KEY_FLINK_PROPERTY_PREFIX)
val appConf = extractConfigByPrefix(configMap, KEY_APP_PREFIX)

// config priority: explicitly specified priority > project profiles > system profiles
val parameter = ParameterTool
.fromSystemProperties()
.mergeWith(ParameterTool.fromMap(properConf))
.mergeWith(ParameterTool.fromMap(appFlinkConf))
.mergeWith(ParameterTool.fromMap(appConf))
.mergeWith(argsMap)

val envConfig = Configuration.fromMap(properConf)
val flinkConf: Map[String, String] = {
parameter.get(KEY_FLINK_CONF(), null) match {
case flinkConf if flinkConf != null =>
PropertiesUtils
.loadFlinkConfYaml(DeflaterUtils.unzipString(flinkConf))
.filter(_._2.nonEmpty)
case _ => Map.empty
}
}
val envConfig = Configuration.fromMap(flinkConf ++ appFlinkConf)
FlinkConfiguration(parameter, envConfig, null)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,32 @@ private[flink] class FlinkTableInitializer(args: Array[String], apiType: ApiType
})

// config priority: explicitly specified priority > project profiles > system profiles
val properConf =
val appFlinkConf =
extractConfigByPrefix(configMap, KEY_FLINK_PROPERTY_PREFIX)
val appConf = extractConfigByPrefix(configMap, KEY_APP_PREFIX)
val tableConf =
extractConfigByPrefix(configMap, KEY_FLINK_TABLE_PREFIX)

val tableConfig = Configuration.fromMap(tableConf)
val envConfig = Configuration.fromMap(properConf)

val parameter = ParameterTool
.fromSystemProperties()
.mergeWith(ParameterTool.fromMap(properConf))
.mergeWith(ParameterTool.fromMap(appFlinkConf))
.mergeWith(ParameterTool.fromMap(tableConf))
.mergeWith(ParameterTool.fromMap(appConf))
.mergeWith(ParameterTool.fromMap(sqlConf))
.mergeWith(argsMap)

val flinkConf: Map[String, String] = {
parameter.get(KEY_FLINK_CONF(), null) match {
case flinkConf if flinkConf != null =>
PropertiesUtils
.loadFlinkConfYaml(DeflaterUtils.unzipString(flinkConf))
.filter(_._2.nonEmpty)
case _ => Map.empty
}
}

val envConfig = Configuration.fromMap(flinkConf ++ appFlinkConf)
val tableConfig = Configuration.fromMap(tableConf)
FlinkConfiguration(parameter, envConfig, tableConfig)
}
}
Expand Down
Loading