Java Code Examples for org.apache.kylin.common.util.ByteArray#copyOf()
The following examples show how to use
org.apache.kylin.common.util.ByteArray#copyOf() .
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: SegmentGTStartAndEnd.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
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()); }
Example 2
Source File: SegmentGTStartAndEnd.java From kylin with Apache License 2.0 | 6 votes |
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()); }
Example 3
Source File: GTUtil.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
protected ByteArray translate(int col, Object value, int roundingFlag) { try { buf.clear(); info.codeSystem.encodeColumnValue(col, value, roundingFlag, buf); return ByteArray.copyOf(buf.array(), 0, buf.position()); } catch (IllegalArgumentException ex) { return null; } }
Example 4
Source File: FragmentFileSearcher.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
protected ByteArray translate(int col, Object value, int roundingFlag) { try { buf.clear(); recordCodec.encodeDimension(col, value, roundingFlag, buf); int length = buf.position(); return ByteArray.copyOf(buf.array(), 0, length); } catch (IllegalArgumentException ex) { return null; } }
Example 5
Source File: GTUtil.java From kylin with Apache License 2.0 | 5 votes |
protected ByteArray translate(int col, Object value, int roundingFlag) { try { buf.clear(); info.codeSystem.encodeColumnValue(col, value, roundingFlag, buf); return ByteArray.copyOf(buf.array(), 0, buf.position()); } catch (IllegalArgumentException ex) { return null; } }
Example 6
Source File: FragmentFileSearcher.java From kylin with Apache License 2.0 | 5 votes |
protected ByteArray translate(int col, Object value, int roundingFlag) { try { buf.clear(); recordCodec.encodeDimension(col, value, roundingFlag, buf); int length = buf.position(); return ByteArray.copyOf(buf.array(), 0, length); } catch (IllegalArgumentException ex) { return null; } }
Example 7
Source File: DictGridTableTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
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()); }
Example 8
Source File: DictGridTableTest.java From kylin with Apache License 2.0 | 4 votes |
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()); }