use of org.apache.carbondata.core.datamap.DataMapMeta in project carbondata by apache.
the class LuceneDataMapFactoryBase method init.
@Override
public void init(AbsoluteTableIdentifier identifier, DataMapSchema dataMapSchema) throws IOException, MalformedDataMapCommandException {
Objects.requireNonNull(identifier);
Objects.requireNonNull(dataMapSchema);
this.tableIdentifier = identifier;
this.dataMapName = dataMapSchema.getDataMapName();
// get carbonmetadata from carbonmetadata instance
CarbonMetadata carbonMetadata = CarbonMetadata.getInstance();
String tableUniqueName = identifier.getCarbonTableIdentifier().getTableUniqueName();
// get carbon table
CarbonTable carbonTable = carbonMetadata.getCarbonTable(tableUniqueName);
if (carbonTable == null) {
String errorMessage = String.format("failed to get carbon table with name %s", tableUniqueName);
LOGGER.error(errorMessage);
throw new IOException(errorMessage);
}
// validate DataMapSchema and get index columns
List<String> indexedColumns = validateAndGetIndexedColumns(dataMapSchema, carbonTable);
// add optimizedOperations
List<ExpressionType> optimizedOperations = new ArrayList<ExpressionType>();
// optimizedOperations.add(ExpressionType.EQUALS);
// optimizedOperations.add(ExpressionType.GREATERTHAN);
// optimizedOperations.add(ExpressionType.GREATERTHAN_EQUALTO);
// optimizedOperations.add(ExpressionType.LESSTHAN);
// optimizedOperations.add(ExpressionType.LESSTHAN_EQUALTO);
// optimizedOperations.add(ExpressionType.NOT);
optimizedOperations.add(ExpressionType.TEXT_MATCH);
this.dataMapMeta = new DataMapMeta(indexedColumns, optimizedOperations);
// get analyzer
// TODO: how to get analyzer ?
analyzer = new StandardAnalyzer();
}
use of org.apache.carbondata.core.datamap.DataMapMeta in project carbondata by apache.
the class DataMapWriterListener method register.
/**
* Register a DataMapWriter
*/
private void register(DataMapFactory factory, String segmentId, String dataWritePath) {
assert (factory != null);
assert (segmentId != null);
DataMapMeta meta = factory.getMeta();
if (meta == null) {
// if data map does not have meta, no need to register
return;
}
List<String> columns = factory.getMeta().getIndexedColumns();
List<DataMapWriter> writers = registry.get(columns);
DataMapWriter writer = factory.createWriter(new Segment(segmentId, null), dataWritePath);
if (writers != null) {
writers.add(writer);
} else {
writers = new ArrayList<>();
writers.add(writer);
registry.put(columns, writers);
}
LOG.info("DataMapWriter " + writer + " added");
}
Aggregations