Java Code Examples for org.apache.kylin.common.util.ByteArray#array()
The following examples show how to use
org.apache.kylin.common.util.ByteArray#array() .
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: RecordComparators.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public static RecordComparator getRangeEndComparator(final IGTComparator comp) { return new RecordComparator(new ComparatorEx<ByteArray>() { @Override public int compare(ByteArray a, ByteArray b) { if (a.array() == null) { if (b.array() == null) { return 0; } else { return 1; } } else if (b.array() == null) { return -1; } else { return comp.compare(a, b); } } }); }
Example 2
Source File: RowKeyEncoder.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private void encodeDims(GTRecord record, ImmutableBitSet selectedCols, ByteArray buf, byte defaultValue) { int pos = 0; for (int i = 0; i < selectedCols.trueBitCount(); i++) { int c = selectedCols.trueBitAt(i); ByteArray columnC = record.get(c); if (columnC.array() != null) { System.arraycopy(record.get(c).array(), columnC.offset(), buf.array(), buf.offset() + pos, columnC.length()); pos += columnC.length(); } else { int maxLength = record.getInfo().getCodeSystem().maxCodeLength(c); Arrays.fill(buf.array(), buf.offset() + pos, buf.offset() + pos + maxLength, defaultValue); pos += maxLength; } } buf.setLength(pos); }
Example 3
Source File: GTScanRequest.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private int lookAndForget(IGTScanner scanner) { byte meaninglessByte = 0; int scanned = 0; for (GTRecord gtRecord : scanner) { scanned++; for (ByteArray col : gtRecord.getInternal()) { if (col != null) { int endIndex = col.offset() + col.length(); for (int i = col.offset(); i < endIndex; ++i) { meaninglessByte += col.array()[i]; } } } } logger.info("Meaningless byte is " + meaninglessByte); IOUtils.closeQuietly(scanner); return scanned; }
Example 4
Source File: RecordComparators.java From kylin with Apache License 2.0 | 6 votes |
public static RecordComparator getRangeEndComparator(final IGTComparator comp) { return new RecordComparator(new ComparatorEx<ByteArray>() { @Override public int compare(ByteArray a, ByteArray b) { if (a.array() == null) { if (b.array() == null) { return 0; } else { return 1; } } else if (b.array() == null) { return -1; } else { return comp.compare(a, b); } } }); }
Example 5
Source File: RowKeyEncoder.java From kylin with Apache License 2.0 | 6 votes |
private void encodeDims(GTRecord record, ImmutableBitSet selectedCols, ByteArray buf, byte defaultValue) { int pos = 0; for (int i = 0; i < selectedCols.trueBitCount(); i++) { int c = selectedCols.trueBitAt(i); ByteArray columnC = record.get(c); if (columnC.array() != null) { System.arraycopy(record.get(c).array(), columnC.offset(), buf.array(), buf.offset() + pos, columnC.length()); pos += columnC.length(); } else { int maxLength = record.getInfo().getCodeSystem().maxCodeLength(c); Arrays.fill(buf.array(), buf.offset() + pos, buf.offset() + pos + maxLength, defaultValue); pos += maxLength; } } buf.setLength(pos); }
Example 6
Source File: GTScanRequest.java From kylin with Apache License 2.0 | 6 votes |
private int lookAndForget(IGTScanner scanner) { byte meaninglessByte = 0; int scanned = 0; for (GTRecord gtRecord : scanner) { scanned++; for (ByteArray col : gtRecord.getInternal()) { if (col != null) { int endIndex = col.offset() + col.length(); for (int i = col.offset(); i < endIndex; ++i) { meaninglessByte += col.array()[i]; } } } } logger.info("Meaningless byte is " + meaninglessByte); IOUtils.closeQuietly(scanner); return scanned; }
Example 7
Source File: ExtendedColumnSerializer.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteArray value, ByteBuffer out) { if (value != null && value.array() != null) { BytesUtil.writeByteArray(value.array(), value.offset(), value.length(), out); } else { BytesUtil.writeByteArray(null, out); } }
Example 8
Source File: RecordComparators.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public static RecordComparator getRangeStartEndComparator(final IGTComparator comp) { return new AsymmetricRecordComparator(new ComparatorEx<ByteArray>() { @Override public int compare(ByteArray a, ByteArray b) { if (a.array() == null || b.array() == null) { return -1; } else { return comp.compare(a, b); } } }); }
Example 9
Source File: GTRecord.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public Object decodeValue(int c) { ByteArray col = cols[c]; if (col != null && col.array() != null) { return info.codeSystem.decodeColumnValue(c, col.asBuffer()); } return null; }
Example 10
Source File: ExtendedColumnSerializer.java From kylin with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteArray value, ByteBuffer out) { if (value != null && value.array() != null) { BytesUtil.writeByteArray(value.array(), value.offset(), value.length(), out); } else { BytesUtil.writeByteArray(null, out); } }
Example 11
Source File: RecordComparators.java From kylin with Apache License 2.0 | 5 votes |
public static RecordComparator getRangeStartEndComparator(final IGTComparator comp) { return new AsymmetricRecordComparator(new ComparatorEx<ByteArray>() { @Override public int compare(ByteArray a, ByteArray b) { if (a.array() == null || b.array() == null) { return -1; } else { return comp.compare(a, b); } } }); }
Example 12
Source File: GTRecord.java From kylin with Apache License 2.0 | 5 votes |
public Object decodeValue(int c) { ByteArray col = cols[c]; if (col != null && col.array() != null) { return info.codeSystem.decodeColumnValue(c, col.asBuffer()); } return null; }
Example 13
Source File: GTRowBlock.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
private void importFrom(DataInputStream in, ByteArray result) throws IOException { byte[] data = result.array(); int len = in.readInt(); in.read(data, 0, len); result.setLength(len); }
Example 14
Source File: GTRowBlock.java From kylin with Apache License 2.0 | 4 votes |
private void importFrom(DataInputStream in, ByteArray result) throws IOException { byte[] data = result.array(); int len = in.readInt(); in.read(data, 0, len); result.setLength(len); }