@Test public void testDerivedInfo() { { CubeDesc cube = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); List<TblColRef> givenCols = new ArrayList<>(); givenCols.add(cube.findColumnRef("TEST_KYLIN_FACT", "LSTG_SITE_ID")); givenCols.add(cube.findColumnRef("TEST_KYLIN_FACT", "LEAF_CATEG_ID")); Map<Array<TblColRef>, List<DeriveInfo>> hostToDerivedInfo = cube.getHostToDerivedInfo(givenCols, null); assertEquals(3, hostToDerivedInfo.size()); assertEquals(Pair.newPair(3, 2), countDerivedInfo(hostToDerivedInfo)); } { CubeDesc cube = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("ssb"); List<TblColRef> givenCols = new ArrayList<>(); givenCols.add(cube.findColumnRef("V_LINEORDER", "LO_PARTKEY")); Map<Array<TblColRef>, List<DeriveInfo>> hostToDerivedInfo = cube.getHostToDerivedInfo(givenCols, null); assertEquals(1, hostToDerivedInfo.size()); assertEquals(Pair.newPair(1, 1), countDerivedInfo(hostToDerivedInfo)); } }
TblColRef tblColRef = cube.getDescriptor().findColumnRef(tblCol.split(":")[0], tblCol.split(":")[1]); newSegCopy.putDictResPath(tblColRef, dicInfoHbase.getResourcePath());
private TblColRef initDimensionColRef(TblColRef ref) { TblColRef existing = findColumnRef(ref.getTable(), ref.getName()); if (existing != null) { return existing; } allColumns.add(ref); dimensionColumns.add(ref); Map<String, TblColRef> cols = columnMap.get(ref.getTable()); if (cols == null) { columnMap.put(ref.getTable(), cols = new HashMap<String, TblColRef>()); } cols.put(ref.getName(), ref); return ref; }
cube = cubeManager.getCube("test_kylin_cube_without_slr_left_join_ready_2_segments"); dictionaryManager = DictionaryManager.getInstance(getTestConfig()); lfn = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_FORMAT_NAME"); lsi = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "CAL_DT"); ssc = cube.getDescriptor().findColumnRef("DEFAULT.TEST_CATEGORY_GROUPINGS", "META_CATEG_NAME");
private TblColRef initDimensionColRef(TblColRef ref) { TblColRef existing = findColumnRef(ref.getTable(), ref.getName()); if (existing != null) { return existing; } allColumns.add(ref); dimensionColumns.add(ref); Map<String, TblColRef> cols = columnMap.get(ref.getTable()); if (cols == null) { columnMap.put(ref.getTable(), cols = new HashMap<String, TblColRef>()); } cols.put(ref.getName(), ref); return ref; }
@Test @Ignore("hive not ready") public void basic() throws Exception { CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("test_kylin_cube_without_slr_desc"); TblColRef col = cubeDesc.findColumnRef("DEFAULT.TEST_CATEGORY_GROUPINGS", "META_CATEG_NAME"); DictionaryInfo info1 = dictMgr.buildDictionary(cubeDesc.getModel(), cubeDesc.getRowkey().getDictionary(col), col, null); System.out.println(JsonUtil.writeValueAsIndentString(info1)); DictionaryInfo info2 = dictMgr.buildDictionary(cubeDesc.getModel(), cubeDesc.getRowkey().getDictionary(col), col, null); System.out.println(JsonUtil.writeValueAsIndentString(info2)); assertTrue(info1.getUuid() == info2.getUuid()); assertTrue(info1 == dictMgr.getDictionaryInfo(info1.getResourcePath())); assertTrue(info2 == dictMgr.getDictionaryInfo(info2.getResourcePath())); assertTrue(info1.getDictionaryObject() == info2.getDictionaryObject()); touchDictValues(info1); }
TblColRef tblColRef = cube.getDescriptor().findColumnRef(tblCol.split(":")[0], tblCol.split(":")[1]); newSegCopy.putDictResPath(tblColRef, dicInfoHbase.getResourcePath());