Source:
<code>public static Config computeSamzaConfigs(Boolean localRunner, Config config) { Map<String, String> newConfig = new HashMap<>(); <START> DslConverterFactory dslConverterFactory = new SamzaSqlDslConverterFactory(); <END> DslConverter dslConverter = dslConverterFactory.create(config); List<String> dslStmts = SamzaSqlDslConverter.fetchSqlFromConfig(config); Collection<RelRoot> relRoots = dslConverter.convertDsl(String.join("\n", dslStmts)); Set<String> inputSystemStreams = new HashSet<>(); Set<String> outputSystemStreams = new HashSet<>(); for (RelRoot relRoot : relRoots) { SamzaSqlApplicationConfig.populateSystemStreams(relRoot.project(), inputSystemStreams, outputSystemStreams); } SqlIOResolver ioResolver = SamzaSqlApplicationConfig.createIOResolver(config); String sqlJson = SamzaSqlApplicationConfig.serializeSqlStmts(dslStmts); newConfig.put(SamzaSqlApplicationConfig.CFG_SQL_STMTS_JSON, sqlJson); for (String source : inputSystemStreams) { SqlIOConfig inputSystemStreamConfig = ioResolver.fetchSourceInfo(source); newConfig.put(String.format(CFG_FMT_SAMZA_STREAM_SYSTEM, inputSystemStreamConfig.getStreamName()), inputSystemStreamConfig.getSystemName()); newConfig.putAll(inputSystemStreamConfig.getConfig()); } for (String sink : outputSystemStreams) { SqlIOConfig outputSystemStreamConfig = ioResolver.fetchSinkInfo(sink); newConfig.put(String.format(CFG_FMT_SAMZA_STREAM_SYSTEM, outputSystemStreamConfig.getStreamName()), outputSystemStreamConfig.getSystemName()); newConfig.putAll(outputSystemStreamConfig.getConfig()); } newConfig.putAll(config); if (localRunner) { newConfig.put(RUNNER_CONFIG, LocalApplicationRunner.class.getName()); } else { newConfig.put(RUNNER_CONFIG, RemoteApplicationRunner.class.getName()); } LOG.info("New Samza configs: " + newConfig); return new MapConfig(newConfig); }</code><technical_language>creating DslConverter in this places right? SamzaSQLApplication SamzaSQLApplicationRunner. Is a refactor in a create reuse them</technical_language>

Target:
public static Config computeSamzaConfigs(Boolean localRunner, Config config) { Map<String, String> newConfig = new HashMap<>(); List<String> dslStmts = SamzaSqlDslConverter.fetchSqlFromConfig(config); String sqlJson = SamzaSqlApplicationConfig.serializeSqlStmts(dslStmts); newConfig.put(SamzaSqlApplicationConfig.CFG_SQL_STMTS_JSON, sqlJson); Set<String> inputSystemStreams = new HashSet<>(); Set<String> outputSystemStreams = new HashSet<>(); SamzaSqlApplicationConfig.populateSystemStreamsAndGetRelRoots(dslStmts, config, inputSystemStreams, outputSystemStreams); SqlIOResolver ioResolver = SamzaSqlApplicationConfig.createIOResolver(config); for (String source : inputSystemStreams) { SqlIOConfig inputSystemStreamConfig = ioResolver.fetchSourceInfo(source); newConfig.put(String.format(CFG_FMT_SAMZA_STREAM_SYSTEM, inputSystemStreamConfig.getStreamName()), inputSystemStreamConfig.getSystemName()); newConfig.putAll(inputSystemStreamConfig.getConfig()); } for (String sink : outputSystemStreams) { SqlIOConfig outputSystemStreamConfig = ioResolver.fetchSinkInfo(sink); newConfig.put(String.format(CFG_FMT_SAMZA_STREAM_SYSTEM, outputSystemStreamConfig.getStreamName()), outputSystemStreamConfig.getSystemName()); newConfig.putAll(outputSystemStreamConfig.getConfig()); } newConfig.putAll(config); if (localRunner) { newConfig.put(RUNNER_CONFIG, LocalApplicationRunner.class.getName()); } else { newConfig.put(RUNNER_CONFIG, RemoteApplicationRunner.class.getName()); } LOG.info("New Samza configs: " + newConfig); return new MapConfig(newConfig); }