本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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());
}
示例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);
}
}
示例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();
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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));
}
示例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);
}