use of org.apache.carbondata.core.index.IndexMeta in project carbondata by apache.
the class IndexWriterListener method register.
/**
* Register a IndexWriter
*/
private void register(IndexFactory factory, String segmentId, String taskNo, SegmentProperties segmentProperties) {
assert (factory != null);
assert (segmentId != null);
IndexMeta meta = factory.getMeta();
if (meta == null) {
// if index does not have meta, no need to register
return;
}
List<CarbonColumn> columns = factory.getMeta().getIndexedColumns();
List<IndexWriter> writers = registry.get(columns);
IndexWriter writer = null;
try {
writer = factory.createWriter(new Segment(segmentId), taskNo, segmentProperties);
} catch (IOException e) {
LOG.error("Failed to create IndexWriter: " + e.getMessage(), e);
throw new IndexWriterException(e);
}
if (writers != null) {
writers.add(writer);
} else {
writers = new ArrayList<>();
writers.add(writer);
registry.put(columns, writers);
}
LOG.info("IndexWriter " + writer + " added");
}
Aggregations