public int getMaxRecordLength() { return getMaxColumnLength(colAll); }
public GTConvertDecorator(Set<TblColRef> unevaluatableColumnCollector, Map<TblColRef, Integer> colMapping, GTInfo info, boolean encodeConstants) { this.unevaluatableColumnCollector = unevaluatableColumnCollector; this.colMapping = colMapping; this.info = info; this.useEncodeConstants = encodeConstants; buf = ByteBuffer.allocate(info.getMaxColumnLength()); }
private boolean isMemoryHungry(ImmutableBitSet selectedColBlocks) { ImmutableBitSet selectColumns = fullGTInfo.selectColumns(selectedColBlocks); return fullGTInfo.getMaxColumnLength(selectColumns) > 1024; }
public FilterResultCache(GTInfo info, TupleFilter filter) { colsInFilter = collectColumnsInFilter(filter); lastValues = new byte[info.getMaxColumnLength(colsInFilter)]; lastResult = new boolean[1]; }
/** create a row block, allocate memory, get ready for writing */ public static GTRowBlock allocate(GTInfo info) { GTRowBlock b = new GTRowBlock(info); byte[] array = new byte[info.getMaxColumnLength(info.primaryKey)]; b.primaryKey.reset(array, 0, array.length); int maxRows = info.isRowBlockEnabled() ? info.rowBlockSize : 1; for (int i = 0; i < b.cellBlocks.length; i++) { array = new byte[info.getMaxColumnLength(info.colBlocks[i]) * maxRows]; b.cellBlocks[i].reset(array, 0, array.length); } return b; }
private void setMetricsValues(GTRecord record, Object[] metricsValues) { ImmutableBitSet metrics = getMetricsColumns(record); if (reuseMetricsSpace == null) { reuseMetricsSpace = new ByteArray(record.getInfo().getMaxColumnLength(metrics)); } record.setValues(metrics, reuseMetricsSpace, metricsValues); }
private void setMetricsValues(GTRecord record, Object[] metricsValues) { ImmutableBitSet metrics = getMetricsColumns(record); if (reuseMetricsSpace == null) { reuseMetricsSpace = new ByteArray(record.getInfo().getMaxColumnLength(metrics)); } record.setValues(metrics, reuseMetricsSpace, metricsValues); }
public static ByteArray enc(GTInfo info, int col, String value) { ByteBuffer buf = ByteBuffer.allocate(info.getMaxColumnLength()); info.getCodeSystem().encodeColumnValue(col, value, buf); return ByteArray.copyOf(buf.array(), buf.arrayOffset(), buf.position()); }
public BufferedMeasureCodec createMeasureCodec() { DataType[] metricTypes = new DataType[aggrMetrics.trueBitCount()]; for (int i = 0; i < metricTypes.length; i++) { metricTypes[i] = info.getColumnType(aggrMetrics.trueBitAt(i)); } BufferedMeasureCodec codec = new BufferedMeasureCodec(metricTypes); codec.setBufferSize(info.getMaxColumnLength(aggrMetrics)); return codec; }
private ByteArray encodeTime(long ts, int index, int roundingFlag) { String value; DataType partitionColType = info.getColumnType(index); if (partitionColType.isDate()) { value = DateFormat.formatToDateStr(ts); } else if (partitionColType.isTimeFamily()) { value = DateFormat.formatToTimeWithoutMilliStr(ts); } else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101 String partitionDateFormat = segment.getModel().getPartitionDesc().getPartitionDateFormat(); if (StringUtils.isEmpty(partitionDateFormat)) { value = "" + ts; } else { value = DateFormat.formatToDateStr(ts, partitionDateFormat); } } else { throw new RuntimeException("Type " + partitionColType + " is not valid partition column type"); } ByteBuffer buffer = ByteBuffer.allocate(info.getMaxColumnLength()); info.getCodeSystem().encodeColumnValue(index, value, roundingFlag, buffer); return ByteArray.copyOf(buffer.array(), 0, buffer.position()); } }
public int getMaxRecordLength() { return getMaxColumnLength(colAll); }
public GTConvertDecorator(Set<TblColRef> unevaluatableColumnCollector, Map<TblColRef, Integer> colMapping, GTInfo info, boolean encodeConstants) { this.unevaluatableColumnCollector = unevaluatableColumnCollector; this.colMapping = colMapping; this.info = info; this.useEncodeConstants = encodeConstants; buf = ByteBuffer.allocate(info.getMaxColumnLength()); }
public FilterResultCache(GTInfo info, TupleFilter filter) { colsInFilter = collectColumnsInFilter(filter); lastValues = new byte[info.getMaxColumnLength(colsInFilter)]; lastResult = new boolean[1]; }
private boolean isMemoryHungry(ImmutableBitSet selectedColBlocks) { ImmutableBitSet selectColumns = fullGTInfo.selectColumns(selectedColBlocks); return fullGTInfo.getMaxColumnLength(selectColumns) > 1024; }
/** create a row block, allocate memory, get ready for writing */ public static GTRowBlock allocate(GTInfo info) { GTRowBlock b = new GTRowBlock(info); byte[] array = new byte[info.getMaxColumnLength(info.primaryKey)]; b.primaryKey.reset(array, 0, array.length); int maxRows = info.isRowBlockEnabled() ? info.rowBlockSize : 1; for (int i = 0; i < b.cellBlocks.length; i++) { array = new byte[info.getMaxColumnLength(info.colBlocks[i]) * maxRows]; b.cellBlocks[i].reset(array, 0, array.length); } return b; }
private void setMetricsValues(GTRecord record, Object[] metricsValues) { ImmutableBitSet metrics = getMetricsColumns(record); if (reuseMetricsSpace == null) { reuseMetricsSpace = new ByteArray(record.getInfo().getMaxColumnLength(metrics)); } record.setValues(metrics, reuseMetricsSpace, metricsValues); }
private void setMetricsValues(GTRecord record, Object[] metricsValues) { ImmutableBitSet metrics = getMetricsColumns(record); if (reuseMetricsSpace == null) { reuseMetricsSpace = new ByteArray(record.getInfo().getMaxColumnLength(metrics)); } record.setValues(metrics, reuseMetricsSpace, metricsValues); }
public BufferedMeasureCodec createMeasureCodec() { DataType[] metricTypes = new DataType[aggrMetrics.trueBitCount()]; for (int i = 0; i < metricTypes.length; i++) { metricTypes[i] = info.getColumnType(aggrMetrics.trueBitAt(i)); } BufferedMeasureCodec codec = new BufferedMeasureCodec(metricTypes); codec.setBufferSize(info.getMaxColumnLength(aggrMetrics)); return codec; }
private ByteArray encodeTime(long ts, int index, int roundingFlag) { String value; DataType partitionColType = info.getColumnType(index); if (partitionColType.isDate()) { value = DateFormat.formatToDateStr(ts); } else if (partitionColType.isTimeFamily()) { value = DateFormat.formatToTimeWithoutMilliStr(ts); } else if (partitionColType.isStringFamily() || partitionColType.isIntegerFamily()) {//integer like 20160101 String partitionDateFormat = segment.getModel().getPartitionDesc().getPartitionDateFormat(); if (StringUtils.isEmpty(partitionDateFormat)) { value = "" + ts; } else { value = DateFormat.formatToDateStr(ts, partitionDateFormat); } } else { throw new RuntimeException("Type " + partitionColType + " is not valid partition column type"); } ByteBuffer buffer = ByteBuffer.allocate(info.getMaxColumnLength()); info.getCodeSystem().encodeColumnValue(index, value, roundingFlag, buffer); return ByteArray.copyOf(buffer.array(), 0, buffer.position()); } }