All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickzetta.platform.common.CommonSchemaConvert Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.clickzetta.platform.common;

import cz.proto.FieldSchema;
import cz.proto.MetadataEntity;

import java.util.ArrayList;
import java.util.List;

public class CommonSchemaConvert extends SchemaConvert {

  @Override
  public Schema convertToExternalSchema(MetadataEntity.Entity meta) {
    List fields = meta.getTable().getTableSchema().getFieldsList();
    List columns = new ArrayList<>();
    List keyColumns = new ArrayList<>();
    List sortColumns = new ArrayList<>();

    columns.add(buildVirtualColumnSchema(Constant.VIRTUAL_NORMAL_KEY));
    for (FieldSchema field : fields) {
        columns.add(buildColumnSchema(field, false));
    }
    return new Schema(columns, keyColumns, sortColumns);
  }

  @Override
  public Schema convertToExternalKeySchema(MetadataEntity.Entity meta) {
    List fields = meta.getTable().getTableSchema().getFieldsList();
    List columns = new ArrayList<>();
    List keyColumns = new ArrayList<>();
    List sortColumns = new ArrayList<>();

    columns.add(buildVirtualColumnSchema(Constant.VIRTUAL_NORMAL_KEY));
    return new Schema(columns, keyColumns, sortColumns);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy