Java Code Examples for org.apache.kylin.common.util.BytesUtil#readByteArray()
The following examples show how to use
org.apache.kylin.common.util.BytesUtil#readByteArray() .
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: RawSerializer.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Override public List<ByteArray> deserialize(ByteBuffer in) { List<ByteArray> values = new ArrayList<>(); int size = BytesUtil.readVInt(in); if (size >= 0) { for (int i = 0; i < size; i++) { ByteArray ba = new ByteArray(BytesUtil.readByteArray(in)); if (ba.length() != 0) { values.add(ba); } } } else { throw new RuntimeException("Read error data size:" + size); } return values; }
Example 2
Source File: TrimmedCubeCodeSystem.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public static DimensionEncoding readDimensionEncoding(ByteBuffer in) { try { int isNull = BytesUtil.readVInt(in); if (isNull == 1) { return null; } byte[] bytes = BytesUtil.readByteArray(in); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); DimensionEncoding ret = (DimensionEncoding) ois.readObject(); return ret; } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); } }
Example 3
Source File: RawSerializer.java From kylin with Apache License 2.0 | 6 votes |
@Override public List<ByteArray> deserialize(ByteBuffer in) { List<ByteArray> values = new ArrayList<>(); int size = BytesUtil.readVInt(in); if (size >= 0) { for (int i = 0; i < size; i++) { ByteArray ba = new ByteArray(BytesUtil.readByteArray(in)); if (ba.length() != 0) { values.add(ba); } } } else { throw new RuntimeException("Read error data size:" + size); } return values; }
Example 4
Source File: TrimmedCubeCodeSystem.java From kylin with Apache License 2.0 | 6 votes |
public static DimensionEncoding readDimensionEncoding(ByteBuffer in) { try { int isNull = BytesUtil.readVInt(in); if (isNull == 1) { return null; } byte[] bytes = BytesUtil.readByteArray(in); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); DimensionEncoding ret = (DimensionEncoding) ois.readObject(); return ret; } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); } }
Example 5
Source File: EndpointAggregators.java From Kylin with Apache License 2.0 | 6 votes |
@Override public EndpointAggregators deserialize(ByteBuffer in) { String[] funcNames = BytesUtil.readAsciiStringArray(in); String[] dataTypes = BytesUtil.readAsciiStringArray(in); int metricInfoLength = BytesUtil.readVInt(in); MetricInfo[] infos = new MetricInfo[metricInfoLength]; for (int i = 0; i < infos.length; ++i) { MetricType type = MetricType.valueOf(BytesUtil.readAsciiString(in)); int refIndex = BytesUtil.readVInt(in); int presision = BytesUtil.readVInt(in); infos[i] = new MetricInfo(type, refIndex, presision); } byte[] temp = BytesUtil.readByteArray(in); TableRecordInfoDigest tableInfo = TableRecordInfoDigest.deserialize(temp); return new EndpointAggregators(funcNames, dataTypes, infos, tableInfo); }
Example 6
Source File: TupleFilterSerializer.java From Kylin with Apache License 2.0 | 5 votes |
public static TupleFilter deserialize(byte[] bytes) { ByteBuffer buffer = ByteBuffer.wrap(bytes); TupleFilter rootFilter = null; Stack<TupleFilter> parentStack = new Stack<TupleFilter>(); while (buffer.hasRemaining()) { int opVal = BytesUtil.readVInt(buffer); if (opVal < 0) { parentStack.pop(); continue; } // deserialize filter TupleFilter filter = createTupleFilter(opVal); byte[] filetrBytes = BytesUtil.readByteArray(buffer); filter.deserialize(filetrBytes); if (rootFilter == null) { // push root to stack rootFilter = filter; parentStack.push(filter); BytesUtil.readVInt(buffer); continue; } // add filter to parent TupleFilter parentFilter = parentStack.peek(); if (parentFilter != null) { parentFilter.addChild(filter); } // push filter to stack or not based on having children or not int hasChild = BytesUtil.readVInt(buffer); if (hasChild == 1) { parentStack.push(filter); } } return rootFilter; }
Example 7
Source File: ObserverAggregators.java From Kylin with Apache License 2.0 | 5 votes |
@Override public ObserverAggregators deserialize(ByteBuffer in) { int nHCols = BytesUtil.readVInt(in); HCol[] hcols = new HCol[nHCols]; for (int i = 0; i < nHCols; i++) { byte[] family = BytesUtil.readByteArray(in); byte[] qualifier = BytesUtil.readByteArray(in); String[] funcNames = BytesUtil.readAsciiStringArray(in); String[] dataTypes = BytesUtil.readAsciiStringArray(in); hcols[i] = new HCol(family, qualifier, funcNames, dataTypes); } return new ObserverAggregators(hcols); }
Example 8
Source File: ExtendedColumnSerializer.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Override public ByteArray deserialize(ByteBuffer in) { //the array in ByteArray is garanteed to be completed owned by the ByteArray return new ByteArray(BytesUtil.readByteArray(in)); }
Example 9
Source File: CoprocessorProjector.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); boolean hasGroupBy = BytesUtil.readVInt(in) == 1; return new CoprocessorProjector(mask, hasGroupBy); }
Example 10
Source File: ExtendedColumnSerializer.java From kylin with Apache License 2.0 | 4 votes |
@Override public ByteArray deserialize(ByteBuffer in) { //the array in ByteArray is garanteed to be completed owned by the ByteArray return new ByteArray(BytesUtil.readByteArray(in)); }
Example 11
Source File: CoprocessorProjector.java From kylin with Apache License 2.0 | 4 votes |
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); boolean hasGroupBy = BytesUtil.readVInt(in) == 1; return new CoprocessorProjector(mask, hasGroupBy); }
Example 12
Source File: CoprocessorProjector.java From Kylin with Apache License 2.0 | 4 votes |
@Override public CoprocessorProjector deserialize(ByteBuffer in) { byte[] mask = BytesUtil.readByteArray(in); return new CoprocessorProjector(mask); }