我有像Tuple6这样存储在元组中的数据,我从测试中选择f1之类的SQL语句。我的问题是我想设置列名而不是f1,f2,f3。我还可以使用Tuple并设置列名吗?
一些代码输入格式
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);
这里有一些Code TableSource
@Override
public TableSchema getTableSchema() {
return new TableSchema(WorkloadColunarInputFormat.type.getFieldNames(),WorkloadColunarInputFormat.columns);
}