Package org.apache.flink.api.java

Examples of org.apache.flink.api.java.ExecutionEnvironment.fromCollection()


  @Test(expected = IllegalArgumentException.class)
  public void testGroupByKeyExpressions2Nested() {

    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<CustomType> ds = env.fromCollection(customTypeData);

    // should not work, key out of tuple bounds
    ds.groupBy("nested.myNonExistent");
  }
View Full Code Here


   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    this.customTypeData.add(new CustomType());
   
    try {
      DataSet<CustomType> customDs = env.fromCollection(customTypeData);
      // should work
      customDs.groupBy(
          new KeySelector<GroupingTest.CustomType, Long>() {
 
            @Override
View Full Code Here

   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    this.customTypeData.add(new CustomType());
   
    try {
      DataSet<CustomType> customDs = env.fromCollection(customTypeData);
      // should work
      customDs.groupBy(
          new KeySelector<GroupingTest.CustomType, Tuple2<Integer, Long>>() {
            @Override
            public Tuple2<Integer,Long> getKey(CustomType value) {
View Full Code Here

  public void testGroupByKeySelector3() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    this.customTypeData.add(new CustomType());
   
    DataSet<CustomType> customDs = env.fromCollection(customTypeData);
    // should not work
    customDs.groupBy(
        new KeySelector<GroupingTest.CustomType, CustomType>() {
          @Override
          public CustomType getKey(CustomType value) {
View Full Code Here

  public void testGroupByKeySelector4() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    this.customTypeData.add(new CustomType());
   
    DataSet<CustomType> customDs = env.fromCollection(customTypeData);
    // should not work
    customDs.groupBy(
        new KeySelector<GroupingTest.CustomType, Tuple2<Integer, GroupingTest.CustomType>>() {
          @Override
          public Tuple2<Integer, CustomType> getKey(CustomType value) {
View Full Code Here

 
  @Test
  public void testGroupSortKeyFields1() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

    // should work
    try {
      tupleDs.groupBy(0).sortGroup(0, Order.ASCENDING);
    } catch(Exception e) {
View Full Code Here

 
  @Test(expected = IllegalArgumentException.class)
  public void testGroupSortKeyFields2() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

    // should not work, field index out of bounds
    tupleDs.groupBy(0).sortGroup(5, Order.ASCENDING);
   
  }
View Full Code Here

 
  @Test(expected = InvalidProgramException.class)
  public void testGroupSortKeyFields3() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<Long> longDs = env.fromCollection(emptyLongData, BasicTypeInfo.LONG_TYPE_INFO);
   
    // should not work: sorted groups on groupings by key selectors
    longDs.groupBy(new KeySelector<Long, Long>() {
      private static final long serialVersionUID = 1L;
View Full Code Here

 
  @Test
  public void testChainedGroupSortKeyFields() {
   
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

    // should work
    try {
      tupleDs.groupBy(0).sortGroup(0, Order.ASCENDING).sortGroup(2, Order.DESCENDING);
    } catch(Exception e) {
View Full Code Here

  @Test
  public void testMaxByKeyFieldsDataset() {

    final ExecutionEnvironment env = ExecutionEnvironment
        .getExecutionEnvironment();
    DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env
        .fromCollection(emptyTupleData, tupleTypeInfo);

    // should work
    try {
      tupleDs.maxBy(4, 0, 1, 2, 3);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.