Esempio n. 1
0
        /**
         * Sorts Pojo or {@link org.apache.flink.api.java.tuple.Tuple} elements within a group in
         * the second input on the specified field in the specified {@link Order}.<br>
         * Groups can be sorted by multiple fields by chaining {@link #sortSecondGroup(String,
         * Order)} calls.
         *
         * @param fieldExpression The expression to the field on which the group is to be sorted.
         * @param order The Order in which the specified Tuple field is sorted.
         * @return A SortedGrouping with specified order of group element.
         * @see Order
         */
        public CoGroupOperatorWithoutFunction sortSecondGroup(String fieldExpression, Order order) {

          ExpressionKeys<I2> ek = new ExpressionKeys<>(fieldExpression, input2.getType());
          int[] groupOrderKeys = ek.computeLogicalKeyPositions();

          for (int key : groupOrderKeys) {
            this.groupSortKeyOrderSecond.add(new ImmutablePair<>(key, order));
          }

          return this;
        }
Esempio n. 2
0
        /**
         * Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group in the first
         * input on the specified field in the specified {@link Order}.<br>
         * <b>Note: Only groups of Tuple elements and Pojos can be sorted.</b><br>
         * Groups can be sorted by multiple fields by chaining {@link #sortFirstGroup(int, Order)}
         * calls.
         *
         * @param field The Tuple field on which the group is sorted.
         * @param order The Order in which the specified Tuple field is sorted.
         * @return A SortedGrouping with specified order of group element.
         * @see org.apache.flink.api.java.tuple.Tuple
         * @see Order
         */
        public CoGroupOperatorWithoutFunction sortFirstGroup(int field, Order order) {

          ExpressionKeys<I1> ek = new ExpressionKeys<>(field, input1.getType());
          int[] groupOrderKeys = ek.computeLogicalKeyPositions();

          for (int key : groupOrderKeys) {
            this.groupSortKeyOrderFirst.add(new ImmutablePair<>(key, order));
          }

          return this;
        }