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

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

Best Java code snippets using org.apache.flink.api.java.typeutils.TupleTypeInfo.getArity (Showing top 20 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

/**
 * Constructor which is overwriting the default constructor.
 * @param type Types of tuple whether to check if given fields are key types.
 * @param fields Array of integers which are used as key for comparison. The order of indexes
 * is regarded in the reduce function. First index has highest priority and last index has
 * least priority.
 */
public SelectByMinFunction(TupleTypeInfo<T> type, int... fields) {
  this.fields = fields;
  // Check correctness of each position
  for (int field : fields) {
    // Is field inside array
    if (field < 0 || field >= type.getArity()) {
      throw new java.lang.IndexOutOfBoundsException(
          "MinReduceFunction field position " + field + " is out of range.");
    }
    // Check whether type is comparable
    if (!type.getTypeAt(field).isKeyType()) {
      throw new java.lang.IllegalArgumentException(
          "MinReduceFunction supports only key(Comparable) types.");
    }
  }
}
origin: apache/flink

/**
 * Constructor which is overwriting the default constructor.
 * @param type Types of tuple whether to check if given fields are key types.
 * @param fields Array of integers which are used as key for comparison. The order of indexes
 * is regarded in the reduce function. First index has highest priority and last index has
 * least priority.
 */
public SelectByMaxFunction(TupleTypeInfo<T> type, int... fields) {
  this.fields = fields;
  // Check correctness of each position
  for (int field : fields) {
    // Is field inside array
    if (field < 0 || field >= type.getArity()) {
      throw new IndexOutOfBoundsException(
          "MinReduceFunction field position " + field + " is out of range.");
    }
    // Check whether type is comparable
    if (!type.getTypeAt(field).isKeyType()) {
      throw new java.lang.IllegalArgumentException(
          "MinReduceFunction supports only key(Comparable) types.");
    }
  }
}
origin: apache/flink

SimpleTupleFieldAccessor(int pos, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
      typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.fieldType = ((TupleTypeInfo) typeInfo).getTypeAt(pos);
}
origin: apache/flink

RecursiveTupleFieldAccessor(int pos, FieldAccessor<R, F> innerAccessor, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  checkNotNull(innerAccessor, "innerAccessor must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
        typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.innerAccessor = innerAccessor;
  this.fieldType = innerAccessor.fieldType;
}
origin: apache/flink

/**
 * Configures the reader to read the CSV data and parse it to the given type. The type must be a subclass of
 * {@link Tuple}. The type information for the fields is obtained from the type class. The type
 * consequently needs to specify all generic field types of the tuple.
 *
 * @param targetType The class of the target type, needs to be a subclass of Tuple.
 * @return The DataSet representing the parsed CSV data.
 */
public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) {
  Preconditions.checkNotNull(targetType, "The target type class must not be null.");
  if (!Tuple.class.isAssignableFrom(targetType)) {
    throw new IllegalArgumentException("The target type must be a subclass of " + Tuple.class.getName());
  }
  @SuppressWarnings("unchecked")
  TupleTypeInfo<T> typeInfo = (TupleTypeInfo<T>) TypeExtractor.createTypeInfo(targetType);
  CsvInputFormat<T> inputFormat = new TupleCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, typeInfo, this.includedMask);
  Class<?>[] classes = new Class<?>[typeInfo.getArity()];
  for (int i = 0; i < typeInfo.getArity(); i++) {
    classes[i] = typeInfo.getTypeAt(i).getTypeClass();
  }
  configureInputFormat(inputFormat);
  return new DataSource<T>(executionContext, inputFormat, typeInfo, Utils.getCallLocationName());
}
origin: apache/flink

/**
 * @deprecated Deprecated method only kept for compatibility.
 */
@SuppressWarnings("unchecked")
@Deprecated
@PublicEvolving
public <R extends Tuple> ProjectOperator<IN, R> types(Class<?>... types) {
  TupleTypeInfo<R> typeInfo = (TupleTypeInfo<R>) this.getResultType();
  if (types.length != typeInfo.getArity()) {
    throw new InvalidProgramException("Provided types do not match projection.");
  }
  for (int i = 0; i < types.length; i++) {
    Class<?> typeClass = types[i];
    if (!typeClass.equals(typeInfo.getTypeAt(i).getTypeClass())) {
      throw new InvalidProgramException("Provided type " + typeClass.getSimpleName() + " at position " + i + " does not match projection");
    }
  }
  return (ProjectOperator<IN, R>) this;
}
origin: apache/flink

/**
 * @deprecated Deprecated method only kept for compatibility.
 *
 * @param types
 */
