org.apache.flink.api.common.operators.base.CrossOperatorBase.CrossHint Java Examples

The following examples show how to use org.apache.flink.api.common.operators.base.CrossOperatorBase.CrossHint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public CrossOperator(DataSet<I1> input1, DataSet<I2> input2,
						CrossFunction<I1, I2, OUT> function,
						TypeInformation<OUT> returnType,
						CrossHint hint,
						String defaultName) {
	super(input1, input2, returnType);

	this.function = function;
	this.defaultName = defaultName;
	this.hint = hint;

	UdfOperatorUtils.analyzeDualInputUdf(this, CrossFunction.class, defaultName, function, null, null);
}
 
Example #2
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public DefaultCross(DataSet<I1> input1, DataSet<I2> input2, CrossHint hint, String defaultName) {
	super(input1, input2, new DefaultCrossFunction<I1, I2>(),
		new TupleTypeInfo<Tuple2<I1, I2>>(
			Preconditions.checkNotNull(input1, "input1 is null").getType(),
			Preconditions.checkNotNull(input2, "input2 is null").getType()),
		hint, defaultName);
}
 
Example #3
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossHint hint) {
	super(input1, input2,
			new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
			returnType, hint, "unknown");

	crossProjection = null;
}
 
Example #4
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossProjection<I1, I2> crossProjection, CrossHint hint) {
	super(input1, input2,
		new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
		returnType, hint, "unknown");

	this.crossProjection = crossProjection;
}
 
Example #5
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossProjection<I1, I2> crossProjection, CrossHint hint) {
	super(input1, input2,
		new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
		returnType, hint, "unknown");

	this.crossProjection = crossProjection;
}
 
Example #6
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossHint hint) {
	super(input1, input2,
			new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
			returnType, hint, "unknown");

	crossProjection = null;
}
 
Example #7
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public DefaultCross(DataSet<I1> input1, DataSet<I2> input2, CrossHint hint, String defaultName) {
	super(input1, input2, new DefaultCrossFunction<I1, I2>(),
		new TupleTypeInfo<Tuple2<I1, I2>>(
			Preconditions.checkNotNull(input1, "input1 is null").getType(),
			Preconditions.checkNotNull(input2, "input2 is null").getType()),
		hint, defaultName);
}
 
Example #8
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public CrossOperator(DataSet<I1> input1, DataSet<I2> input2,
						CrossFunction<I1, I2, OUT> function,
						TypeInformation<OUT> returnType,
						CrossHint hint,
						String defaultName) {
	super(input1, input2, returnType);

	this.function = function;
	this.defaultName = defaultName;
	this.hint = hint;
}
 
Example #9
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public DefaultCross(DataSet<I1> input1, DataSet<I2> input2, CrossHint hint, String defaultName) {
	super(input1, input2, new DefaultCrossFunction<I1, I2>(),
		new TupleTypeInfo<Tuple2<I1, I2>>(
			Preconditions.checkNotNull(input1, "input1 is null").getType(),
			Preconditions.checkNotNull(input2, "input2 is null").getType()),
		hint, defaultName);
}
 
Example #10
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossHint hint) {
	super(input1, input2,
			new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
			returnType, hint, "unknown");

	crossProjection = null;
}
 
Example #11
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
protected ProjectCross(DataSet<I1> input1, DataSet<I2> input2, int[] fields, boolean[] isFromFirst,
		TupleTypeInfo<OUT> returnType, CrossProjection<I1, I2> crossProjection, CrossHint hint) {
	super(input1, input2,
		new ProjectCrossFunction<I1, I2, OUT>(fields, isFromFirst, returnType.createSerializer(input1.getExecutionEnvironment().getConfig()).createInstance()),
		returnType, hint, "unknown");

	this.crossProjection = crossProjection;
}
 
Example #12
Source File: CrossOperator.java    From flink with Apache License 2.0 5 votes vote down vote up
public CrossOperator(DataSet<I1> input1, DataSet<I2> input2,
						CrossFunction<I1, I2, OUT> function,
						TypeInformation<OUT> returnType,
						CrossHint hint,
						String defaultName) {
	super(input1, input2, returnType);

	this.function = function;
	this.defaultName = defaultName;
	this.hint = hint;
}
 
Example #13
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Internal
public CrossHint getCrossHint() {
	return hint;
}
 
