0

我将数据存储在 Tuple6 之类的元组中,并制作 SQL 语句,例如 select f1 from test。我的问题是我想设置列名而不是 f1、f2、f3。我还能拥有元组并设置列名称吗?

一些代码输入格式

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);

这里有一些代码表源

     @Override
public TableSchema getTableSchema() {
    return new TableSchema(WorkloadColunarInputFormat.type.getFieldNames(),WorkloadColunarInputFormat.columns);
}
4

0 回答 0