Java Code Examples for org.apache.kylin.common.util.BytesUtil#readUTFString()

The following examples show how to use org.apache.kylin.common.util.BytesUtil#readUTFString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColumnTupleFilter.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Override
public void deserialize(byte[] bytes) {
    ColumnDesc column = new ColumnDesc();
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    String tableName = BytesUtil.readUTFString(buffer);
    if (tableName != null) {
        TableDesc table = new TableDesc();
        table.setName(tableName);
        column.setTable(table);
    }

    column.setName(BytesUtil.readUTFString(buffer));
    column.setDatatype(BytesUtil.readUTFString(buffer));

    this.columnRef = new TblColRef(column);
}
 
Example 2
Source File: DataType.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public DataType deserialize(ByteBuffer in) {
    String name = BytesUtil.readUTFString(in);
    int precision = BytesUtil.readVInt(in);
    int scale = BytesUtil.readVInt(in);

    return new DataType(name, precision, scale);
}
 
Example 3
Source File: CompareTupleFilter.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(byte[] bytes) {
    this.dynamicVariables.clear();
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    int size = BytesUtil.readVInt(buffer);
    for (int i = 0; i < size; i++) {
        String nameString = BytesUtil.readUTFString(buffer);
        String valueString = BytesUtil.readUTFString(buffer);
        bindVariable(nameString, valueString);
    }
    this.nullString = BytesUtil.readAsciiString(buffer);
}
 
Example 4
Source File: CompareTupleFilter.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {

    this.dynamicVariables.clear();
    int size = BytesUtil.readVInt(buffer);
    for (int i = 0; i < size; i++) {
        String name = BytesUtil.readUTFString(buffer);
        Object value = cs.deserialize(buffer);
        bindVariable(name, value);
    }
}
 
Example 5
Source File: MassInTupleFilter.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
    filterTableName = BytesUtil.readUTFString(buffer);
    filterTableResourceIdentifier = BytesUtil.readUTFString(buffer);
    filterTableType = Functions.FilterTableType.valueOf(BytesUtil.readUTFString(buffer));
    reverse = Boolean.parseBoolean(BytesUtil.readUTFString(buffer));
}
 
Example 6
Source File: DataType.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public DataType deserialize(ByteBuffer in) {
    String name = BytesUtil.readUTFString(in);
    int precision = BytesUtil.readVInt(in);
    int scale = BytesUtil.readVInt(in);

    return new DataType(name, precision, scale);
}
 
Example 7
Source File: CompareTupleFilter.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {

    this.dynamicVariables.clear();
    int size = BytesUtil.readVInt(buffer);
    for (int i = 0; i < size; i++) {
        String name = BytesUtil.readUTFString(buffer);
        Object value = cs.deserialize(buffer);
        bindVariable(name, value);
    }
}
 
Example 8
Source File: MassInTupleFilter.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
    filterTableName = BytesUtil.readUTFString(buffer);
    filterTableResourceIdentifier = BytesUtil.readUTFString(buffer);
    filterTableType = Functions.FilterTableType.valueOf(BytesUtil.readUTFString(buffer));
    reverse = Boolean.parseBoolean(BytesUtil.readUTFString(buffer));
}
 
Example 9
Source File: BuiltInFunctionTupleFilter.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
    this.name = BytesUtil.readUTFString(buffer);
    this.isReversed = buffer.get() != 0;
    this.initMethod();
}
 
Example 10
Source File: DictCodeSystem.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer buffer) {
    return BytesUtil.readUTFString(buffer);
}
 