Example #14
Source File: CrossOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public CrossProjection(DataSet<I1> ds1, DataSet<I2> ds2, int[] firstFieldIndexes, int[] secondFieldIndexes, CrossHint hint) {

			this.ds1 = ds1;
			this.ds2 = ds2;
			this.hint = hint;

			boolean isFirstTuple;
			boolean isSecondTuple;

			if (ds1.getType() instanceof TupleTypeInfo) {
				numFieldsDs1 = ((TupleTypeInfo<?>) ds1.getType()).getArity();
				isFirstTuple = true;
			} else {
				numFieldsDs1 = 1;
				isFirstTuple = false;
			}
			if (ds2.getType() instanceof TupleTypeInfo) {
				numFieldsDs2 = ((TupleTypeInfo<?>) ds2.getType()).getArity();
				isSecondTuple = true;
			} else {
				numFieldsDs2 = 1;
				isSecondTuple = false;
			}

			boolean isTuple;
			boolean firstInput;

			if (firstFieldIndexes != null && secondFieldIndexes == null) {
				// index array for first input is provided
				firstInput = true;
				isTuple = isFirstTuple;
				this.fieldIndexes = firstFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes != null) {
				// index array for second input is provided
				firstInput = false;
				isTuple = isSecondTuple;
				this.fieldIndexes = secondFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes == null) {
				throw new IllegalArgumentException("You must provide at least one field index array.");
			} else {
				throw new IllegalArgumentException("You must provide at most one field index array.");
			}

			if (!isTuple && this.fieldIndexes.length != 0) {
				// field index provided for non-Tuple input
				throw new IllegalArgumentException("Input is not a Tuple. Call projectFirst() (or projectSecond()) without arguments to include it.");
			} else if (this.fieldIndexes.length > 22) {
				throw new IllegalArgumentException("You may select only up to twenty-two (22) fields.");
			}

			if (isTuple) {
				this.isFieldInFirst = new boolean[this.fieldIndexes.length];

				// check field indexes and adapt to position in tuple
				int maxFieldIndex = firstInput ? numFieldsDs1 : numFieldsDs2;
				for (int i = 0; i < this.fieldIndexes.length; i++) {
					Preconditions.checkElementIndex(this.fieldIndexes[i], maxFieldIndex);

					if (firstInput) {
						this.isFieldInFirst[i] = true;
					} else {
						this.isFieldInFirst[i] = false;
					}
				}
			} else {
				this.isFieldInFirst = new boolean[]{firstInput};
				this.fieldIndexes = new int[]{-1};
			}

		}
 
Example #15
Source File: CrossOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Internal
public CrossHint getCrossHint() {
	return hint;
}
 
Example #16
Source File: CrossOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
public CrossProjection(DataSet<I1> ds1, DataSet<I2> ds2, int[] firstFieldIndexes, int[] secondFieldIndexes, CrossHint hint) {

			this.ds1 = ds1;
			this.ds2 = ds2;
			this.hint = hint;

			boolean isFirstTuple;
			boolean isSecondTuple;

			if (ds1.getType() instanceof TupleTypeInfo) {
				numFieldsDs1 = ((TupleTypeInfo<?>) ds1.getType()).getArity();
				isFirstTuple = true;
			} else {
				numFieldsDs1 = 1;
				isFirstTuple = false;
			}
			if (ds2.getType() instanceof TupleTypeInfo) {
				numFieldsDs2 = ((TupleTypeInfo<?>) ds2.getType()).getArity();
				isSecondTuple = true;
			} else {
				numFieldsDs2 = 1;
				isSecondTuple = false;
			}

			boolean isTuple;
			boolean firstInput;

			if (firstFieldIndexes != null && secondFieldIndexes == null) {
				// index array for first input is provided
				firstInput = true;
				isTuple = isFirstTuple;
				this.fieldIndexes = firstFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes != null) {
				// index array for second input is provided
				firstInput = false;
				isTuple = isSecondTuple;
				this.fieldIndexes = secondFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes == null) {
				throw new IllegalArgumentException("You must provide at least one field index array.");
			} else {
				throw new IllegalArgumentException("You must provide at most one field index array.");
			}

			if (!isTuple && this.fieldIndexes.length != 0) {
				// field index provided for non-Tuple input
				throw new IllegalArgumentException("Input is not a Tuple. Call projectFirst() (or projectSecond()) without arguments to include it.");
			} else if (this.fieldIndexes.length > 22) {
				throw new IllegalArgumentException("You may select only up to twenty-two (22) fields.");
			}

			if (isTuple) {
				this.isFieldInFirst = new boolean[this.fieldIndexes.length];

				// check field indexes and adapt to position in tuple
				int maxFieldIndex = firstInput ? numFieldsDs1 : numFieldsDs2;
				for (int i = 0; i < this.fieldIndexes.length; i++) {
					Preconditions.checkElementIndex(this.fieldIndexes[i], maxFieldIndex);

					if (firstInput) {
						this.isFieldInFirst[i] = true;
					} else {
						this.isFieldInFirst[i] = false;
					}
				}
			} else {
				this.isFieldInFirst = new boolean[]{firstInput};
				this.fieldIndexes = new int[]{-1};
			}

		}
 
Example #17
Source File: CrossOperator.java    From flink with Apache License 2.0 4 votes vote down vote up
@Internal
public CrossHint getCrossHint() {
	return hint;
}
 
