use of org.apache.flink.types.StringValue in project flink by apache.
the class ValueCollectionDataSets method getStringDataSet.
public static DataSet<StringValue> getStringDataSet(ExecutionEnvironment env) {
List<StringValue> data = new ArrayList<>();
data.add(new StringValue("Hi"));
data.add(new StringValue("Hello"));
data.add(new StringValue("Hello world"));
data.add(new StringValue("Hello world, how are you?"));
data.add(new StringValue("I am fine."));
data.add(new StringValue("Luke Skywalker"));
data.add(new StringValue("Random comment"));
data.add(new StringValue("LOL"));
Collections.shuffle(data);
return env.fromCollection(data);
}
use of org.apache.flink.types.StringValue in project flink by apache.
the class ValueCollectionDataSets method getPojoWithCollection.
public static DataSet<PojoWithCollection> getPojoWithCollection(ExecutionEnvironment env) {
List<PojoWithCollection> data = new ArrayList<>();
List<Pojo1> pojosList1 = new ArrayList<>();
pojosList1.add(new Pojo1("a", "aa"));
pojosList1.add(new Pojo1("b", "bb"));
List<Pojo1> pojosList2 = new ArrayList<>();
pojosList2.add(new Pojo1("a2", "aa2"));
pojosList2.add(new Pojo1("b2", "bb2"));
PojoWithCollection pwc1 = new PojoWithCollection();
pwc1.pojos = pojosList1;
pwc1.key = new IntValue(0);
pwc1.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
pwc1.scalaBigInt = BigInt.int2bigInt(10);
pwc1.bigDecimalKeepItNull = null;
// use calendar to make it stable across time zones
GregorianCalendar gcl1 = new GregorianCalendar(2033, 04, 18);
pwc1.sqlDate = new java.sql.Date(gcl1.getTimeInMillis());
pwc1.mixed = new ArrayList<Object>();
Map<StringValue, IntValue> map = new HashMap<>();
map.put(new StringValue("someKey"), new IntValue(1));
pwc1.mixed.add(map);
pwc1.mixed.add(new File("/this/is/wrong"));
pwc1.mixed.add("uhlala");
PojoWithCollection pwc2 = new PojoWithCollection();
pwc2.pojos = pojosList2;
pwc2.key = new IntValue(0);
pwc2.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
pwc2.scalaBigInt = BigInt.int2bigInt(31104000);
pwc2.bigDecimalKeepItNull = null;
GregorianCalendar gcl2 = new GregorianCalendar(1976, 4, 3);
// 1976
pwc2.sqlDate = new java.sql.Date(gcl2.getTimeInMillis());
data.add(pwc1);
data.add(pwc2);
return env.fromCollection(data);
}
use of org.apache.flink.types.StringValue in project flink by apache.
the class ValueCollectionDataSets method getSmallNestedTupleDataSet.
public static DataSet<Tuple2<Tuple2<IntValue, IntValue>, StringValue>> getSmallNestedTupleDataSet(ExecutionEnvironment env) {
List<Tuple2<Tuple2<IntValue, IntValue>, StringValue>> data = new ArrayList<>();
data.add(new Tuple2<>(new Tuple2<>(new IntValue(1), new IntValue(1)), new StringValue("one")));
data.add(new Tuple2<>(new Tuple2<>(new IntValue(2), new IntValue(2)), new StringValue("two")));
data.add(new Tuple2<>(new Tuple2<>(new IntValue(3), new IntValue(3)), new StringValue("three")));
TupleTypeInfo<Tuple2<Tuple2<IntValue, IntValue>, StringValue>> type = new TupleTypeInfo<>(new TupleTypeInfo<Tuple2<IntValue, IntValue>>(ValueTypeInfo.INT_VALUE_TYPE_INFO, ValueTypeInfo.INT_VALUE_TYPE_INFO), ValueTypeInfo.STRING_VALUE_TYPE_INFO);
return env.fromCollection(data, type);
}
Aggregations