@SuppressWarnings({ "unchecked", "hiding" })
@Deprecated
@PublicEvolving
public <OUT extends Tuple> JoinOperator<I1, I2, OUT> types(Class<?>... types) {
  TupleTypeInfo<OUT> typeInfo = (TupleTypeInfo<OUT>) this.getResultType();
  if (types.length != typeInfo.getArity()) {
    throw new InvalidProgramException("Provided types do not match projection.");
  }
  for (int i = 0; i < types.length; i++) {
    Class<?> typeClass = types[i];
    if (!typeClass.equals(typeInfo.getTypeAt(i).getTypeClass())) {
      throw new InvalidProgramException("Provided type " + typeClass.getSimpleName() + " at position " + i + " does not match projection");
    }
  }
  return (JoinOperator<I1, I2, OUT>) this;
}
origin: apache/flink

  numFieldsDs1 = ((TupleTypeInfo<?>) ds1.getType()).getArity();
  isFirstTuple = true;
} else {
  numFieldsDs2 = ((TupleTypeInfo<?>) ds2.getType()).getArity();
  isSecondTuple = true;
} else {
origin: apache/flink

/**
 * @deprecated Deprecated method only kept for compatibility.
 */
@SuppressWarnings({ "hiding", "unchecked" })
@Deprecated
@PublicEvolving
public <OUT extends Tuple> CrossOperator<I1, I2, OUT> types(Class<?>... types) {
  TupleTypeInfo<OUT> typeInfo = (TupleTypeInfo<OUT>) this.getResultType();
  if (types.length != typeInfo.getArity()) {
    throw new InvalidProgramException("Provided types do not match projection.");
  }
  for (int i = 0; i < types.length; i++) {
    Class<?> typeClass = types[i];
    if (!typeClass.equals(typeInfo.getTypeAt(i).getTypeClass())) {
      throw new InvalidProgramException("Provided type " + typeClass.getSimpleName() + " at position " + i + " does not match projection");
    }
  }
  return (CrossOperator<I1, I2, OUT>) this;
}
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

if (subTypes.length != tti.getArity()) {
  throw new InvalidTypesException("Tuple arity '" + tti.getArity() + "' expected but was '"
      + subTypes.length + "'.");
origin: apache/flink

@Test
public void testMultiLevelDerivedInputFormatType() {
  try {
    // composite type
    {
      InputFormat<?, ?> format = new FinalRelativeInputFormat();
      TypeInformation<?> typeInfo = TypeExtractor.getInputFormatTypes(format);
      
      assertTrue(typeInfo.isTupleType());
      assertTrue(typeInfo instanceof TupleTypeInfo);
      
      @SuppressWarnings("unchecked")
      TupleTypeInfo<Tuple3<String, Integer, Double>> tupleInfo = (TupleTypeInfo<Tuple3<String, Integer, Double>>) typeInfo;
      
      assertEquals(3, tupleInfo.getArity());
      assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tupleInfo.getTypeAt(0));
      assertEquals(BasicTypeInfo.INT_TYPE_INFO, tupleInfo.getTypeAt(1));
      assertEquals(BasicTypeInfo.DOUBLE_TYPE_INFO, tupleInfo.getTypeAt(2));
    }
  }
  catch (Exception e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
}

origin: apache/flink

TupleTypeInfo<Tuple3<String, Short, Double>> tupleInfo = (TupleTypeInfo<Tuple3<String, Short, Double>>) typeInfo;
assertEquals(3, tupleInfo.getArity());
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, tupleInfo.getTypeAt(0));
assertEquals(BasicTypeInfo.SHORT_TYPE_INFO, tupleInfo.getTypeAt(1));
origin: org.apache.flink/flink-streaming-java_2.10

SimpleTupleFieldAccessor(int pos, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
      typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.fieldType = ((TupleTypeInfo) typeInfo).getTypeAt(pos);
}
origin: org.apache.flink/flink-streaming-java

SimpleTupleFieldAccessor(int pos, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
      typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.fieldType = ((TupleTypeInfo) typeInfo).getTypeAt(pos);
}
origin: org.apache.flink/flink-streaming-java

RecursiveTupleFieldAccessor(int pos, FieldAccessor<R, F> innerAccessor, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  checkNotNull(innerAccessor, "innerAccessor must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
        typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.innerAccessor = innerAccessor;
  this.fieldType = innerAccessor.fieldType;
}
origin: org.apache.flink/flink-streaming-java_2.11

RecursiveTupleFieldAccessor(int pos, FieldAccessor<R, F> innerAccessor, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  checkNotNull(innerAccessor, "innerAccessor must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
        typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.innerAccessor = innerAccessor;
  this.fieldType = innerAccessor.fieldType;
}
origin: org.apache.flink/flink-streaming-java_2.11

SimpleTupleFieldAccessor(int pos, TypeInformation<T> typeInfo) {
  checkNotNull(typeInfo, "typeInfo must not be null.");
  int arity = ((TupleTypeInfo) typeInfo).getArity();
  if (pos < 0 || pos >= arity) {
    throw new CompositeType.InvalidFieldReferenceException(
      "Tried to select " + ((Integer) pos).toString() + ". field on \"" +
      typeInfo.toString() + "\", which is an invalid index.");
  }
  this.pos = pos;
  this.fieldType = ((TupleTypeInfo) typeInfo).getTypeAt(pos);
}
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.typeutilsTupleTypeInfogetArity

Popular methods of TupleTypeInfo

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

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • getSystemService (Context)
  • orElseThrow (Optional)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Collectors (java.util.stream)
  • JOptionPane (javax.swing)
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