Example 11
Source File: GTScanRequest.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public GTScanRequest deserialize(ByteBuffer in) {
    final int serialLevel = KylinConfig.getInstanceFromEnv().getGTScanRequestSerializationLevel();

    GTInfo sInfo = GTInfo.serializer.deserialize(in);

    List<GTScanRange> sRanges = Lists.newArrayList();
    int sRangesCount = BytesUtil.readVInt(in);
    for (int rangeIdx = 0; rangeIdx < sRangesCount; rangeIdx++) {
        GTRecord sPkStart = deserializeGTRecord(in, sInfo);
        GTRecord sPkEnd = deserializeGTRecord(in, sInfo);
        List<GTRecord> sFuzzyKeys = Lists.newArrayList();
        int sFuzzyKeySize = BytesUtil.readVInt(in);
        for (int i = 0; i < sFuzzyKeySize; i++) {
            sFuzzyKeys.add(deserializeGTRecord(in, sInfo));
        }
        GTScanRange sRange = new GTScanRange(sPkStart, sPkEnd, sFuzzyKeys);
        sRanges.add(sRange);
    }

    ImmutableBitSet sColumns = ImmutableBitSet.serializer.deserialize(in);
    TupleFilter sGTFilter = GTUtil.deserializeGTFilter(BytesUtil.readByteArray(in), sInfo);

    TupleFilter sGTHavingFilter = null;
    if (serialLevel >= SERIAL_1_HAVING_FILTER) {
        sGTHavingFilter = TupleFilterSerializer.deserialize(BytesUtil.readByteArray(in),
                StringCodeSystem.INSTANCE);
    }

    ImmutableBitSet sAggGroupBy = ImmutableBitSet.serializer.deserialize(in);
    ImmutableBitSet sAggrMetrics = ImmutableBitSet.serializer.deserialize(in);
    String[] sAggrMetricFuncs = BytesUtil.readAsciiStringArray(in);
    boolean sAllowPreAggr = (BytesUtil.readVInt(in) == 1);
    double sAggrCacheGB = in.getDouble();
    StorageLimitLevel storageLimitLevel = StorageLimitLevel.valueOf(BytesUtil.readUTFString(in));
    int storageScanRowNumThreshold = BytesUtil.readVInt(in);
    int storagePushDownLimit = BytesUtil.readVInt(in);
    long startTime = BytesUtil.readVLong(in);
    long timeout = BytesUtil.readVLong(in);
    String storageBehavior = BytesUtil.readUTFString(in);

    ImmutableBitSet aDynCols = ImmutableBitSet.serializer.deserialize(in);

    int nTupleExprs = BytesUtil.readVInt(in);
    Map<Integer, TupleExpression> sTupleExpressionMap = Maps.newHashMapWithExpectedSize(nTupleExprs);
    for (int i = 0; i < nTupleExprs; i++) {
        int sC = BytesUtil.readVInt(in);
        TupleExpression sTupleExpr = TupleExpressionSerializer.deserialize(BytesUtil.readByteArray(in),
                GTUtil.wrap(sInfo.codeSystem.getComparator()));
        sTupleExpressionMap.put(sC, sTupleExpr);
    }
    ImmutableBitSet aRuntimeAggrMetrics = ImmutableBitSet.serializer.deserialize(in);

    return new GTScanRequestBuilder().setInfo(sInfo).setRanges(sRanges).setDimensions(sColumns)
            .setAggrGroupBy(sAggGroupBy).setAggrMetrics(sAggrMetrics).setAggrMetricsFuncs(sAggrMetricFuncs)
            .setRtAggrMetrics(aRuntimeAggrMetrics).setDynamicColumns(aDynCols)
            .setExprsPushDown(sTupleExpressionMap)
            .setFilterPushDown(sGTFilter).setHavingFilterPushDown(sGTHavingFilter)
            .setAllowStorageAggregation(sAllowPreAggr).setAggCacheMemThreshold(sAggrCacheGB)
            .setStorageScanRowNumThreshold(storageScanRowNumThreshold)
            .setStoragePushDownLimit(storagePushDownLimit).setStorageLimitLevel(storageLimitLevel)
            .setStartTime(startTime).setTimeout(timeout).setStorageBehavior(storageBehavior)
            .createGTScanRequest();
}
 
Example 12
Source File: StringSerializer.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer in) {
    return BytesUtil.readUTFString(in);
}
 
Example 13
Source File: DynamicTupleFilter.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
    this.variableName = BytesUtil.readUTFString(buffer);
}
 
Example 14
Source File: StringCodeSystem.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer buffer) {
    return BytesUtil.readUTFString(buffer);
}
 
Example 15
Source File: DynamicTupleFilter.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(IFilterCodeSystem<?> cs, ByteBuffer buffer) {
    this.variableName = BytesUtil.readUTFString(buffer);
}
 
Example 16
Source File: StringCodeSystem.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer buffer) {
    return BytesUtil.readUTFString(buffer);
}
 
Example 17
Source File: DictCodeSystem.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer buffer) {
    return BytesUtil.readUTFString(buffer);
}
 
