Search in sources :

Example 11 with ColumnMetadata

use of com.questdb.store.factory.configuration.ColumnMetadata in project questdb by bluestreak01.

the class VarAggregator method prepare.

@Override
public void prepare(ObjList<RecordColumnMetadata> columns, int offset) {
    columns.add(INTERNAL_COL_TOTAL);
    columns.add(INTERNAL_COL_LOCAL_TOTAL);
    columns.add(INTERNAL_COL_SUM);
    columns.add(INTERNAL_COL_MEAN_HEAD);
    columns.add(INTERNAL_COL_MEAN_TAIL);
    columns.add(INTERNAL_COL_VALUES_HEAD);
    columns.add(INTERNAL_COL_VALUES_TAIL);
    columns.add(new ColumnMetadata().setName(getName()).setType(ColumnType.DOUBLE));
    oTotal = offset;
    oPartialTotal = offset + 1;
    oPartialSum = offset + 2;
    oPartialHead = offset + 3;
    oPartialTail = offset + 4;
    oValuesHead = offset + 5;
    oValuesTail = offset + 6;
    oVariance = offset + 7;
}
Also used : RecordColumnMetadata(com.questdb.common.RecordColumnMetadata) ColumnMetadata(com.questdb.store.factory.configuration.ColumnMetadata)

Example 12 with ColumnMetadata

use of com.questdb.store.factory.configuration.ColumnMetadata in project questdb by bluestreak01.

the class PlainTextStoringParser method mapColumnsAndOpenWriter.

@SuppressWarnings("unchecked")
private JournalWriter mapColumnsAndOpenWriter() throws JournalException {
    JournalMetadata<Object> jm = factory.getMetadata(name);
    if (jm.getColumnCount() != metadata.size()) {
        throw ImportColumnCountException.INSTANCE;
    }
    for (int i = 0, n = metadata.size(); i < n; i++) {
        ImportedColumnMetadata im = metadata.getQuick(i);
        ColumnMetadata cm = jm.getColumnQuick(i);
        im.importedColumnType = cm.type;
    }
    return factory.writer(jm);
}
Also used : ColumnMetadata(com.questdb.store.factory.configuration.ColumnMetadata) ImportedColumnMetadata(com.questdb.parser.ImportedColumnMetadata) ImportedColumnMetadata(com.questdb.parser.ImportedColumnMetadata)

Example 13 with ColumnMetadata

use of com.questdb.store.factory.configuration.ColumnMetadata in project questdb by bluestreak01.

the class PlainTextStoringParser method createStructure.

private JournalStructure createStructure() {
    ObjList<ColumnMetadata> m = new ObjList<>(metadata.size());
    for (int i = 0, n = metadata.size(); i < n; i++) {
        ColumnMetadata cm = new ColumnMetadata();
        ImportedColumnMetadata im = metadata.getQuick(i);
        cm.name = im.name.toString();
        cm.type = im.importedColumnType;
        switch(cm.type) {
            case ColumnType.STRING:
                cm.size = cm.avgSize + 4;
                break;
            default:
                cm.size = ColumnType.sizeOf(cm.type);
                break;
        }
        m.add(cm);
    }
    return new JournalStructure(name, m);
}
Also used : ColumnMetadata(com.questdb.store.factory.configuration.ColumnMetadata) ImportedColumnMetadata(com.questdb.parser.ImportedColumnMetadata) ImportedColumnMetadata(com.questdb.parser.ImportedColumnMetadata) JournalStructure(com.questdb.store.factory.configuration.JournalStructure)

Example 14 with ColumnMetadata

use of com.questdb.store.factory.configuration.ColumnMetadata in project questdb by bluestreak01.

the class QueryCompiler method createStructure.

private JournalStructure createStructure(String location, RecordMetadata rm, CharSequenceObjHashMap<ColumnCastModel> castModels) throws ParserException {
    int n = rm.getColumnCount();
    ObjList<ColumnMetadata> m = new ObjList<>(n);
    for (int i = 0; i < n; i++) {
        ColumnMetadata cm = new ColumnMetadata();
        RecordColumnMetadata im = rm.getColumnQuick(i);
        cm.name = im.getName();
        int srcType = im.getType();
        ColumnCastModel castModel = castModels.get(cm.name);
        if (castModel != null) {
            validateTypeCastCompatibility(srcType, castModel);
            cm.type = castModel.getColumnType();
            if (cm.type == ColumnType.SYMBOL) {
                cm.distinctCountHint = Numbers.ceilPow2(castModel.getCount()) - 1;
            }
        } else {
            cm.type = srcType;
        }
        switch(cm.type) {
            case ColumnType.STRING:
                cm.size = cm.avgSize + 4;
                break;
            default:
                cm.size = ColumnType.sizeOf(cm.type);
                break;
        }
        m.add(cm);
    }
    return new JournalStructure(location, m).$ts(rm.getTimestampIndex());
}
Also used : ColumnMetadata(com.questdb.store.factory.configuration.ColumnMetadata) JournalStructure(com.questdb.store.factory.configuration.JournalStructure)

Aggregations

ColumnMetadata (com.questdb.store.factory.configuration.ColumnMetadata)14 RecordColumnMetadata (com.questdb.common.RecordColumnMetadata)3 JournalException (com.questdb.std.ex.JournalException)3 JournalStructure (com.questdb.store.factory.configuration.JournalStructure)3 ImportedColumnMetadata (com.questdb.parser.ImportedColumnMetadata)2 IntervalRecordSource (com.questdb.ql.interval.IntervalRecordSource)1 AsOfJoinRecordSource (com.questdb.ql.join.AsOfJoinRecordSource)1 AsOfPartitionedJoinRecordSource (com.questdb.ql.join.AsOfPartitionedJoinRecordSource)1 CrossJoinRecordSource (com.questdb.ql.join.CrossJoinRecordSource)1 HashJoinRecordSource (com.questdb.ql.join.HashJoinRecordSource)1 SelectedColumnsRecordSource (com.questdb.ql.select.SelectedColumnsRecordSource)1 RBTreeSortedRecordSource (com.questdb.ql.sort.RBTreeSortedRecordSource)1 VirtualColumnRecordSource (com.questdb.ql.virtual.VirtualColumnRecordSource)1 JournalWriter (com.questdb.store.JournalWriter)1 File (java.io.File)1