1717
1818package com .datasqrl ;
1919
20+ import java .io .File ;
21+ import java .util .*;
22+ import java .util .concurrent .Callable ;
2023import lombok .SneakyThrows ;
2124import lombok .extern .slf4j .Slf4j ;
2225import org .apache .flink .configuration .Configuration ;
2326import org .apache .flink .configuration .GlobalConfiguration ;
2427import org .apache .flink .shaded .jackson2 .com .fasterxml .jackson .databind .ObjectMapper ;
2528import org .apache .flink .shaded .jackson2 .com .fasterxml .jackson .databind .module .SimpleModule ;
26- import org .apache .flink .table .api .CompiledPlan ;
2729import org .apache .flink .table .api .TableResult ;
28- import org .apache .flink .table .api .internal .TableEnvironmentImpl ;
29- import org .apache .flink .table .operations .StatementSetOperation ;
3030import org .apache .flink .util .FileUtils ;
3131import picocli .CommandLine ;
3232import picocli .CommandLine .*;
33- import java .io .File ;
34- import java .util .*;
35- import java .util .concurrent .Callable ;
3633
37- /**
38- * Main class for executing SQL scripts using picocli.
39- */
40- @ Command (name = "SqlRunner" , mixinStandardHelpOptions = true , version = "1.0" , description = "Runs SQL scripts using Flink TableEnvironment." )
34+ /** Main class for executing SQL scripts using picocli. */
35+ @ Command (
36+ name = "SqlRunner" ,
37+ mixinStandardHelpOptions = true ,
38+ version = "1.0" ,
39+ description = "Runs SQL scripts using Flink TableEnvironment." )
4140@ Slf4j
4241public class SqlRunner implements Callable <Integer > {
4342
44- @ Option (names = {"-s" , "--sqlfile" }, description = "SQL file to execute." )
43+ @ Option (
44+ names = {"-s" , "--sqlfile" },
45+ description = "SQL file to execute." )
4546 private File sqlFile ;
4647
47- @ Option (names = {"--block" }, description = "Wait for the flink job manager to exit." ,
48- defaultValue = "false" )
48+ @ Option (
49+ names = {"--block" },
50+ description = "Wait for the flink job manager to exit." ,
51+ defaultValue = "false" )
4952 private boolean block ;
5053
51- @ Option (names = {"--planfile" }, description = "Compiled plan JSON file." )
54+ @ Option (
55+ names = {"--planfile" },
56+ description = "Compiled plan JSON file." )
5257 private File planFile ;
5358
54- @ Option (names = {"--configfile" }, description = "Configuration YAML file." )
59+ @ Option (
60+ names = {"--configfile" },
61+ description = "Configuration YAML file." )
5562 private File configFile ;
5663
57- @ Option (names = {"--udfpath" }, description = "Path to UDFs." )
64+ @ Option (
65+ names = {"--udfpath" },
66+ description = "Path to UDFs." )
5867 private String udfPath ;
5968
6069 public static void main (String [] args ) {
@@ -110,7 +119,6 @@ private String replaceScriptWithEnv(String script) {
110119 return objectMapper .writeValueAsString (map );
111120 }
112121
113-
114122 public static ObjectMapper getObjectMapper () {
115123 ObjectMapper objectMapper = new ObjectMapper ();
116124
@@ -130,7 +138,8 @@ public static ObjectMapper getObjectMapper() {
130138 */
131139 private Configuration loadConfigurationFromYaml (File configFile ) throws Exception {
132140 log .info ("Loading configuration from {}" , configFile .getAbsolutePath ());
133- Configuration configuration = GlobalConfiguration .loadConfiguration (configFile .getAbsolutePath ());
141+ Configuration configuration =
142+ GlobalConfiguration .loadConfiguration (configFile .getAbsolutePath ());
134143 return configuration ;
135144 }
136- }
145+ }
0 commit comments