當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractRowKeyEncoder類代碼示例

本文整理匯總了Java中org.apache.kylin.cube.kv.AbstractRowKeyEncoder的典型用法代碼示例。如果您正苦於以下問題:Java AbstractRowKeyEncoder類的具體用法?Java AbstractRowKeyEncoder怎麽用?Java AbstractRowKeyEncoder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractRowKeyEncoder類屬於org.apache.kylin.cube.kv包,在下文中一共展示了AbstractRowKeyEncoder類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: call

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
@Override
public Tuple2<ByteArray, Object[]> call(Row row) throws Exception {
    if (initialized == false) {
        synchronized (SparkCubingByLayer.class) {
            if (initialized == false) {
                KylinConfig kConfig = AbstractHadoopJob.loadKylinConfigFromHdfs(conf, metaUrl);
                CubeInstance cubeInstance = CubeManager.getInstance(kConfig).getCube(cubeName);
                CubeDesc cubeDesc = cubeInstance.getDescriptor();
                CubeSegment cubeSegment = cubeInstance.getSegmentById(segmentId);
                CubeJoinedFlatTableEnrich interDesc = new CubeJoinedFlatTableEnrich(
                        EngineFactory.getJoinedFlatTableDesc(cubeSegment), cubeDesc);
                long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
                Cuboid baseCuboid = Cuboid.findForMandatory(cubeDesc, baseCuboidId);
                baseCuboidBuilder = new BaseCuboidBuilder(kConfig, cubeDesc, cubeSegment, interDesc,
                        AbstractRowKeyEncoder.createInstance(cubeSegment, baseCuboid),
                        MeasureIngester.create(cubeDesc.getMeasures()), cubeSegment.buildDictionaryMap());
                initialized = true;
            }
        }
    }
    String[] rowArray = rowToArray(row);
    baseCuboidBuilder.resetAggrs();
    byte[] rowKey = baseCuboidBuilder.buildKey(rowArray);
    Object[] result = baseCuboidBuilder.buildValueObjects(rowArray);
    return new Tuple2<>(new ByteArray(rowKey), result);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:27,代碼來源:SparkCubingByLayer.java

示例2: init

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
private void init(Collection<ColumnValueRange> andDimensionRanges) {
    int size = andDimensionRanges.size();
    Map<TblColRef, String> startValues = Maps.newHashMapWithExpectedSize(size);
    Map<TblColRef, String> stopValues = Maps.newHashMapWithExpectedSize(size);
    Map<TblColRef, Set<String>> fuzzyValues = Maps.newHashMapWithExpectedSize(size);
    for (ColumnValueRange dimRange : andDimensionRanges) {
        TblColRef column = dimRange.getColumn();
        startValues.put(column, dimRange.getBeginValue());
        stopValues.put(column, dimRange.getEndValue());
        fuzzyValues.put(column, dimRange.getEqualValues());

        TblColRef partitionDateColumnRef = cubeSeg.getCubeDesc().getModel().getPartitionDesc().getPartitionDateColumnRef();
        if (column.equals(partitionDateColumnRef)) {
            initPartitionRange(dimRange);
        }
    }

    AbstractRowKeyEncoder encoder = new LazyRowKeyEncoder(cubeSeg, cuboid);
    encoder.setBlankByte(RowConstants.ROWKEY_LOWER_BYTE);
    this.startKey = encoder.encode(startValues);
    encoder.setBlankByte(RowConstants.ROWKEY_UPPER_BYTE);
    // In order to make stopRow inclusive add a trailing 0 byte. #See Scan.setStopRow(byte [] stopRow)
    this.stopKey = Bytes.add(encoder.encode(stopValues), ZERO_TAIL_BYTES);

    // always fuzzy match cuboid ID to lock on the selected cuboid
    this.fuzzyKeys = buildFuzzyKeys(fuzzyValues);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:28,代碼來源:HBaseKeyRange.java

示例3: initVariables

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
private void initVariables(Long cuboidId) {
    rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cubeSegment, Cuboid.findForMandatory(cubeDesc, cuboidId));
    keyBuf = rowKeyEncoder.createBuf();

    dimensions = Long.bitCount(cuboidId);
    measureColumns = new ImmutableBitSet(dimensions, dimensions + measureCount);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:8,代碼來源:KVGTRecordWriter.java

示例4: BaseCuboidBuilder

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
public BaseCuboidBuilder(KylinConfig kylinConfig, CubeDesc cubeDesc, CubeSegment cubeSegment, CubeJoinedFlatTableEnrich intermediateTableDesc,
                         AbstractRowKeyEncoder rowKeyEncoder, MeasureIngester<?>[] aggrIngesters, Map<TblColRef, Dictionary<String>> dictionaryMap) {
    this.kylinConfig = kylinConfig;
    this.cubeDesc = cubeDesc;
    this.cubeSegment = cubeSegment;
    this.intermediateTableDesc = intermediateTableDesc;
    this.rowKeyEncoder = rowKeyEncoder;
    this.aggrIngesters = aggrIngesters;
    this.dictionaryMap = dictionaryMap;

    init();
    measureCodec = new BufferedMeasureCodec(cubeDesc.getMeasures());
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:14,代碼來源:BaseCuboidBuilder.java

示例5: createKey

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
private byte[] createKey(Long cuboidId, GTRecord record) {
    if (rowKeyEncoder == null || rowKeyEncoder.getCuboidID() != cuboidId) {
        rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cubeSegment,
                Cuboid.findForMandatory(cubeDesc, cuboidId));
        keybuf = rowKeyEncoder.createBuf();
    }
    rowKeyEncoder.encode(record, record.getInfo().getPrimaryKey(), keybuf);
    return keybuf;

}
 
開發者ID:apache,項目名稱:kylin,代碼行數:11,代碼來源:HBaseCuboidWriter.java

示例6: setup

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
@Override
protected void setup(Context context) throws IOException {
    super.publishConfiguration(context.getConfiguration());

    cubeName = context.getConfiguration().get(BatchConstants.CFG_CUBE_NAME).toUpperCase();
    segmentName = context.getConfiguration().get(BatchConstants.CFG_CUBE_SEGMENT_NAME);

    KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(context.getConfiguration());

    metadataManager = MetadataManager.getInstance(config);
    cube = CubeManager.getInstance(config).getCube(cubeName);
    cubeSegment = cube.getSegment(segmentName, SegmentStatusEnum.NEW);
    cubeDesc = cube.getDescriptor();
    factTableDesc = metadataManager.getTableDesc(cubeDesc.getFactTable());

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);

    // intermediateTableDesc = new
    // JoinedFlatTableDesc(cube.getDescriptor());

    rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cubeSegment, baseCuboid);

    measureCodec = new MeasureCodec(cubeDesc.getMeasures());
    measures = new Object[cubeDesc.getMeasures().size()];

    int colCount = cubeDesc.getRowkey().getRowKeyColumns().length;
    keyBytesBuf = new byte[colCount][];

    bytesSplitter = new BytesSplitter(factTableDesc.getColumns().length, 4096);

    nullValue = new byte[] { (byte) '\\', (byte) 'N' };// As in Hive, null
    // value is
    // represented by \N

    prepareJoins();
    prepareMetrics();
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:39,代碼來源:NewBaseCuboidMapper.java

示例7: setup

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
@Override
protected void setup(Context context) throws IOException {
    super.publishConfiguration(context.getConfiguration());

    cubeName = context.getConfiguration().get(BatchConstants.CFG_CUBE_NAME).toUpperCase();
    segmentName = context.getConfiguration().get(BatchConstants.CFG_CUBE_SEGMENT_NAME);
    intermediateTableRowDelimiter = context.getConfiguration().get(BatchConstants.CFG_CUBE_INTERMEDIATE_TABLE_ROW_DELIMITER, Character.toString(BatchConstants.INTERMEDIATE_TABLE_ROW_DELIMITER));
    if (Bytes.toBytes(intermediateTableRowDelimiter).length > 1) {
        throw new RuntimeException("Expected delimiter byte length is 1, but got " + Bytes.toBytes(intermediateTableRowDelimiter).length);
    }

    byteRowDelimiter = Bytes.toBytes(intermediateTableRowDelimiter)[0];

    KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(context.getConfiguration());

    cube = CubeManager.getInstance(config).getCube(cubeName);
    cubeDesc = cube.getDescriptor();
    cubeSegment = cube.getSegment(segmentName, SegmentStatusEnum.NEW);

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);

    intermediateTableDesc = new CubeJoinedFlatTableDesc(cube.getDescriptor(), cubeSegment);

    bytesSplitter = new BytesSplitter(200, 4096);
    rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cubeSegment, baseCuboid);

    measureCodec = new MeasureCodec(cubeDesc.getMeasures());
    measures = new Object[cubeDesc.getMeasures().size()];

    int colCount = cubeDesc.getRowkey().getRowKeyColumns().length;
    keyBytesBuf = new byte[colCount][];

    initNullBytes();
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:36,代碼來源:BaseCuboidMapper.java

