Skip to content

Commit

Permalink
[FLINK-4048] Remove Hadoop GenericOptionsParser from ParameterTool
Browse files Browse the repository at this point in the history
There are methods for this in flink-hadoop-compatibility.
  • Loading branch information
aljoscha committed Sep 27, 2017
1 parent 4beff13 commit 21e6d52
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.apache.flink.configuration.Configuration;
import org.apache.flink.util.Preconditions;

import org.apache.commons.cli.Option;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hadoop.util.GenericOptionsParser;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -212,28 +210,6 @@ public static ParameterTool fromSystemProperties() {
return fromMap((Map) System.getProperties());
}

/**
* Returns {@link ParameterTool} for the arguments parsed by {@link GenericOptionsParser}.
*
* @param args Input array arguments. It should be parsable by {@link GenericOptionsParser}
* @return A {@link ParameterTool}
* @throws IOException If arguments cannot be parsed by {@link GenericOptionsParser}
* @see GenericOptionsParser
* @deprecated Please use {@link org.apache.flink.hadoopcompatibility.HadoopUtils#paramsFromGenericOptionsParser(String[])}
* from project flink-hadoop-compatibility
*/
@Deprecated
@PublicEvolving
public static ParameterTool fromGenericOptionsParser(String[] args) throws IOException {
Option[] options = new GenericOptionsParser(args).getCommandLine().getOptions();
Map<String, String> map = new HashMap<String, String>();
for (Option option : options) {
String[] split = option.getValue().split("=");
map.put(split[0], split[1]);
}
return fromMap(map);
}

// ------------------ ParameterUtil ------------------------
protected final Map<String, String> data;
protected final Map<String, String> defaultData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,6 @@ public void testMerged() {
validate(parameter);
}

@Test
public void testFromGenericOptionsParser() throws IOException {
ParameterTool parameter = ParameterTool.fromGenericOptionsParser(new String[]{"-D", "input=myInput", "-DexpectedCount=15"});
validate(parameter);
}

// Boolean

@Test
Expand Down

0 comments on commit 21e6d52

Please sign in to comment.