Example 18
Source File: GTScanRequest.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public GTScanRequest deserialize(ByteBuffer in) {
    final int serialLevel = KylinConfig.getInstanceFromEnv().getGTScanRequestSerializationLevel();

    GTInfo sInfo = GTInfo.serializer.deserialize(in);

    List<GTScanRange> sRanges = Lists.newArrayList();
    int sRangesCount = BytesUtil.readVInt(in);
    for (int rangeIdx = 0; rangeIdx < sRangesCount; rangeIdx++) {
        GTRecord sPkStart = deserializeGTRecord(in, sInfo);
        GTRecord sPkEnd = deserializeGTRecord(in, sInfo);
        List<GTRecord> sFuzzyKeys = Lists.newArrayList();
        int sFuzzyKeySize = BytesUtil.readVInt(in);
        for (int i = 0; i < sFuzzyKeySize; i++) {
            sFuzzyKeys.add(deserializeGTRecord(in, sInfo));
        }
        GTScanRange sRange = new GTScanRange(sPkStart, sPkEnd, sFuzzyKeys);
        sRanges.add(sRange);
    }

    ImmutableBitSet sColumns = ImmutableBitSet.serializer.deserialize(in);
    TupleFilter sGTFilter = GTUtil.deserializeGTFilter(BytesUtil.readByteArray(in), sInfo);

    TupleFilter sGTHavingFilter = null;
    if (serialLevel >= SERIAL_1_HAVING_FILTER) {
        sGTHavingFilter = TupleFilterSerializer.deserialize(BytesUtil.readByteArray(in),
                StringCodeSystem.INSTANCE);
    }

    ImmutableBitSet sAggGroupBy = ImmutableBitSet.serializer.deserialize(in);
    ImmutableBitSet sAggrMetrics = ImmutableBitSet.serializer.deserialize(in);
    String[] sAggrMetricFuncs = BytesUtil.readAsciiStringArray(in);
    boolean sAllowPreAggr = (BytesUtil.readVInt(in) == 1);
    double sAggrCacheGB = in.getDouble();
    StorageLimitLevel storageLimitLevel = StorageLimitLevel.valueOf(BytesUtil.readUTFString(in));
    int storageScanRowNumThreshold = BytesUtil.readVInt(in);
    int storagePushDownLimit = BytesUtil.readVInt(in);
    long startTime = BytesUtil.readVLong(in);
    long timeout = BytesUtil.readVLong(in);
    String storageBehavior = BytesUtil.readUTFString(in);

    ImmutableBitSet aDynCols = ImmutableBitSet.serializer.deserialize(in);

    int nTupleExprs = BytesUtil.readVInt(in);
    Map<Integer, TupleExpression> sTupleExpressionMap = Maps.newHashMapWithExpectedSize(nTupleExprs);
    for (int i = 0; i < nTupleExprs; i++) {
        int sC = BytesUtil.readVInt(in);
        TupleExpression sTupleExpr = TupleExpressionSerializer.deserialize(BytesUtil.readByteArray(in),
                GTUtil.wrap(sInfo.codeSystem.getComparator()));
        sTupleExpressionMap.put(sC, sTupleExpr);
    }
    ImmutableBitSet aRuntimeAggrMetrics = ImmutableBitSet.serializer.deserialize(in);

    GTTwoLayerAggregateParam aTwoLayerAggParam = GTTwoLayerAggregateParam.serializer.deserialize(in);

    return new GTScanRequestBuilder().setInfo(sInfo).setRanges(sRanges).setDimensions(sColumns)
            .setAggrGroupBy(sAggGroupBy).setAggrMetrics(sAggrMetrics).setAggrMetricsFuncs(sAggrMetricFuncs)//
            .setRtAggrMetrics(aRuntimeAggrMetrics).setDynamicColumns(aDynCols)
            .setExprsPushDown(sTupleExpressionMap).setTwoLayerAggregateParam(aTwoLayerAggParam)//
            .setFilterPushDown(sGTFilter).setHavingFilterPushDown(sGTHavingFilter)
            .setAllowStorageAggregation(sAllowPreAggr).setAggCacheMemThreshold(sAggrCacheGB)//
            .setStorageScanRowNumThreshold(storageScanRowNumThreshold)
            .setStoragePushDownLimit(storagePushDownLimit).setStorageLimitLevel(storageLimitLevel)
            .setStartTime(startTime).setTimeout(timeout).setStorageBehavior(storageBehavior)
            .createGTScanRequest();
}
 
Example 19
Source File: StringSerializer.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public String deserialize(ByteBuffer in) {
    return BytesUtil.readUTFString(in);
}
 
Example 20
Source File: DynamicTupleFilter.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@Override
public void deserialize(byte[] bytes) {
    ByteBuffer buffer = ByteBuffer.wrap(bytes);
    this.variableName = BytesUtil.readUTFString(buffer);
}