2222import com .dtstack .flink .sql .config .CalciteConfig ;
2323import com .dtstack .flink .sql .enums .ClusterMode ;
2424import com .dtstack .flink .sql .enums .ECacheType ;
25+ import com .dtstack .flink .sql .enums .EPluginLoadMode ;
2526import com .dtstack .flink .sql .environment .MyLocalStreamEnvironment ;
2627import com .dtstack .flink .sql .environment .StreamEnvConfigManager ;
2728import com .dtstack .flink .sql .function .FunctionManager ;
4344import com .dtstack .flink .sql .util .PluginUtil ;
4445import com .dtstack .flink .sql .watermarker .WaterMarkerAssigner ;
4546import com .fasterxml .jackson .databind .ObjectMapper ;
47+ import com .google .common .base .Preconditions ;
4648import com .google .common .base .Strings ;
4749import com .google .common .collect .Lists ;
4850import com .google .common .collect .Maps ;
4951import com .google .common .collect .Sets ;
5052import org .apache .calcite .sql .SqlInsert ;
5153import org .apache .calcite .sql .SqlNode ;
5254import org .apache .commons .io .Charsets ;
55+ import org .apache .commons .lang3 .StringUtils ;
5356import org .apache .flink .api .common .typeinfo .TypeInformation ;
5457import org .apache .flink .api .java .tuple .Tuple2 ;
5558import org .apache .flink .api .java .typeutils .RowTypeInfo ;
@@ -106,6 +109,8 @@ public static ParamsInfo parseParams(String[] args) throws Exception {
106109 String pluginLoadMode = options .getPluginLoadMode ();
107110 String deployMode = options .getMode ();
108111
112+ Preconditions .checkArgument (checkRemoteSqlPluginPath (remoteSqlPluginPath , deployMode , pluginLoadMode ),
113+ "Non-local mode or shipfile deployment mode, remoteSqlPluginPath is required" );
109114 String confProp = URLDecoder .decode (options .getConfProp (), Charsets .UTF_8 .toString ());
110115 Properties confProperties = PluginUtil .jsonStrToObject (confProp , Properties .class );
111116
@@ -124,6 +129,22 @@ public static ParamsInfo parseParams(String[] args) throws Exception {
124129
125130 }
126131
132+ /**
133+ * 非local模式或者shipfile部署模式,remoteSqlPluginPath必填
134+ * @param remoteSqlPluginPath
135+ * @param deployMode
136+ * @param pluginLoadMode
137+ * @return
138+ */
139+ public static boolean checkRemoteSqlPluginPath (String remoteSqlPluginPath , String deployMode , String pluginLoadMode ) {
140+ if (StringUtils .isEmpty (remoteSqlPluginPath )) {
141+ return StringUtils .equalsIgnoreCase (pluginLoadMode , EPluginLoadMode .SHIPFILE .name ())
142+ || StringUtils .equalsIgnoreCase (deployMode , ClusterMode .local .name ());
143+ }
144+ return true ;
145+ }
146+
147+
127148 public static StreamExecutionEnvironment getStreamExecution (ParamsInfo paramsInfo ) throws Exception {
128149 StreamExecutionEnvironment env = ExecuteProcessHelper .getStreamExeEnv (paramsInfo .getConfProp (), paramsInfo .getDeployMode ());
129150 StreamTableEnvironment tableEnv = StreamTableEnvironment .create (env );
0 commit comments