17
17
18
18
package com .datasqrl ;
19
19
20
+ import java .io .File ;
21
+ import java .util .*;
22
+ import java .util .concurrent .Callable ;
20
23
import lombok .SneakyThrows ;
21
24
import lombok .extern .slf4j .Slf4j ;
22
25
import org .apache .flink .configuration .Configuration ;
23
26
import org .apache .flink .configuration .GlobalConfiguration ;
24
27
import org .apache .flink .shaded .jackson2 .com .fasterxml .jackson .databind .ObjectMapper ;
25
28
import org .apache .flink .shaded .jackson2 .com .fasterxml .jackson .databind .module .SimpleModule ;
26
- import org .apache .flink .table .api .CompiledPlan ;
27
29
import org .apache .flink .table .api .TableResult ;
28
- import org .apache .flink .table .api .internal .TableEnvironmentImpl ;
29
- import org .apache .flink .table .operations .StatementSetOperation ;
30
30
import org .apache .flink .util .FileUtils ;
31
31
import picocli .CommandLine ;
32
32
import picocli .CommandLine .*;
33
- import java .io .File ;
34
- import java .util .*;
35
- import java .util .concurrent .Callable ;
36
33
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." )
41
40
@ Slf4j
42
41
public class SqlRunner implements Callable <Integer > {
43
42
44
- @ Option (names = {"-s" , "--sqlfile" }, description = "SQL file to execute." )
43
+ @ Option (
44
+ names = {"-s" , "--sqlfile" },
45
+ description = "SQL file to execute." )
45
46
private File sqlFile ;
46
47
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" )
49
52
private boolean block ;
50
53
51
- @ Option (names = {"--planfile" }, description = "Compiled plan JSON file." )
54
+ @ Option (
55
+ names = {"--planfile" },
56
+ description = "Compiled plan JSON file." )
52
57
private File planFile ;
53
58
54
- @ Option (names = {"--configfile" }, description = "Configuration YAML file." )
59
+ @ Option (
60
+ names = {"--configfile" },
61
+ description = "Configuration YAML file." )
55
62
private File configFile ;
56
63
57
- @ Option (names = {"--udfpath" }, description = "Path to UDFs." )
64
+ @ Option (
65
+ names = {"--udfpath" },
66
+ description = "Path to UDFs." )
58
67
private String udfPath ;
59
68
60
69
public static void main (String [] args ) {
@@ -110,7 +119,6 @@ private String replaceScriptWithEnv(String script) {
110
119
return objectMapper .writeValueAsString (map );
111
120
}
112
121
113
-
114
122
public static ObjectMapper getObjectMapper () {
115
123
ObjectMapper objectMapper = new ObjectMapper ();
116
124
@@ -130,7 +138,8 @@ public static ObjectMapper getObjectMapper() {
130
138
*/
131
139
private Configuration loadConfigurationFromYaml (File configFile ) throws Exception {
132
140
log .info ("Loading configuration from {}" , configFile .getAbsolutePath ());
133
- Configuration configuration = GlobalConfiguration .loadConfiguration (configFile .getAbsolutePath ());
141
+ Configuration configuration =
142
+ GlobalConfiguration .loadConfiguration (configFile .getAbsolutePath ());
134
143
return configuration ;
135
144
}
136
- }
145
+ }
0 commit comments