Search in sources :

Example 11 with ColumnStore

use of com.bakdata.conquery.models.events.stores.root.ColumnStore in project conquery by bakdata.

the class ImportJob method createImport.

private Import createImport(PreprocessedHeader header, Map<String, ColumnStore> stores, Column[] columns, int size) {
    Import imp = new Import(table);
    imp.setName(header.getName());
    imp.setNumberOfEntries(header.getRows());
    imp.setNumberOfEntities(size);
    final ImportColumn[] importColumns = new ImportColumn[columns.length];
    for (int i = 0; i < columns.length; i++) {
        final ColumnStore store = stores.get(columns[i].getName());
        ImportColumn col = new ImportColumn(imp, store.createDescription(), store.getLines(), store.estimateMemoryConsumptionBytes());
        col.setName(columns[i].getName());
        importColumns[i] = col;
    }
    imp.setColumns(importColumns);
    Set<DictionaryId> dictionaries = new HashSet<>();
    for (Column column : columns) {
        // only non-shared dictionaries need to be registered here
        if (column.getType() != MajorTypeId.STRING) {
            continue;
        }
        // shared dictionaries are not related to a specific import.
        if (column.getSharedDictionary() != null) {
            continue;
        }
        // Some StringStores don't have Dictionaries.
        final StringStore stringStore = (StringStore) stores.get(column.getName());
        if (!stringStore.isDictionaryHolding()) {
            continue;
        }
        dictionaries.add(stringStore.getUnderlyingDictionary().getId());
    }
    imp.setDictionaries(dictionaries);
    namespace.sendToAll(new AddImport(imp));
    return imp;
}
Also used : ColumnStore(com.bakdata.conquery.models.events.stores.root.ColumnStore) StringStore(com.bakdata.conquery.models.events.stores.root.StringStore) IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet)

Example 12 with ColumnStore

use of com.bakdata.conquery.models.events.stores.root.ColumnStore in project conquery by bakdata.

the class Bucket method calculateMap.

public Map<String, Object> calculateMap(int event) {
    Map<String, Object> out = new HashMap<>(stores.length);
    for (int i = 0; i < stores.length; i++) {
        ColumnStore store = stores[i];
        if (!store.has(event)) {
            continue;
        }
        out.put(getTable().getColumns()[i].getName(), store.createScriptValue(event));
    }
    return out;
}
Also used : ColumnStore(com.bakdata.conquery.models.events.stores.root.ColumnStore) HashMap(java.util.HashMap) ToString(lombok.ToString)

Aggregations

ColumnStore (com.bakdata.conquery.models.events.stores.root.ColumnStore)12 StringStore (com.bakdata.conquery.models.events.stores.root.StringStore)6 Dictionary (com.bakdata.conquery.models.dictionary.Dictionary)5 ConqueryConfig (com.bakdata.conquery.models.config.ConqueryConfig)4 IntOpenHashSet (it.unimi.dsi.fastutil.ints.IntOpenHashSet)4 DictionaryMapping (com.bakdata.conquery.models.dictionary.DictionaryMapping)3 Bucket (com.bakdata.conquery.models.events.Bucket)3 MajorTypeId (com.bakdata.conquery.models.events.MajorTypeId)3 Int2IntAVLTreeMap (it.unimi.dsi.fastutil.ints.Int2IntAVLTreeMap)3 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)3 IntList (it.unimi.dsi.fastutil.ints.IntList)3 NamespaceStorage (com.bakdata.conquery.io.storage.NamespaceStorage)2 com.bakdata.conquery.models.datasets (com.bakdata.conquery.models.datasets)2 IntegerDateStore (com.bakdata.conquery.models.events.stores.primitive.IntegerDateStore)2 IntegerStore (com.bakdata.conquery.models.events.stores.root.IntegerStore)2 JSONException (com.bakdata.conquery.models.exceptions.JSONException)2 IdMutex (com.bakdata.conquery.models.identifiable.IdMutex)2 com.bakdata.conquery.models.identifiable.ids.specific (com.bakdata.conquery.models.identifiable.ids.specific)2 com.bakdata.conquery.models.messages.namespaces.specific (com.bakdata.conquery.models.messages.namespaces.specific)2 PreprocessedData (com.bakdata.conquery.models.preproc.PreprocessedData)2