private void initDimensionColumns() { for (DimensionDesc dim : dimensions) { JoinDesc join = dim.getJoin();
private TblColRef initDimensionColRef(DimensionDesc dim, String colName) { TblColRef col = model.findColumn(dim.getTable(), colName); // for backward compatibility if (KylinVersion.isBefore200(getVersion())) { // always use FK instead PK, FK could be shared by more than one lookup tables JoinDesc join = dim.getJoin(); if (join != null) { int idx = ArrayUtils.indexOf(join.getPrimaryKeyColumns(), col); if (idx >= 0) { col = join.getForeignKeyColumns()[idx]; } } } return initDimensionColRef(col); }
this.lookupTable = cubeMgr.getLookupTable(cube.getLatestReadySegment(), dim.getJoin());
JoinDesc join = dim.getJoin(); if (join != null) { String joinType = join.getType().toUpperCase();
public LookupStringTable getLookupTable(CubeSegment cubeSegment, DimensionDesc dim) { String tableName = dim.getTable(); String[] pkCols = dim.getJoin().getPrimaryKey(); String snapshotResPath = cubeSegment.getSnapshotResPath(tableName); if (snapshotResPath == null) throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment); try { SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName); return new LookupStringTable(tableDesc, pkCols, snapshot); } catch (IOException e) { throw new IllegalStateException("Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); } }
private void prepare() throws Exception { // load config loadConfig(); TreeSet<String> factTableColumns = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for (DimensionDesc dim : desc.getDimensions()) { for (TblColRef col : dim.getColumnRefs()) { if (col.getTable().equals(factTableName)) factTableColumns.add(col.getName()); } JoinDesc join = dim.getJoin(); if (join != null) { String lookupTable = dim.getTable(); for (String column : join.getPrimaryKey()) { if (!lookupTableKeys.containsKey(lookupTable)) { lookupTableKeys.put(lookupTable, new LinkedList<String>()); } if (!lookupTableKeys.get(lookupTable).contains(column)) lookupTableKeys.get(lookupTable).add(column); } } } int distinctRowCount = (int) (this.rowCount / this.conflictRatio); distinctRowCount = (distinctRowCount == 0) ? 1 : distinctRowCount; // lookup tables for (String lookupTable : lookupTableKeys.keySet()) { this.loadLookupTableValues(lookupTable, lookupTableKeys.get(lookupTable), distinctRowCount); } }
private void initDimensionColumns(Map<String, TableDesc> tables) { for (DimensionDesc dim : dimensions) { JoinDesc join = dim.getJoin();
TblColRef[] pkCols = hostInfo.dimension.getJoin().getPrimaryKeyColumns();
private TblColRef initDimensionColRef(DimensionDesc dim, String colName) { TableDesc table = dim.getTableDesc(); ColumnDesc col = table.findColumnByName(colName); if (col == null) throw new IllegalArgumentException("No column '" + colName + "' found in table " + table); TblColRef ref = new TblColRef(col); // always use FK instead PK, FK could be shared by more than one lookup tables JoinDesc join = dim.getJoin(); if (join != null) { int idx = ArrayUtils.indexOf(join.getPrimaryKeyColumns(), ref); if (idx >= 0) { ref = join.getForeignKeyColumns()[idx]; } } return initDimensionColRef(ref); }
public LookupStringTable getLookupTable(CubeSegment cubeSegment, DimensionDesc dim) { String tableName = dim.getTable(); String[] pkCols = dim.getJoin().getPrimaryKey(); String snapshotResPath = cubeSegment.getSnapshotResPath(tableName); if (snapshotResPath == null) throw new IllegalStateException("No snaphot for table '" + tableName + "' found on cube segment" + cubeSegment.getCubeInstance().getName() + "/" + cubeSegment); try { SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = getMetadataManager().getTableDesc(tableName); return new LookupStringTable(tableDesc, pkCols, snapshot); } catch (IOException e) { throw new IllegalStateException("Failed to load lookup table " + tableName + " from snapshot " + snapshotResPath, e); } }
private void initDimensionColumns(Map<String, TableDesc> tables) { for (DimensionDesc dim : dimensions) { JoinDesc join = dim.getJoin();
private void initDimensionColumns() { for (DimensionDesc dim : dimensions) { JoinDesc join = dim.getJoin();
private TblColRef initDimensionColRef(DimensionDesc dim, String colName) { TblColRef col = model.findColumn(dim.getTable(), colName); // for backward compatibility if (KylinVersion.isBefore200(getVersion())) { // always use FK instead PK, FK could be shared by more than one lookup tables JoinDesc join = dim.getJoin(); if (join != null) { int idx = ArrayUtils.indexOf(join.getPrimaryKeyColumns(), col); if (idx >= 0) { col = join.getForeignKeyColumns()[idx]; } } } return initDimensionColRef(col); }
this.lookupTable = cubeMgr.getLookupTable(cube.getLatestReadySegment(), dim.getJoin());