I have data stored in Tuples like Tuple6 and I make SQL statements like select f1 from test. My problem is I want to set column names instead of f1, f2, f3. Can I still have Tuple and set column Names?
Some code Input format
public Tuple6<Long, Integer, String, String, String, Double> nextRecord(Tuple6<Long, Integer, String, String, String, Double> row) throws IOException {
col1 = (IntValue) cfr.getRow()[0];
col2 = (IntValue) cfr.getRow()[1];
col3 = (StringValue) cfr.getRow()[2];
col4 = (StringValue) cfr.getRow()[3];
col5 = (StringValue) cfr.getRow()[4];
col6 = (DoubleValue) cfr.getRow()[5];
row.f0 = Long.valueOf(col1.getValue());
row.f1 = col2.getValue();
row.f2 = col3.getValue();
row.f3 = col4.getValue();
row.f4 = col5.getValue();
row.f5 = col6.getValue();
return row;
} @Override
public TypeInformation<Tuple6<Long,Integer, String, String, String, Double>> getProducedType() {
return type;
}
static TypeInformation[] columns = {
TypeInformation.of(Long.class),
TypeInformation.of(Integer.class),
TypeInformation.of(String.class),
TypeInformation.of(String.class),
TypeInformation.of(String.class),
TypeInformation.of(Double.class)
};
static TupleTypeInfo<Tuple6<Long, Integer, String, String, String, Double>> type = new TupleTypeInfo<>(columns);
And here some Code TableSource
@Override
public TableSchema getTableSchema() {
return new TableSchema(WorkloadColunarInputFormat.type.getFieldNames(),WorkloadColunarInputFormat.columns);
}