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


Java Cuboid.findById方法代碼示例

本文整理匯總了Java中org.apache.kylin.cube.cuboid.Cuboid.findById方法的典型用法代碼示例。如果您正苦於以下問題:Java Cuboid.findById方法的具體用法?Java Cuboid.findById怎麽用?Java Cuboid.findById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.kylin.cube.cuboid.Cuboid的用法示例。


在下文中一共展示了Cuboid.findById方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: HBaseKeyRange

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
public HBaseKeyRange(Collection<TblColRef> dimensionColumns, Collection<ColumnValueRange> andDimensionRanges, CubeSegment cubeSeg, CubeDesc cubeDesc) {
    this.cubeSeg = cubeSeg;
    long cuboidId = this.calculateCuboidID(cubeDesc, dimensionColumns);
    this.cuboid = Cuboid.findById(cubeSeg, cuboidId);
    this.flatOrAndFilter = Lists.newLinkedList();
    this.flatOrAndFilter.add(andDimensionRanges);
    init(andDimensionRanges);
    initDebugString();
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:10,代碼來源:HBaseKeyRange.java

示例2: setup

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的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

示例3: setup

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的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

示例4: setup

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

    Configuration conf = context.getConfiguration();

    KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(conf);
    cubeName = conf.get(BatchConstants.CFG_CUBE_NAME);
    cube = CubeManager.getInstance(config).getCube(cubeName);
    cubeDesc = cube.getDescriptor();
    intermediateTableDesc = new CubeJoinedFlatTableDesc(cubeDesc, null);

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    List<TblColRef> columns = baseCuboid.getColumns();

    ArrayList<Integer> factDictCols = new ArrayList<Integer>();
    RowKeyDesc rowkey = cubeDesc.getRowkey();
    DictionaryManager dictMgr = DictionaryManager.getInstance(config);
    for (int i = 0; i < columns.size(); i++) {
        TblColRef col = columns.get(i);
        if (rowkey.isUseDictionary(col) == false)
            continue;

        String scanTable = (String) dictMgr.decideSourceData(cubeDesc.getModel(), cubeDesc.getRowkey().getDictionary(col), col, null)[0];
        if (cubeDesc.getModel().isFactTable(scanTable)) {
            factDictCols.add(i);
        }
    }
    this.factDictCols = new int[factDictCols.size()];
    for (int i = 0; i < factDictCols.size(); i++)
        this.factDictCols[i] = factDictCols.get(i);

    schema = HCatInputFormat.getTableSchema(context.getConfiguration());
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:36,代碼來源:FactDistinctColumnsMapper.java

示例5: map

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Override
public void map(Text key, Text value, Context context) throws IOException, InterruptedException {
    long cuboidId = rowKeySplitter.split(key.getBytes(), key.getLength());
    Cuboid parentCuboid = Cuboid.findById(cubeDesc, cuboidId);

    Collection<Long> myChildren = cuboidScheduler.getSpanningCuboid(cuboidId);

    // if still empty or null
    if (myChildren == null || myChildren.size() == 0) {
        context.getCounter(BatchConstants.MAPREDUCE_COUTNER_GROUP_NAME, "Skipped records").increment(1L);
        skipCounter++;
        if (skipCounter % BatchConstants.COUNTER_MAX == 0) {
            logger.info("Skipped " + skipCounter + " records!");
        }
        return;
    }

    context.getCounter(BatchConstants.MAPREDUCE_COUTNER_GROUP_NAME, "Processed records").increment(1L);

    handleCounter++;
    if (handleCounter % BatchConstants.COUNTER_MAX == 0) {
        logger.info("Handled " + handleCounter + " records!");
    }

    for (Long child : myChildren) {
        Cuboid childCuboid = Cuboid.findById(cubeDesc, child);
        int keyLength = buildKey(parentCuboid, childCuboid, rowKeySplitter.getSplitBuffers());
        outputKey.set(keyBuf, 0, keyLength);
        context.write(outputKey, value);
    }

}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:33,代碼來源:NDCuboidMapper.java

示例6: setup

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

    Configuration conf = context.getConfiguration();
    KylinConfig config = AbstractHadoopJob.loadKylinPropsAndMetadata(conf);
    String cubeName = conf.get(BatchConstants.CFG_CUBE_NAME);
    CubeInstance cube = CubeManager.getInstance(config).getCube(cubeName);
    CubeDesc cubeDesc = cube.getDescriptor();

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    columnList = baseCuboid.getColumns();
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:15,代碼來源:FactDistinctColumnsReducer.java

示例7: testEncodeAndDecodeWithUtf8

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Test
public void testEncodeAndDecodeWithUtf8() throws IOException {
    CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
    CubeDesc cubeDesc = cube.getDescriptor();

    byte[][] data = new byte[8][];
    data[0] = Bytes.toBytes("2012-12-15");
    data[1] = Bytes.toBytes("11848");
    data[2] = Bytes.toBytes("Health & Beauty");
    data[3] = Bytes.toBytes("Fragrances");
    data[4] = Bytes.toBytes("Women");
    data[5] = Bytes.toBytes("刊登格式測試");// UTF-8
    data[6] = Bytes.toBytes("0");
    data[7] = Bytes.toBytes("15");

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    AbstractRowKeyEncoder rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cube.getFirstSegment(), baseCuboid);

    byte[] encodedKey = rowKeyEncoder.encode(data);
    assertEquals(30, encodedKey.length);

    RowKeyDecoder rowKeyDecoder = new RowKeyDecoder(cube.getFirstSegment());
    rowKeyDecoder.decode(encodedKey);
    List<String> names = rowKeyDecoder.getNames(null);
    List<String> values = rowKeyDecoder.getValues();
    assertEquals("[CAL_DT, LEAF_CATEG_ID, META_CATEG_NAME, CATEG_LVL2_NAME, CATEG_LVL3_NAME, LSTG_FORMAT_NAME, LSTG_SITE_ID, SLR_SEGMENT_CD]", names.toString());
    assertEquals("[2012-12-15, 11848, Health & Beauty, Fragrances, Women, 刊登格式, 0, 15]", values.toString());
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:30,代碼來源:RowKeyDecoderTest.java

示例8: testEncodeWithoutSlr

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Test
public void testEncodeWithoutSlr() throws Exception {
    CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
    // CubeSegment seg = cube.getTheOnlySegment();
    CubeDesc cubeDesc = cube.getDescriptor();
    // String data =
    // "2013-08-18Abbigliamento e accessoriDonna: AccessoriSciarpFoulard e ScialliAuctionItalyRegular";
    byte[][] data = new byte[8][];
    data[0] = Bytes.toBytes("2012-12-15");
    data[1] = Bytes.toBytes("11848");
    data[2] = Bytes.toBytes("Health & Beauty");
    data[3] = Bytes.toBytes("Fragrances");
    data[4] = Bytes.toBytes("Women");
    data[5] = Bytes.toBytes("FP-GTC");
    data[6] = Bytes.toBytes("0");
    data[7] = Bytes.toBytes("15");

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    AbstractRowKeyEncoder rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cube.getFirstSegment(), baseCuboid);

    byte[] encodedKey = rowKeyEncoder.encode(data);
    assertEquals(30, encodedKey.length);
    byte[] cuboidId = Arrays.copyOfRange(encodedKey, 0, 8);
    byte[] rest = Arrays.copyOfRange(encodedKey, 8, encodedKey.length);
    assertEquals(255, Bytes.toLong(cuboidId));
    assertArrayEquals(new byte[] { 11, 55, -13, 13, 22, 34, 121, 70, 80, 45, 71, 84, 67, 9, 9, 9, 9, 9, 9, 0, 10, 5 }, rest);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:29,代碼來源:RowKeyEncoderTest.java

示例9: testEncodeWithSlr

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Test
public void testEncodeWithSlr() throws Exception {
    CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
    // CubeSegment seg = cube.getTheOnlySegment();
    CubeDesc cubeDesc = cube.getDescriptor();
    // String data =
    // "1234567892013-08-18Abbigliamento e accessoriDonna: AccessoriSciarpFoulard e ScialliAuctionItalyRegular";
    byte[][] data = new byte[9][];
    data[0] = Bytes.toBytes("123456789");
    data[1] = Bytes.toBytes("2012-12-15");
    data[2] = Bytes.toBytes("11848");
    data[3] = Bytes.toBytes("Health & Beauty");
    data[4] = Bytes.toBytes("Fragrances");
    data[5] = Bytes.toBytes("Women");
    data[6] = Bytes.toBytes("FP-GTC");
    data[7] = Bytes.toBytes("0");
    data[8] = Bytes.toBytes("15");

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    AbstractRowKeyEncoder rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cube.getFirstSegment(), baseCuboid);

    byte[] encodedKey = rowKeyEncoder.encode(data);
    assertEquals(48, encodedKey.length);
    byte[] sellerId = Arrays.copyOfRange(encodedKey, 8, 26);
    byte[] cuboidId = Arrays.copyOfRange(encodedKey, 0, 8);
    byte[] rest = Arrays.copyOfRange(encodedKey, 26, encodedKey.length);
    assertTrue(Bytes.toString(sellerId).startsWith("123456789"));
    assertEquals(511, Bytes.toLong(cuboidId));
    assertArrayEquals(new byte[] { 11, 55, -13, 13, 22, 34, 121, 70, 80, 45, 71, 84, 67, 9, 9, 9, 9, 9, 9, 0, 10, 5 }, rest);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:32,代碼來源:RowKeyEncoderTest.java

示例10: testEncodeWithSlr2

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Test
public void testEncodeWithSlr2() throws Exception {
    CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
    // CubeSegment seg = cube.getTheOnlySegment();
    CubeDesc cubeDesc = cube.getDescriptor();
    // String data =
    // "1234567892013-08-18Abbigliamento e accessoriDonna: AccessoriSciarpFoulard e ScialliAuctionItalyRegular";
    byte[][] data = new byte[9][];
    data[0] = Bytes.toBytes("123456789");
    data[1] = null;
    data[2] = null;
    data[3] = null;
    data[4] = null;
    data[5] = null;
    data[6] = null;
    data[7] = null;
    data[8] = null;

    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid baseCuboid = Cuboid.findById(cubeDesc, baseCuboidId);
    AbstractRowKeyEncoder rowKeyEncoder = AbstractRowKeyEncoder.createInstance(cube.getFirstSegment(), baseCuboid);

    byte[] encodedKey = rowKeyEncoder.encode(data);
    assertEquals(48, encodedKey.length);
    byte[] sellerId = Arrays.copyOfRange(encodedKey, 8, 26);
    byte[] cuboidId = Arrays.copyOfRange(encodedKey, 0, 8);
    byte[] rest = Arrays.copyOfRange(encodedKey, 26, encodedKey.length);
    assertTrue(Bytes.toString(sellerId).startsWith("123456789"));
    assertEquals(511, Bytes.toLong(cuboidId));
    assertArrayEquals(new byte[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, rest);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:32,代碼來源:RowKeyEncoderTest.java

示例11: identifyCuboid

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
private Cuboid identifyCuboid(Set<TblColRef> dimensions) {
    long cuboidID = 0;
    for (TblColRef column : dimensions) {
        int index = cubeDesc.getRowkey().getColumnBitIndex(column);
        cuboidID |= 1L << index;
    }
    return Cuboid.findById(cubeDesc, cuboidID);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:9,代碼來源:CubeStorageEngine.java

示例12: HBaseKeyRange

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
public HBaseKeyRange(Collection<TblColRef> dimensionColumns, Collection<ColumnValueRange> andDimensionRanges, CubeSegment cubeSeg, CubeDesc cubeDesc) {
    this.cubeSeg = cubeSeg;
    long cuboidId = this.calculateCuboidID(cubeDesc, dimensionColumns);
    this.cuboid = Cuboid.findById(cubeDesc, cuboidId);
    this.flatOrAndFilter = Lists.newLinkedList();
    this.flatOrAndFilter.add(andDimensionRanges);
    init(andDimensionRanges);
    initDebugString();
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:10,代碼來源:HBaseKeyRange.java

示例13: testSerialize

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
@Test
public void testSerialize() {

    CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_without_slr_ready");
    CubeDesc cubeDesc = cube.getDescriptor();
    long baseCuboidId = Cuboid.getBaseCuboidId(cubeDesc);
    Cuboid cuboid = Cuboid.findById(cubeDesc, baseCuboidId);

    CoprocessorRowType rowType = CoprocessorRowType.fromCuboid(cube.getLatestReadySegment(), cuboid);
    byte[] bytes = CoprocessorRowType.serialize(rowType);
    CoprocessorRowType copy = CoprocessorRowType.deserialize(bytes);

    assertTrue(Arrays.equals(rowType.columns, copy.columns));
    assertTrue(Arrays.equals(rowType.columnSizes, copy.columnSizes));
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:16,代碼來源:RowTypeTest.java

示例14: initCuboid

import org.apache.kylin.cube.cuboid.Cuboid; //導入方法依賴的package包/類
private void initCuboid(long cuboidID) {
    if (this.cuboid != null && this.cuboid.getId() == cuboidID) {
        return;
    }
    this.cuboid = Cuboid.findById(cubeDesc, cuboidID);
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:7,代碼來源:RowKeyDecoder.java


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