Example #18
Source File: CrossOperator.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public CrossProjection(DataSet<I1> ds1, DataSet<I2> ds2, int[] firstFieldIndexes, int[] secondFieldIndexes, CrossHint hint) {

			this.ds1 = ds1;
			this.ds2 = ds2;
			this.hint = hint;

			boolean isFirstTuple;
			boolean isSecondTuple;

			if (ds1.getType() instanceof TupleTypeInfo) {
				numFieldsDs1 = ((TupleTypeInfo<?>) ds1.getType()).getArity();
				isFirstTuple = true;
			} else {
				numFieldsDs1 = 1;
				isFirstTuple = false;
			}
			if (ds2.getType() instanceof TupleTypeInfo) {
				numFieldsDs2 = ((TupleTypeInfo<?>) ds2.getType()).getArity();
				isSecondTuple = true;
			} else {
				numFieldsDs2 = 1;
				isSecondTuple = false;
			}

			boolean isTuple;
			boolean firstInput;

			if (firstFieldIndexes != null && secondFieldIndexes == null) {
				// index array for first input is provided
				firstInput = true;
				isTuple = isFirstTuple;
				this.fieldIndexes = firstFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes != null) {
				// index array for second input is provided
				firstInput = false;
				isTuple = isSecondTuple;
				this.fieldIndexes = secondFieldIndexes;

				if (this.fieldIndexes.length == 0) {
					// no indexes provided, treat tuple as regular object
					isTuple = false;
				}
			} else if (firstFieldIndexes == null && secondFieldIndexes == null) {
				throw new IllegalArgumentException("You must provide at least one field index array.");
			} else {
				throw new IllegalArgumentException("You must provide at most one field index array.");
			}

			if (!isTuple && this.fieldIndexes.length != 0) {
				// field index provided for non-Tuple input
				throw new IllegalArgumentException("Input is not a Tuple. Call projectFirst() (or projectSecond()) without arguments to include it.");
			} else if (this.fieldIndexes.length > 22) {
				throw new IllegalArgumentException("You may select only up to twenty-two (22) fields.");
			}

			if (isTuple) {
				this.isFieldInFirst = new boolean[this.fieldIndexes.length];

				// check field indexes and adapt to position in tuple
				int maxFieldIndex = firstInput ? numFieldsDs1 : numFieldsDs2;
				for (int i = 0; i < this.fieldIndexes.length; i++) {
					Preconditions.checkElementIndex(this.fieldIndexes[i], maxFieldIndex);

					if (firstInput) {
						this.isFieldInFirst[i] = true;
					} else {
						this.isFieldInFirst[i] = false;
					}
				}
			} else {
				this.isFieldInFirst = new boolean[]{firstInput};
				this.fieldIndexes = new int[]{-1};
			}

		}
 
Example #19
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> cross(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.OPTIMIZER_CHOOSES, Utils.getCallLocationName());
}
 
Example #20
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   smaller than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithTiny(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.SECOND_IS_SMALL, Utils.getCallLocationName());
}
 
Example #21
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   larger than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithHuge(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.FIRST_IS_SMALL, Utils.getCallLocationName());
}
 
Example #22
Source File: DataSet.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   larger than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithHuge(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.FIRST_IS_SMALL, Utils.getCallLocationName());
}
 
Example #23
Source File: DataSet.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   smaller than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithTiny(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.SECOND_IS_SMALL, Utils.getCallLocationName());
}
 
Example #24
Source File: DataSet.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> cross(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.OPTIMIZER_CHOOSES, Utils.getCallLocationName());
}
 
Example #25
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> cross(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.OPTIMIZER_CHOOSES, Utils.getCallLocationName());
}
 
Example #26
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   smaller than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithTiny(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.SECOND_IS_SMALL, Utils.getCallLocationName());
}
 
Example #27
Source File: DataSet.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Initiates a Cross transformation.
 *
 * <p>A Cross transformation combines the elements of two
 *   {@link DataSet DataSets} into one DataSet. It builds all pair combinations of elements of
 *   both DataSets, i.e., it builds a Cartesian product.
 * This method also gives the hint to the optimizer that the second DataSet to cross is much
 *   larger than the first one.
 *
 *
 * <p>The resulting {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross} wraps each pair of crossed elements into a {@link Tuple2}, with
 * the element of the first input being the first field of the tuple and the element of the
 * second input being the second field of the tuple.
 *
 *
 * <p>Call {@link org.apache.flink.api.java.operators.CrossOperator.DefaultCross#with(org.apache.flink.api.common.functions.CrossFunction)} to define a
 * {@link org.apache.flink.api.common.functions.CrossFunction} which is called for
 * each pair of crossed elements. The CrossFunction returns a exactly one element for each pair of input elements.
 *
 * @param other The other DataSet with which this DataSet is crossed.
 * @return A DefaultCross that returns a Tuple2 for each pair of crossed elements.
 *
 * @see org.apache.flink.api.java.operators.CrossOperator.DefaultCross
 * @see org.apache.flink.api.common.functions.CrossFunction
 * @see DataSet
 * @see Tuple2
 */
public <R> CrossOperator.DefaultCross<T, R> crossWithHuge(DataSet<R> other) {
	return new CrossOperator.DefaultCross<>(this, other, CrossHint.FIRST_IS_SMALL, Utils.getCallLocationName());
}