public Date getRelativeEndTime() { String relativeEndTime = this.getProperties().get(MetastoreConstants.FACT_RELATIVE_END_TIME); Date relativeDate = null; if (StringUtils.isNotBlank(relativeEndTime)) { relativeDate = MetastoreUtil.getDateFromProperty(relativeEndTime, true, false); } return relativeDate == null ? this.sourceCubeFactTable.getRelativeEndTime() : relativeDate; }
/** * Alters the weight of table * * @param weight Weight of the table. */ @Override public void alterWeight(double weight) { this.virtualFactWeight = Optional.of(weight); this.addProperties(); }
public Date getEndTime() { return Collections.min(Lists.newArrayList(getRelativeEndTime(), getAbsoluteEndTime())); }
public Date getStartTime() { return Collections.max(Lists.newArrayList(getRelativeStartTime(), getAbsoluteStartTime())); }
public CubeVirtualFactTable(Table hiveTable, FactTable sourceCubeFactTable) { super(hiveTable); this.cubeName = this.getProperties().get(MetastoreUtil.getFactCubeNameKey(getName())); this.sourceCubeFactTable = sourceCubeFactTable; String wtStr = getProperties().get(MetastoreUtil.getCubeTableWeightKey(getName())); if (wtStr != null) { this.virtualFactWeight = Optional.of(Double.parseDouble(wtStr)); } }
CubeVirtualFactTable cubeVirtualFact = new CubeVirtualFactTable(VIRTUAL_CUBE_NAME, virtualFactName, com.google.common.base.Optional.fromNullable(null), virtualFactPropertiesMap, sourceFact); assertTrue(cubeVirtualFact.equals(actualcubeVirtualFact)); cubeVirtualFact = new CubeVirtualFactTable(VIRTUAL_CUBE_NAME, virtualFactName, com.google.common.base.Optional.fromNullable(null), alterVirtualFactPropertiesMap, sourceFact); client.alterVirtualCubeFactTable(cubeVirtualFact); actualcubeVirtualFact = (CubeVirtualFactTable) client.getFactTable(virtualFactName); assertEquals(actualcubeVirtualFact.getProperties().get("name1"), "newvalue2"); assertEquals(actualcubeVirtualFact.getProperties().get("name3"), "value3"); assertTrue(cubeVirtualFact.equals(actualcubeVirtualFact)); client.alterCubeFactTable(sourceFact.getName(), sourceFact, storageTables, new HashMap<String, String>()); actualcubeVirtualFact = (CubeVirtualFactTable) client.getFactTable(virtualFactName); assertTrue(actualcubeVirtualFact.getColumns().contains(newcol)); assertEquals(actualcubeVirtualFact.weight(), 100.0); assertTrue(cubeVirtualFact.equals(actualcubeVirtualFact));
public static XVirtualFactTable virtualFactTableFromVirtualCubeFactTable(CubeVirtualFactTable vFact) { XVirtualFactTable fact = XCF.createXVirtualFactTable(); fact.setName(vFact.getName()); fact.setProperties(new XProperties()); fact.getProperties().getProperty().addAll(xPropertiesFromMap(vFact.getProperties())); fact.setWeight(vFact.weight()); fact.setSourceFactName(vFact.getSourceCubeFactTable().getName()); fact.setCubeName(vFact.getCubeName()); return fact; }
for (FieldSchema fs : cvf.getColumns()) { if (fs.getName().equalsIgnoreCase("c1") && fs.getType().equalsIgnoreCase("string")) { foundC1 = true; assertEquals(cvf.getProperties().get("foo1"), "bar1"); assertTrue(cvf.getStorages().contains("VS1")); assertTrue(cvf.getStorages().contains("VS2")); assertTrue(cvf.getUpdatePeriods().get("VS1").contains(HOURLY)); assertTrue(cvf.getUpdatePeriods().get("VS2").contains(DAILY));
@Override protected void addProperties() { getProperties().put(MetastoreConstants.TABLE_TYPE_KEY, getTableType().name()); getProperties().put(MetastoreUtil.getSourceFactNameKey(this.getName()), this.sourceCubeFactTable.getName()); if (virtualFactWeight.isPresent()) { getProperties().put(MetastoreUtil.getCubeTableWeightKey(this.getName()), String.valueOf(virtualFactWeight.get())); } this.getProperties().put(MetastoreUtil.getFactCubeNameKey(getName()), cubeName); }
public void createVirtualFactTable(String cubeName, String virtualFactName, String sourceFactName, Double weight, Map<String, String> properties) throws LensException { FactTable sourceFact = getFactTable(sourceFactName); Optional<Double> optionalWeight = Optional.fromNullable(weight); CubeVirtualFactTable factTable = new CubeVirtualFactTable(cubeName, virtualFactName, optionalWeight, properties, sourceFact); createCubeTable(factTable, null); // do a get to update cache getFactTable(virtualFactName); }
cvf.alterWeight(20.0); JAXBUtils.cubeFactFromFactTable(source)); assertEquals(ucf.weight(), 20.0);
public static XVirtualFactTable virtualFactTableFromVirtualCubeFactTable(CubeVirtualFactTable vFact) { XVirtualFactTable fact = XCF.createXVirtualFactTable(); fact.setName(vFact.getName()); fact.setProperties(new XProperties()); fact.getProperties().getProperty().addAll(xPropertiesFromMap(vFact.getProperties())); fact.setWeight(vFact.weight()); fact.setSourceFactName(vFact.getSourceCubeFactTable().getName()); fact.setCubeName(vFact.getCubeName()); return fact; }
public CubeVirtualFactTable(Table hiveTable, FactTable sourceCubeFactTable) { super(hiveTable); this.cubeName = this.getProperties().get(MetastoreUtil.getFactCubeNameKey(getName())); this.sourceCubeFactTable = sourceCubeFactTable; String wtStr = getProperties().get(MetastoreUtil.getCubeTableWeightKey(getName())); if (wtStr != null) { this.virtualFactWeight = Optional.of(Double.parseDouble(wtStr)); } }
@Override protected void addProperties() { getProperties().put(MetastoreConstants.TABLE_TYPE_KEY, getTableType().name()); getProperties().put(MetastoreUtil.getSourceFactNameKey(this.getName()), this.sourceCubeFactTable.getName()); if (virtualFactWeight.isPresent()) { getProperties().put(MetastoreUtil.getCubeTableWeightKey(this.getName()), String.valueOf(virtualFactWeight.get())); } this.getProperties().put(MetastoreUtil.getFactCubeNameKey(getName()), cubeName); }
String sourceFactName = tbl.getParameters().get(getSourceFactNameKey(tbl.getTableName())); if (sourceFactName != null) { fact = new CubeVirtualFactTable(tbl, getCubeFactTable(sourceFactName)); if (factToVirtualFactMapping.get(sourceFactName) != null) { List<String> prevList = factToVirtualFactMapping.get(sourceFactName);
public Date getStartTime() { return Collections.max(Lists.newArrayList(getRelativeStartTime(), getAbsoluteStartTime())); }
public Date getAbsoluteStartTime() { String absoluteStartTime = this.getProperties().get(MetastoreConstants.FACT_ABSOLUTE_START_TIME); Date absoluteDate = null; if (StringUtils.isNotBlank(absoluteStartTime)) { absoluteDate = MetastoreUtil.getDateFromProperty(absoluteStartTime, false, true); } return absoluteDate == null ? this.sourceCubeFactTable.getAbsoluteStartTime() : absoluteDate; }
@Override public Set<String> getValidColumns() { String validColsStr = MetastoreUtil.getNamedStringValue(this.getProperties(), MetastoreUtil.getValidColumnsKey(getName())); if (validColsStr == null) { return this.sourceCubeFactTable.getValidColumns(); } else { return new HashSet<>(Arrays.asList(StringUtils.split(validColsStr.toLowerCase(), ','))); } }
public void createVirtualFactTable(String cubeName, String virtualFactName, String sourceFactName, Double weight, Map<String, String> properties) throws LensException { FactTable sourceFact = getFactTable(sourceFactName); checkIfAuthorized(); Optional<Double> optionalWeight = Optional.fromNullable(weight); CubeVirtualFactTable factTable = new CubeVirtualFactTable(cubeName, virtualFactName, optionalWeight, properties, sourceFact); createCubeTable(factTable, null); // do a get to update cache getFactTable(virtualFactName); }
public Date getEndTime() { return Collections.min(Lists.newArrayList(getRelativeEndTime(), getAbsoluteEndTime())); }