[ 
https://issues.apache.org/jira/browse/FLINK-2621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Behrouz Derakhshan updated FLINK-2621:
--------------------------------------
    Description: 
While working on FLINK-2021, the need for positional argument support became 
needed, since after FLINK-2021 is merged, all training materials and guides 
that are pointing to old way of executing the examples will not work anymore. 

What I have in mind is something like this:
{code}
// ------------------ Constructors ------------------------
        public static ParameterTool fromArgs(String[] args) {
                isPositional = true;
                // check if arg type is positional
                for(String arg:args){
                        if (arg.contains("--")){
                                isPositional = false;
                        }
                }
                if(isPositional){
                        return fromPositionalArgument(args);
                }
                ...
        // create ParameterTool for positional arguments
        public static ParameterTool fromPositionalArgument(String[] args){
                return new ParameterTool(args);
        }

                ...
        // underlying storage for arguments 
        private String[] dataPositional;
        private ParameterTool(String[] args){
                this.dataPositional = args;
        }
        // return the positional argument based on the given index
        public String get(int position){
                if(!isPositional){
                        throw new RuntimeException("Arguments are of type of 
key, value");
                }
                return dataPositional[position];
        }
{code}



  was:
While working on FLINK-2021, the need for positional argument support became 
needed, since after FLINK-2021 is merged, all training materials and guides 
that are pointing to old way of executing the examples will not work anymore. 

What I have in mind is something like this:
{code}
// ------------------ Constructors ------------------------
        public static ParameterTool fromArgs(String[] args) {
                isPositional = true;
                // check if arg type is positional
                for(String arg:args){
                        if (arg.contains("--")){
                                isPositional = false;
                        }
                }
                if(isPositional){
                        return fromPositionalArgument(args);
                }
...
// create ParameterTool for positional arguments
public static ParameterTool fromPositionalArgument(String[] args){
                return new ParameterTool(args);
        }

...
// underlying storage for arguments 
private String[] dataPositional;
        private ParameterTool(String[] args){
                this.dataPositional = args;
        }
// return the positional argument based on the given index
public String get(int position){
                if(!isPositional){
                        throw new RuntimeException("Arguments are of type of 
key, value");
                }
                return dataPositional[position];
        }
{code}




> Add support for positional arguments to ParameterTool
> -----------------------------------------------------
>
>                 Key: FLINK-2621
>                 URL: https://issues.apache.org/jira/browse/FLINK-2621
>             Project: Flink
>          Issue Type: Sub-task
>          Components: flink-contrib
>            Reporter: Behrouz Derakhshan
>             Fix For: 0.9
>
>
> While working on FLINK-2021, the need for positional argument support became 
> needed, since after FLINK-2021 is merged, all training materials and guides 
> that are pointing to old way of executing the examples will not work anymore. 
> What I have in mind is something like this:
> {code}
> // ------------------ Constructors ------------------------
>       public static ParameterTool fromArgs(String[] args) {
>               isPositional = true;
>               // check if arg type is positional
>               for(String arg:args){
>                       if (arg.contains("--")){
>                               isPositional = false;
>                       }
>               }
>               if(isPositional){
>                       return fromPositionalArgument(args);
>               }
>               ...
>       // create ParameterTool for positional arguments
>       public static ParameterTool fromPositionalArgument(String[] args){
>               return new ParameterTool(args);
>       }
>               ...
>       // underlying storage for arguments 
>       private String[] dataPositional;
>       private ParameterTool(String[] args){
>               this.dataPositional = args;
>       }
>       // return the positional argument based on the given index
>       public String get(int position){
>               if(!isPositional){
>                       throw new RuntimeException("Arguments are of type of 
> key, value");
>               }
>               return dataPositional[position];
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to