示例8: init

import org.apache.kylin.cube.kv.AbstractRowKeyEncoder; //導入依賴的package包/類
private void init(Collection<ColumnValueRange> andDimensionRanges) {
    int size = andDimensionRanges.size();
    Map<TblColRef, String> startValues = Maps.newHashMapWithExpectedSize(size);
    Map<TblColRef, String> stopValues = Maps.newHashMapWithExpectedSize(size);
    Map<TblColRef, Set<String>> fuzzyValues = Maps.newHashMapWithExpectedSize(size);
    for (ColumnValueRange dimRange : andDimensionRanges) {
        TblColRef column = dimRange.getColumn();
        startValues.put(column, dimRange.getBeginValue());
        stopValues.put(column, dimRange.getEndValue());
        fuzzyValues.put(column, dimRange.getEqualValues());

        TblColRef partitionDateColumnRef = cubeSeg.getCubeDesc().getModel().getPartitionDesc().getPartitionDateColumnRef();
        if (column.equals(partitionDateColumnRef)) {
            initPartitionRange(dimRange);
        }
    }

    AbstractRowKeyEncoder encoder = AbstractRowKeyEncoder.createInstance(cubeSeg, cuboid);

    encoder.setBlankByte(RowConstants.ROWKEY_LOWER_BYTE);

    this.startKey = encoder.encode(startValues);

    encoder.setBlankByte(RowConstants.ROWKEY_UPPER_BYTE);

    // In order to make stopRow inclusive add a trailing 0 byte. #See
    // Scan.setStopRow(byte [] stopRow)
    this.stopKey = Bytes.add(encoder.encode(stopValues), ZERO_TAIL_BYTES);

    // restore encoder defaults for later reuse (note
    // AbstractRowKeyEncoder.createInstance() caches instances)
    encoder.setBlankByte(AbstractRowKeyEncoder.DEFAULT_BLANK_BYTE);

    // always fuzzy match cuboid ID to lock on the selected cuboid
    this.fuzzyKeys = buildFuzzyKeys(fuzzyValues);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:37,代碼來源:HBaseKeyRange.java


注:本文中的org.apache.kylin.cube.kv.AbstractRowKeyEncoder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。