本文整理汇总了Java中org.apache.flink.api.common.typeutils.CompositeType.InvalidFieldReferenceException方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeType.InvalidFieldReferenceException方法的具体用法?Java CompositeType.InvalidFieldReferenceException怎么用?Java CompositeType.InvalidFieldReferenceException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.api.common.typeutils.CompositeType
的用法示例。
在下文中一共展示了CompositeType.InvalidFieldReferenceException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decomposeFieldExpression
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
private static FieldExpression decomposeFieldExpression(String fieldExpression) {
Matcher matcher = PATTERN_NESTED_FIELDS_WILDCARD.matcher(fieldExpression);
if (!matcher.matches()) {
throw new CompositeType.InvalidFieldReferenceException("Invalid field expression \"" + fieldExpression + "\".");
}
String head = matcher.group(0);
if (head.equals(Keys.ExpressionKeys.SELECT_ALL_CHAR) || head.equals(Keys.ExpressionKeys.SELECT_ALL_CHAR_SCALA)) {
throw new CompositeType.InvalidFieldReferenceException("No wildcards are allowed here.");
} else {
head = matcher.group(1);
}
String tail = matcher.group(3);
return new FieldExpression(head, tail);
}
示例2: RecursiveTupleFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
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.");
}
if (pos < 0) {
throw new CompositeType.InvalidFieldReferenceException("Tried to select " + ((Integer) pos).toString() + ". field.");
}
this.pos = pos;
this.innerAccessor = innerAccessor;
this.fieldType = innerAccessor.fieldType;
}
示例3: RecursiveProductFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
RecursiveProductFieldAccessor(int pos, TypeInformation<T> typeInfo, FieldAccessor<R, F> innerAccessor, ExecutionConfig config) {
int arity = ((TupleTypeInfoBase) 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.");
}
checkNotNull(typeInfo, "typeInfo must not be null.");
checkNotNull(innerAccessor, "innerAccessor must not be null.");
this.pos = pos;
this.fieldType = ((TupleTypeInfoBase<T>) typeInfo).getTypeAt(pos);
this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(config);
this.length = this.serializer.getArity();
this.fields = new Object[this.length];
this.innerAccessor = innerAccessor;
}
示例4: testFailOnNestedPojoFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testFailOnNestedPojoFieldAccessor() throws Exception {
StreamExecutionEnvironment see = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<Data> dataStream = see.fromCollection(elements);
dataStream.keyBy("aaa", "stats.count").sum("stats.nonExistingField");
}
示例5: testFailTupleInv
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testFailTupleInv() {
final ExecutionEnvironment env = ExecutionEnvironment
.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env
.fromCollection(emptyTupleData, tupleTypeInfo);
// must not work
tupleDs.writeAsText("/tmp/willNotHappen")
.sortLocalOutput("notThere", Order.ASCENDING)
.sortLocalOutput("f4", Order.DESCENDING);
}
示例6: testFailPojoInvalidField
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testFailPojoInvalidField() {
final ExecutionEnvironment env = ExecutionEnvironment
.getExecutionEnvironment();
DataSet<CustomType> pojoDs = env
.fromCollection(pojoData);
// must not work
pojoDs.writeAsText("/tmp/willNotHappen")
.sortLocalOutput("myInt", Order.ASCENDING)
.sortLocalOutput("notThere", Order.DESCENDING);
}
示例7: testRightOuter8
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testRightOuter8() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
// invalid key reference
ds1.rightOuterJoin(ds2)
.where(1).equalTo("f5")
.with(new DummyJoin());
}
示例8: testLeftOuter8
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testLeftOuter8() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
// invalid key reference
ds1.leftOuterJoin(ds2)
.where(1).equalTo("f5")
.with(new DummyJoin());
}
示例9: testFullOuter8
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testFullOuter8() {
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
// invalid key reference
ds1.fullOuterJoin(ds2)
.where(1).equalTo("f5")
.with(new DummyJoin());
}
示例10: ArrayFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
public ArrayFieldAccessor(int pos, TypeInformation typeInfo) {
if (pos < 0) {
throw new CompositeType.InvalidFieldReferenceException("The " + ((Integer) pos).toString() + ". field selected on" +
" an array, which is an invalid index.");
}
checkNotNull(typeInfo, "typeInfo must not be null.");
this.pos = pos;
this.fieldType = BasicTypeInfo.getInfoFor(typeInfo.getTypeClass().getComponentType());
}
示例11: SimpleTupleFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
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);
}
示例12: SimpleProductFieldAccessor
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
SimpleProductFieldAccessor(int pos, TypeInformation<T> typeInfo, ExecutionConfig config) {
checkNotNull(typeInfo, "typeInfo must not be null.");
int arity = ((TupleTypeInfoBase) 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 = ((TupleTypeInfoBase<T>) typeInfo).getTypeAt(pos);
this.serializer = (TupleSerializerBase<T>) typeInfo.createSerializer(config);
this.length = this.serializer.getArity();
this.fields = new Object[this.length];
}
示例13: testIllegalFlatTuple
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testIllegalFlatTuple() {
Tuple2<String, Integer> t = Tuple2.of("aa", 5);
TupleTypeInfo<Tuple2<String, Integer>> tpeInfo =
(TupleTypeInfo<Tuple2<String, Integer>>) TypeExtractor.getForObject(t);
FieldAccessorFactory.getAccessor(tpeInfo, "illegal", null);
}
示例14: testIllegalTupleField
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
@SuppressWarnings("unchecked")
public void testIllegalTupleField() {
FieldAccessorFactory.getAccessor(TupleTypeInfo.getBasicTupleTypeInfo(Integer.class, Integer.class), 2, null);
}
示例15: testIllegalTupleInPojoInTuple
import org.apache.flink.api.common.typeutils.CompositeType; //导入方法依赖的package包/类
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testIllegalTupleInPojoInTuple() {
Tuple2<String, Foo> t = Tuple2.of("aa", new Foo(8, Tuple2.of("ddd", 9L), (short) 2));
TupleTypeInfo<Tuple2<String, Foo>> tpeInfo =
(TupleTypeInfo<Tuple2<String, Foo>>) TypeExtractor.getForObject(t);
FieldAccessorFactory.getAccessor(tpeInfo, "illegal.illegal.illegal", null);
}