Codota Logo
TupleTypeInfo.getTypeClass
Code IndexAdd Codota to your IDE (free)

How to use
getTypeClass
method
in
org.apache.flink.api.java.typeutils.TupleTypeInfo

Best Java code snippets using org.apache.flink.api.java.typeutils.TupleTypeInfo.getTypeClass (Showing top 14 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: apache/flink

@SuppressWarnings("unchecked")
@Override
@PublicEvolving
public TupleSerializer<T> createSerializer(ExecutionConfig executionConfig) {
  if (getTypeClass() == Tuple0.class) {
    return (TupleSerializer<T>) Tuple0Serializer.INSTANCE;
  }
  TypeSerializer<?>[] fieldSerializers = new TypeSerializer<?>[getArity()];
  for (int i = 0; i < types.length; i++) {
    fieldSerializers[i] = types[i].createSerializer(executionConfig);
  }
  
  Class<T> tupleClass = getTypeClass();
  
  return new TupleSerializer<T>(tupleClass, fieldSerializers);
}
origin: apache/flink

  private <T extends Tuple> void runTests(int length, T... instances) {
    try {
      TupleTypeInfo<T> tupleTypeInfo = (TupleTypeInfo<T>) TypeExtractor.getForObject(instances[0]);
      TypeSerializer<T> serializer = tupleTypeInfo.createSerializer(new ExecutionConfig());
      
      Class<T> tupleClass = tupleTypeInfo.getTypeClass();

      if(tupleClass == Tuple0.class) {
        length = 1;
      }
      TupleSerializerTestInstance<T> test = new TupleSerializerTestInstance<T>(serializer, tupleClass, length, instances);
      test.testAll();
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
      e.printStackTrace();
      Assert.fail(e.getMessage());
    }
  }
}
origin: apache/flink

