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;
}
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);
}
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);
}
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());
}
Aggregations