Search in sources :

Example 1 with SasFileProperties

use of com.epam.parso.SasFileProperties in project drill by apache.

the class SasBatchReader method addImplicitColumnsToSchema.

private TupleMetadata addImplicitColumnsToSchema(TupleMetadata schema) {
    SchemaBuilder builder = new SchemaBuilder();
    ColumnMetadata colSchema;
    builder.addAll(schema);
    SasFileProperties fileProperties = sasFileReader.getSasFileProperties();
    // Add String Metadata columns
    for (IMPLICIT_STRING_COLUMN name : IMPLICIT_STRING_COLUMN.values()) {
        colSchema = MetadataUtils.newScalar(name.getFieldName(), MinorType.VARCHAR, DataMode.OPTIONAL);
        colSchema.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
        builder.add(colSchema);
    }
    // Add Date Column Names
    for (IMPLICIT_DATE_COLUMN name : IMPLICIT_DATE_COLUMN.values()) {
        colSchema = MetadataUtils.newScalar(name.getFieldName(), MinorType.DATE, DataMode.OPTIONAL);
        colSchema.setBooleanProperty(ColumnMetadata.EXCLUDE_FROM_WILDCARD, true);
        builder.add(colSchema);
    }
    populateMetadata(fileProperties);
    return builder.build();
}
Also used : ColumnMetadata(org.apache.drill.exec.record.metadata.ColumnMetadata) SasFileProperties(com.epam.parso.SasFileProperties) SchemaBuilder(org.apache.drill.exec.record.metadata.SchemaBuilder)

Aggregations

SasFileProperties (com.epam.parso.SasFileProperties)1 ColumnMetadata (org.apache.drill.exec.record.metadata.ColumnMetadata)1 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)1