Assert.assertEquals(Tuple2.class, tti.getTypeClass());
List<FlatFieldDescriptor> ffd = new ArrayList<FlatFieldDescriptor>();
TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) ti2;
Assert.assertEquals(Tuple2.class, tti2.getTypeClass());
Assert.assertEquals(Long.class, tti2.getTypeAt(0).getTypeClass());
Assert.assertTrue(tti2.getTypeAt(1) instanceof PojoTypeInfo);
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testSameGenericVariable() {
  RichMapFunction<?, ?> function = new RichMapFunction<SameTypeVariable<String>, SameTypeVariable<String>>() {
    private static final long serialVersionUID = 1L;
    @Override
    public SameTypeVariable<String> map(SameTypeVariable<String> value) throws Exception {
      return null;
    }
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple2<String, String>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(2, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(SameTypeVariable.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(1));
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGenericsNotInSuperclass() {
  // use getMapReturnTypes()
  RichMapFunction<?, ?> function = new RichMapFunction<LongKeyValue<String>, LongKeyValue<String>>() {
    private static final long serialVersionUID = 1L;
    @Override
    public LongKeyValue<String> map(LongKeyValue<String> value) throws Exception {
      return null;
    }
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple2<Long, String>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(2, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(LongKeyValue.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(1));
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testNestedTupleGenerics() {
  RichMapFunction<?, ?> function = new RichMapFunction<Nested<String, Integer>, Nested<String, Integer>>() {
    private static final long serialVersionUID = 1L;
    @Override
    public Nested<String, Integer> map(Nested<String, Integer> value) throws Exception {
      return null;
    }
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple2<String, Tuple2<Integer, Integer>>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(2, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(Nested.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertTrue(tti.getTypeAt(1).isTupleType());
  Assert.assertEquals(2, tti.getTypeAt(1).getArity());
  // Nested
  TupleTypeInfo<?> tti2 = (TupleTypeInfo<?>) tti.getTypeAt(1);
  Assert.assertEquals(Tuple2.class, tti2.getTypeClass());
  Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti2.getTypeAt(1));
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testSubclassOfTuple() {
  // use getJoinReturnTypes()
  RichFlatJoinFunction<?, ?, ?> function = new RichFlatJoinFunction<CustomTuple, String, CustomTuple>() {
    private static final long serialVersionUID = 1L;
    @Override
    public void join(CustomTuple first, String second, Collector<CustomTuple> out) throws Exception {
      out.collect(null);
    }            
  };
  TypeInformation<?> ti = TypeExtractor.getFlatJoinReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}), (TypeInformation) Types.STRING);
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(2, ti.getArity());
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ((TupleTypeInfo<?>) ti).getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, ((TupleTypeInfo<?>) ti).getTypeAt(1));
  Assert.assertEquals(CustomTuple.class, ((TupleTypeInfo<?>) ti).getTypeClass());
  // use getForObject()
  CustomTuple t = new CustomTuple("hello", 1);
  TypeInformation<?> ti2 = TypeExtractor.getForObject(t);
  Assert.assertTrue(ti2.isTupleType());
  Assert.assertEquals(2, ti2.getArity());
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, ((TupleTypeInfo<?>) ti2).getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, ((TupleTypeInfo<?>) ti2).getTypeAt(1));
  Assert.assertEquals(CustomTuple.class, ((TupleTypeInfo<?>) ti2).getTypeClass());
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testChainedGenericsNotInSuperclass() {
  // use TypeExtractor
  RichMapFunction<?, ?> function = new RichMapFunction<ChainedTwo<Integer>, ChainedTwo<Integer>>() {
    private static final long serialVersionUID = 1L;
    @Override
    public ChainedTwo<Integer> map(ChainedTwo<Integer> value) throws Exception {
      return null;
    }            
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple3<String, Long, Integer>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(3, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(ChainedTwo.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(1));
  Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, tti.getTypeAt(2));
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGenericsNotInSuperclassWithNonGenericClassAtEnd() {
  // use TypeExtractor
  RichMapFunction<?, ?> function = new RichMapFunction<ChainedFour, ChainedFour>() {
    private static final long serialVersionUID = 1L;
    @Override
    public ChainedFour map(ChainedFour value) throws Exception {
      return null;
    }            
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple3<String, Long, String>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(3, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(ChainedFour.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(1));
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(2));
}
origin: apache/flink

@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testGenericsInDirectSuperclass() {
  // use TypeExtractor
  RichMapFunction<?, ?> function = new RichMapFunction<ChainedThree, ChainedThree>() {
    private static final long serialVersionUID = 1L;
    @Override
    public ChainedThree map(ChainedThree value) throws Exception {
      return null;
    }            
  };
  TypeInformation<?> ti = TypeExtractor.getMapReturnTypes(function, (TypeInformation) TypeInformation.of(new TypeHint<Tuple3<String, Long, String>>(){}));
  Assert.assertTrue(ti.isTupleType());
  Assert.assertEquals(3, ti.getArity());
  
  TupleTypeInfo<?> tti = (TupleTypeInfo<?>) ti;
  Assert.assertEquals(ChainedThree.class, tti.getTypeClass());
  
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(0));
  Assert.assertEquals(BasicTypeInfo.LONG_TYPE_INFO, tti.getTypeAt(1));
  Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tti.getTypeAt(2));
}

origin: apache/flink

Assert.assertEquals(Tuple3.class, tti.getTypeClass());
origin: apache/flink

Assert.assertEquals(Tuple9.class, tti.getTypeClass());
origin: org.apache.flink/flink-core

@SuppressWarnings("unchecked")
@Override
@PublicEvolving
public TupleSerializer<T> createSerializer(ExecutionConfig executionConfig) {
  if (getTypeClass() == Tuple0.class) {
    return (TupleSerializer<T>) Tuple0Serializer.INSTANCE;
  }
  TypeSerializer<?>[] fieldSerializers = new TypeSerializer<?>[getArity()];
  for (int i = 0; i < types.length; i++) {
    fieldSerializers[i] = types[i].createSerializer(executionConfig);
  }
  
  Class<T> tupleClass = getTypeClass();
  
  return new TupleSerializer<T>(tupleClass, fieldSerializers);
}
origin: com.alibaba.blink/flink-core

@SuppressWarnings("unchecked")
@Override
@PublicEvolving
public TupleSerializer<T> createSerializer(ExecutionConfig executionConfig) {
  if (getTypeClass() == Tuple0.class) {
    return (TupleSerializer<T>) Tuple0Serializer.INSTANCE;
  }
  TypeSerializer<?>[] fieldSerializers = new TypeSerializer<?>[getArity()];
  for (int i = 0; i < types.length; i++) {
    fieldSerializers[i] = types[i].createSerializer(executionConfig);
  }
  
  Class<T> tupleClass = getTypeClass();
  
  return new TupleSerializer<T>(tupleClass, fieldSerializers);
}
org.apache.flink.api.java.typeutilsTupleTypeInfogetTypeClass

Popular methods of TupleTypeInfo

  • <init>
  • getTypeAt
  • createSerializer
  • getArity
  • getBasicAndBasicValueTupleTypeInfo
  • getBasicTupleTypeInfo
  • getFieldIndex
  • canEqual
  • createComparator
  • equals
  • getFlatFields
  • getFlatFields

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now