All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.stratosphere.api.java.operators.ProjectOperator Maven / Gradle / Ivy

/***********************************************************************************************************************
 *
 * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 **********************************************************************************************************************/
package eu.stratosphere.api.java.operators;

import java.util.Arrays;

import eu.stratosphere.api.common.functions.GenericMap;
import eu.stratosphere.api.common.operators.Operator;
import eu.stratosphere.api.java.DataSet;
import eu.stratosphere.api.java.operators.translation.PlanProjectOperator;
//CHECKSTYLE.OFF: AvoidStarImport - Needed for TupleGenerator
import eu.stratosphere.api.java.tuple.*;
//CHECKSTYLE.ON: AvoidStarImport
import eu.stratosphere.api.java.typeutils.TupleTypeInfo;
import eu.stratosphere.types.TypeInformation;


/**
 * This operator represents the application of a projection operation on a data set, and the
 * result data set produced by the function.
 * 
 * @param  The type of the data set projected by the operator.
 * @param  The type of data set that is the result of the projection.
 */
public class ProjectOperator 
	extends SingleInputOperator> {
	
	protected final int[] fields;
	
	public ProjectOperator(DataSet input, int[] fields, TupleTypeInfo returnType) {
		super(input, returnType);
	
		this.fields = fields;
	}

	@Override
	protected eu.stratosphere.api.common.operators.base.MapOperatorBase> translateToDataFlow(Operator input) {		
		String name = getName() != null ? getName() : "Projection " + Arrays.toString(fields);
		// create operator
		PlanProjectOperator ppo = new PlanProjectOperator(fields, name, getInputType(), getResultType());
		// set input
		ppo.setInput(input);
		// set dop
		ppo.setDegreeOfParallelism(this.getParallelism());
		
		return ppo;
	}

	
	public static class Projection {
		
		private final DataSet ds;
		private final int[] fieldIndexes;
		
		public Projection(DataSet ds, int[] fieldIndexes) {
			
			if(!(ds.getType() instanceof TupleTypeInfo)) {
				throw new UnsupportedOperationException("project() can only be applied to DataSets of Tuples.");
			}
			
			if(fieldIndexes.length == 0) {
				throw new IllegalArgumentException("project() needs to select at least one (1) field.");
			} else if(fieldIndexes.length > 22) {
				throw new IllegalArgumentException("project() may select only up to twenty-two (22) fields.");
			}
			
			int maxFieldIndex = ((TupleTypeInfo)ds.getType()).getArity();
			for(int i=0; i maxFieldIndex - 1) {
					throw new IndexOutOfBoundsException("Provided field index is out of bounds of input tuple.");
				}
			}
			
			this.ds = ds;
			this.fieldIndexes = fieldIndexes;
		}
		
		// --------------------------------------------------------------------------------------------	
		// The following lines are generated.
		// --------------------------------------------------------------------------------------------	
		// BEGIN_OF_TUPLE_DEPENDENT_CODE	
	// GENERATED FROM eu.stratosphere.api.java.tuple.TupleGenerator.

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0) {
			Class[] types = {type0};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1) {
			Class[] types = {type0, type1};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2) {
			Class[] types = {type0, type1, type2};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3) {
			Class[] types = {type0, type1, type2, type3};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4) {
			Class[] types = {type0, type1, type2, type3, type4};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5) {
			Class[] types = {type0, type1, type2, type3, type4, type5};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @param type20 The class of field '20' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19, Class type20) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @param type20 The class of field '20' of the result Tuples.
		 * @param type21 The class of field '21' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19, Class type20, Class type21) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @param type20 The class of field '20' of the result Tuples.
		 * @param type21 The class of field '21' of the result Tuples.
		 * @param type22 The class of field '22' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19, Class type20, Class type21, Class type22) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @param type20 The class of field '20' of the result Tuples.
		 * @param type21 The class of field '21' of the result Tuples.
		 * @param type22 The class of field '22' of the result Tuples.
		 * @param type23 The class of field '23' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19, Class type20, Class type21, Class type22, Class type23) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		/**
		 * Projects a {@link Tuple} {@link DataSet} to the previously selected fields. 
		 * Requires the classes of the fields of the resulting Tuples. 
		 * 
		 * @param type0 The class of field '0' of the result Tuples.
		 * @param type1 The class of field '1' of the result Tuples.
		 * @param type2 The class of field '2' of the result Tuples.
		 * @param type3 The class of field '3' of the result Tuples.
		 * @param type4 The class of field '4' of the result Tuples.
		 * @param type5 The class of field '5' of the result Tuples.
		 * @param type6 The class of field '6' of the result Tuples.
		 * @param type7 The class of field '7' of the result Tuples.
		 * @param type8 The class of field '8' of the result Tuples.
		 * @param type9 The class of field '9' of the result Tuples.
		 * @param type10 The class of field '10' of the result Tuples.
		 * @param type11 The class of field '11' of the result Tuples.
		 * @param type12 The class of field '12' of the result Tuples.
		 * @param type13 The class of field '13' of the result Tuples.
		 * @param type14 The class of field '14' of the result Tuples.
		 * @param type15 The class of field '15' of the result Tuples.
		 * @param type16 The class of field '16' of the result Tuples.
		 * @param type17 The class of field '17' of the result Tuples.
		 * @param type18 The class of field '18' of the result Tuples.
		 * @param type19 The class of field '19' of the result Tuples.
		 * @param type20 The class of field '20' of the result Tuples.
		 * @param type21 The class of field '21' of the result Tuples.
		 * @param type22 The class of field '22' of the result Tuples.
		 * @param type23 The class of field '23' of the result Tuples.
		 * @param type24 The class of field '24' of the result Tuples.
		 * @return The projected DataSet.
		 * 
		 * @see Tuple
		 * @see DataSet
		 */
		public  ProjectOperator> types(Class type0, Class type1, Class type2, Class type3, Class type4, Class type5, Class type6, Class type7, Class type8, Class type9, Class type10, Class type11, Class type12, Class type13, Class type14, Class type15, Class type16, Class type17, Class type18, Class type19, Class type20, Class type21, Class type22, Class type23, Class type24) {
			Class[] types = {type0, type1, type2, type3, type4, type5, type6, type7, type8, type9, type10, type11, type12, type13, type14, type15, type16, type17, type18, type19, type20, type21, type22, type23, type24};
			if(types.length != this.fieldIndexes.length) {
				throw new IllegalArgumentException("Numbers of projected fields and types do not match.");
			}
			
			TypeInformation[] fTypes = extractFieldTypes(fieldIndexes, types, ds.getType());
			TupleTypeInfo> tType = new TupleTypeInfo>(fTypes);

			return new ProjectOperator>(this.ds, this.fieldIndexes, tType);
		}

		// END_OF_TUPLE_DEPENDENT_CODE
		// -----------------------------------------------------------------------------------------
		
			
		private TypeInformation[] extractFieldTypes(int[] fields, Class[] givenTypes, TypeInformation inType) {
			
			TupleTypeInfo inTupleType = (TupleTypeInfo) inType;
			TypeInformation[] fieldTypes = new TypeInformation[fields.length];
					
			for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy