public static ILookupTable getInMemLookupTable(TableDesc tableDesc, String[] pkCols, IReadableTable readableTable) throws IOException { return new LookupStringTable(tableDesc, pkCols, readableTable); }
@Override public void fillDerivedColumns(List<String> rowValues, Tuple tuple) { for (int i = 0; i < hostLen; i++) { lookupKey.data[i] = rowValues.get(hostIndex[i]); } String[] lookupRow = lookupTable.getRow(lookupKey); if (lookupRow != null) { for (int i = 0; i < derivedLen; i++) { String value = lookupRow[derivedIndex[i]]; tuple.setDimensionValue(derivedFieldNames[i], value); } } else { for (int i = 0; i < derivedLen; i++) { tuple.setDimensionValue(derivedFieldNames[i], null); } } } }
for (String[] row : lookup.getAllRows()) { tuple.value = row[di]; if (compf.evaluate(tuple)) {
public LookupTable<String> initLookupTable() throws Exception { TableMetadataManager metaMgr = TableMetadataManager.getInstance(config); String tableName = "EDW.TEST_CAL_DT"; String[] pkCols = new String[] { "CAL_DT" }; String snapshotResPath = "/table_snapshot/TEST_CAL_DT.csv/4af48c94-86de-4e22-a4fd-c49b06cbaa4f.snapshot"; SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = metaMgr.getTableDesc(tableName, "default"); LookupTable<String> lt = new LookupStringTable(tableDesc, pkCols, snapshot); System.out.println(lt); return lt; }
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); } }
public LookupTable initLookupTable() throws Exception { MetadataManager metaMgr = MetadataManager.getInstance(config); String tableName = "EDW.TEST_CAL_DT"; String[] pkCols = new String[]{"CAL_DT"}; String snapshotResPath = "/table_snapshot/TEST_CAL_DT.csv/4af48c94-86de-4e22-a4fd-c49b06cbaa4f.snapshot"; SnapshotTable snapshot = getSnapshotManager().getSnapshotTable(snapshotResPath); TableDesc tableDesc = metaMgr.getTableDesc(tableName); LookupTable lt = new LookupStringTable(tableDesc, pkCols, snapshot); System.out.println(lt); return lt; }
public static ILookupTable getInMemLookupTable(TableDesc tableDesc, String[] pkCols, IReadableTable readableTable) throws IOException { return new LookupStringTable(tableDesc, pkCols, readableTable); }
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); } }