@@ -141,34 +141,32 @@ public static DMLOptions parseCLArguments(String[] args)
141
141
String lineageTypes [] = line .getOptionValues ("lineage" );
142
142
if (lineageTypes != null ) {
143
143
for (String lineageType : lineageTypes ) {
144
- if (lineageType != null ){
145
- if (lineageType .equalsIgnoreCase ("dedup" ))
146
- dmlOptions .lineage_dedup = lineageType .equalsIgnoreCase ("dedup" );
147
- else if (lineageType .equalsIgnoreCase ("reuse_full" )
148
- || lineageType .equalsIgnoreCase ("reuse" ))
149
- dmlOptions .linReuseType = ReuseCacheType .REUSE_FULL ;
150
- else if (lineageType .equalsIgnoreCase ("reuse_partial" ))
151
- dmlOptions .linReuseType = ReuseCacheType .REUSE_PARTIAL ;
152
- else if (lineageType .equalsIgnoreCase ("reuse_multilevel" ))
153
- dmlOptions .linReuseType = ReuseCacheType .REUSE_MULTILEVEL ;
154
- else if (lineageType .equalsIgnoreCase ("reuse_hybrid" ))
155
- dmlOptions .linReuseType = ReuseCacheType .REUSE_HYBRID ;
156
- else if (lineageType .equalsIgnoreCase ("none" ))
157
- dmlOptions .linReuseType = ReuseCacheType .NONE ;
158
- else if (lineageType .equalsIgnoreCase ("policy_lru" ))
159
- dmlOptions .linCachePolicy = LineageCachePolicy .LRU ;
160
- else if (lineageType .equalsIgnoreCase ("policy_costnsize" ))
161
- dmlOptions .linCachePolicy = LineageCachePolicy .COSTNSIZE ;
162
- else if (lineageType .equalsIgnoreCase ("policy_dagheight" ))
163
- dmlOptions .linCachePolicy = LineageCachePolicy .DAGHEIGHT ;
164
- else if (lineageType .equalsIgnoreCase ("estimate" ))
165
- dmlOptions .lineage_estimate = lineageType .equalsIgnoreCase ("estimate" );
166
- else if (lineageType .equalsIgnoreCase ("debugger" ))
167
- dmlOptions .lineage_debugger = lineageType .equalsIgnoreCase ("debugger" );
168
- else
169
- throw new org .apache .commons .cli .ParseException (
170
- "Invalid argument specified for -lineage option: " + lineageType );
171
- }
144
+ if (lineageType .equalsIgnoreCase ("dedup" ))
145
+ dmlOptions .lineage_dedup = lineageType .equalsIgnoreCase ("dedup" );
146
+ else if (lineageType .equalsIgnoreCase ("reuse_full" )
147
+ || lineageType .equalsIgnoreCase ("reuse" ))
148
+ dmlOptions .linReuseType = ReuseCacheType .REUSE_FULL ;
149
+ else if (lineageType .equalsIgnoreCase ("reuse_partial" ))
150
+ dmlOptions .linReuseType = ReuseCacheType .REUSE_PARTIAL ;
151
+ else if (lineageType .equalsIgnoreCase ("reuse_multilevel" ))
152
+ dmlOptions .linReuseType = ReuseCacheType .REUSE_MULTILEVEL ;
153
+ else if (lineageType .equalsIgnoreCase ("reuse_hybrid" ))
154
+ dmlOptions .linReuseType = ReuseCacheType .REUSE_HYBRID ;
155
+ else if (lineageType .equalsIgnoreCase ("none" ))
156
+ dmlOptions .linReuseType = ReuseCacheType .NONE ;
157
+ else if (lineageType .equalsIgnoreCase ("policy_lru" ))
158
+ dmlOptions .linCachePolicy = LineageCachePolicy .LRU ;
159
+ else if (lineageType .equalsIgnoreCase ("policy_costnsize" ))
160
+ dmlOptions .linCachePolicy = LineageCachePolicy .COSTNSIZE ;
161
+ else if (lineageType .equalsIgnoreCase ("policy_dagheight" ))
162
+ dmlOptions .linCachePolicy = LineageCachePolicy .DAGHEIGHT ;
163
+ else if (lineageType .equalsIgnoreCase ("estimate" ))
164
+ dmlOptions .lineage_estimate = true ;
165
+ else if (lineageType .equalsIgnoreCase ("debugger" ))
166
+ dmlOptions .lineage_debugger = true ;
167
+ else
168
+ throw new org .apache .commons .cli .ParseException (
169
+ "Invalid argument specified for -lineage option: " + lineageType );
172
170
}
173
171
}
174
172
}
@@ -186,13 +184,11 @@ else if (lineageType.equalsIgnoreCase("debugger"))
186
184
}
187
185
if (line .hasOption ("exec" )){
188
186
String execMode = line .getOptionValue ("exec" );
189
- if (execMode != null ){
190
- if (execMode .equalsIgnoreCase ("singlenode" )) dmlOptions .execMode = ExecMode .SINGLE_NODE ;
191
- else if (execMode .equalsIgnoreCase ("hybrid" )) dmlOptions .execMode = ExecMode .HYBRID ;
192
- else if (execMode .equalsIgnoreCase ("spark" )) dmlOptions .execMode = ExecMode .SPARK ;
193
- else throw new org .apache .commons .cli .ParseException ("Invalid argument specified for -exec option, must be one of [hadoop, singlenode, hybrid, HYBRID, spark]" );
194
- }
195
- }
187
+ if (execMode .equalsIgnoreCase ("singlenode" )) dmlOptions .execMode = ExecMode .SINGLE_NODE ;
188
+ else if (execMode .equalsIgnoreCase ("hybrid" )) dmlOptions .execMode = ExecMode .HYBRID ;
189
+ else if (execMode .equalsIgnoreCase ("spark" )) dmlOptions .execMode = ExecMode .SPARK ;
190
+ else throw new org .apache .commons .cli .ParseException ("Invalid argument specified for -exec option, must be one of [hadoop, singlenode, hybrid, HYBRID, spark]" );
191
+ }
196
192
if (line .hasOption ("explain" )) {
197
193
dmlOptions .explainType = ExplainType .RUNTIME ;
198
194
String explainType = line .getOptionValue ("explain" );
@@ -222,7 +218,7 @@ else if (lineageType.equalsIgnoreCase("debugger"))
222
218
dmlOptions .statsNGrams = line .hasOption ("ngrams" );
223
219
if (dmlOptions .statsNGrams ){
224
220
String [] nGramArgs = line .getOptionValues ("ngrams" );
225
- if (nGramArgs .length >= 2 ) {
221
+ if (nGramArgs != null && nGramArgs .length >= 2 ) {
226
222
try {
227
223
String [] nGramSizeSplit = nGramArgs [0 ].split ("," );
228
224
dmlOptions .statsNGramSizes = new int [nGramSizeSplit .length ];
@@ -273,11 +269,17 @@ else if (lineageType.equalsIgnoreCase("debugger"))
273
269
274
270
if (line .hasOption ("fedMonitoring" )) {
275
271
dmlOptions .fedMonitoring = true ;
276
- dmlOptions .fedMonitoringPort = Integer .parseInt (line .getOptionValue ("fedMonitoring" ));
272
+ String port = line .getOptionValue ("fedMonitoring" );
273
+ if (port != null )
274
+ dmlOptions .fedMonitoringPort = Integer .parseInt (port );
275
+ else
276
+ throw new org .apache .commons .cli .ParseException ("No port [integer] specified for -fedMonitoring option" );
277
277
}
278
278
279
279
if (line .hasOption ("fedMonitoringAddress" )) {
280
280
dmlOptions .fedMonitoringAddress = line .getOptionValue ("fedMonitoringAddress" );
281
+ if (dmlOptions .fedMonitoringAddress == null )
282
+ throw new org .apache .commons .cli .ParseException ("No address [String] specified for -fedMonitoringAddress option" );
281
283
}
282
284
283
285
if (line .hasOption ("f" )){
@@ -326,7 +328,7 @@ else if (lineageType.equalsIgnoreCase("debugger"))
326
328
OptimizerUtils .FEDERATED_COMPILATION = true ;
327
329
dmlOptions .federatedCompilation = true ;
328
330
String [] fedCompSpecs = line .getOptionValues ("federatedCompilation" );
329
- if ( fedCompSpecs != null && fedCompSpecs . length > 0 ){
331
+ if (fedCompSpecs != null ){
330
332
for ( String spec : fedCompSpecs ){
331
333
String [] specPair = spec .split ("=" );
332
334
if (specPair .length != 2 ){
0 commit comments