Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-1525 Provide utils to pass -D parameters to UDFs
  3. FLINK-2621

Add support for positional arguments to ParameterTool

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 0.9
    • Component/s: flink-contrib
    • Labels:
      None

      Description

      While working on FLINK-2021, we noticed we need to have support for positional arguments, since after FLINK-2021 is merged, all training materials and guides that are pointing to the old way of executing the examples will not work.

      What I have in mind is something like this:

      // ------------------ 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];
      	}
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              behrouz1989 Behrouz Derakhshan
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: