LENS-1400: Convert CubeTestSetup to setup using xml files instead of code
diff --git a/lens-api/src/main/java/org/apache/lens/api/ToXMLString.java b/lens-api/src/main/java/org/apache/lens/api/ToXMLString.java
index e74adc9..746a82b 100644
--- a/lens-api/src/main/java/org/apache/lens/api/ToXMLString.java
+++ b/lens-api/src/main/java/org/apache/lens/api/ToXMLString.java
@@ -24,6 +24,10 @@
import java.util.Map;
import javax.xml.bind.*;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
import org.apache.lens.api.jaxb.LensJAXBContext;
@@ -31,6 +35,11 @@
protected static final Map<Class<?>, JAXBContext> JAXB_CONTEXTS = new HashMap<>();
public static String toString(Object o) {
+ if (!(o instanceof JAXBElement) && o.getClass().getAnnotation(XmlRootElement.class) == null
+ && o.getClass().getAnnotation(XmlType.class)!= null) {
+ o = new JAXBElement(new QName("uri:lens:cube:0.1", o.getClass().getAnnotation(XmlType.class).name()),
+ o.getClass(), null, o);
+ }
try {
StringWriter stringWriter = new StringWriter();
Class cl = null;
diff --git a/lens-api/src/main/java/org/apache/lens/api/jaxb/LensJAXBContext.java b/lens-api/src/main/java/org/apache/lens/api/jaxb/LensJAXBContext.java
index 14fc4aa..8858b95 100644
--- a/lens-api/src/main/java/org/apache/lens/api/jaxb/LensJAXBContext.java
+++ b/lens-api/src/main/java/org/apache/lens/api/jaxb/LensJAXBContext.java
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.Reader;
import javax.xml.XMLConstants;
import javax.xml.bind.*;
@@ -114,17 +115,26 @@
return UNMARSHALLER;
}
+ public static <T> T unmarshall(File file) throws JAXBException, IOException {
+ return ((JAXBElement<T>) UNMARSHALLER.unmarshal(file)).getValue();
+ }
+ public static <T> T unmarshall(InputStream inputStream) throws JAXBException, IOException {
+ return ((JAXBElement<T>) UNMARSHALLER.unmarshal(inputStream)).getValue();
+ }
+ public static <T> T unmarshall(Reader reader) throws JAXBException, IOException {
+ return ((JAXBElement<T>) UNMARSHALLER.unmarshal(reader)).getValue();
+ }
public static <T> T unmarshallFromFile(String filename) throws JAXBException, IOException {
File file = new File(filename);
if (file.exists()) {
- return ((JAXBElement<T>) UNMARSHALLER.unmarshal(file)).getValue();
+ return unmarshall(file);
} else {
// load from classpath
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
if (stream == null) {
throw new IOException("File not found:" + filename);
}
- return ((JAXBElement<T>) UNMARSHALLER.unmarshal(stream)).getValue();
+ return unmarshall(stream);
}
}
}
diff --git a/lens-api/src/main/java/org/apache/lens/api/metastore/SchemaTraverser.java b/lens-api/src/main/java/org/apache/lens/api/metastore/SchemaTraverser.java
new file mode 100644
index 0000000..157ad71
--- /dev/null
+++ b/lens-api/src/main/java/org/apache/lens/api/metastore/SchemaTraverser.java
@@ -0,0 +1,58 @@
+package org.apache.lens.api.metastore;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.Map;
+import java.util.function.BiConsumer;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.lens.api.jaxb.LensJAXBContext;
+
+import com.google.common.collect.Maps;
+
+/*
+ * Created on 07/03/17.
+ */
+public class SchemaTraverser implements Runnable {
+ final File parent;
+ final Map<String, Class<?>> types = Maps.newLinkedHashMap();
+ private final SchemaEntityProcessor action;
+ {
+ types.put("storages", XStorage.class);
+ types.put("cubes/base", XBaseCube.class);
+ types.put("cubes/derived", XDerivedCube.class);
+ types.put("dimensions", XDimension.class);
+ types.put("facts", XFactTable.class);
+ types.put("dimtables", XDimensionTable.class);
+ types.put("dimensiontables", XDimensionTable.class);
+ types.put("dimensiontables", XDimensionTable.class);
+ types.put("segmentations", XSegmentation.class);
+ }
+ private static final FilenameFilter XML_FILTER = (dir, name) -> name.endsWith(".xml");
+
+ public interface SchemaEntityProcessor extends BiConsumer<File, Class<?>> {
+ }
+
+ public SchemaTraverser(File parent, SchemaEntityProcessor action) {
+ this.parent = parent;
+ this.action = action;
+ }
+
+ @Override
+ public void run() {
+ for (Map.Entry<String, Class<?>> entry : types.entrySet()) {
+ File f = new File(parent, entry.getKey());
+ if (f.exists()) {
+ assert f.isDirectory();
+ File[] files = f.listFiles(XML_FILTER);
+ if (files != null) {
+ for (File entityFile : files) {
+ action.accept(entityFile.getAbsoluteFile(), entry.getValue());
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/lens-api/src/main/resources/cube-0.1.xsd b/lens-api/src/main/resources/cube-0.1.xsd
index 060eb43..1d8a624 100644
--- a/lens-api/src/main/resources/cube-0.1.xsd
+++ b/lens-api/src/main/resources/cube-0.1.xsd
@@ -390,7 +390,7 @@
</xs:documentation>
</xs:annotation>
<xs:sequence>
- <xs:element type="x_expr_column" name="expression" maxOccurs="unbounded" minOccurs="1"/>
+ <xs:element type="x_expr_column" name="expression" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
@@ -707,7 +707,7 @@
<xs:complexType name="x_columns">
<xs:sequence>
- <xs:element name="column" type="x_column" maxOccurs="unbounded" minOccurs="1"/>
+ <xs:element name="column" type="x_column" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
diff --git a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensSchemaCommands.java b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensSchemaCommands.java
index feabf9c..befe4e6 100644
--- a/lens-cli/src/main/java/org/apache/lens/cli/commands/LensSchemaCommands.java
+++ b/lens-cli/src/main/java/org/apache/lens/cli/commands/LensSchemaCommands.java
@@ -18,11 +18,21 @@
*/
package org.apache.lens.cli.commands;
-import java.io.*;
+import java.io.File;
+import java.io.FilenameFilter;
import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.lens.api.metastore.SchemaTraverser;
+import org.apache.lens.api.metastore.XBaseCube;
+import org.apache.lens.api.metastore.XDerivedCube;
+import org.apache.lens.api.metastore.XDimension;
+import org.apache.lens.api.metastore.XDimensionTable;
+import org.apache.lens.api.metastore.XFactTable;
+import org.apache.lens.api.metastore.XSegmentation;
+import org.apache.lens.api.metastore.XStorage;
import org.apache.lens.cli.commands.annotations.UserDocumentation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +45,7 @@
import org.springframework.util.Assert;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
@Component
@UserDocumentation(title = "Creating schema with one command",
@@ -84,15 +95,52 @@
logger.setLevel(Level.FINE);
}
- private static final FilenameFilter XML_FILTER = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".xml");
- }
- };
+ private static final FilenameFilter XML_FILTER = (dir, name) -> name.endsWith(".xml");
+ private static final Map<Class<?>, String> CREATE_COMMAND_MAP = Maps.newHashMap();
+ private static final Map<Class<?>, String> UPDATE_COMMAND_MAP = Maps.newHashMap();
+
@Autowired
private JLineShellComponent shell;
+ static {
+ CREATE_COMMAND_MAP.put(XStorage.class, "create storage --path %s");
+ UPDATE_COMMAND_MAP.put(XStorage.class, "update storage --name %s --path %s");
+ CREATE_COMMAND_MAP.put(XDimension.class, "create dimension --path %s");
+ UPDATE_COMMAND_MAP.put(XDimension.class, "update dimension --name %s --path %s");
+ CREATE_COMMAND_MAP.put(XBaseCube.class, "create cube --path %s");
+ UPDATE_COMMAND_MAP.put(XBaseCube.class, "update cube --name %s --path %s");
+ CREATE_COMMAND_MAP.put(XDerivedCube.class, "create cube --path %s");
+ UPDATE_COMMAND_MAP.put(XDerivedCube.class, "update cube --name %s --path %s");
+ CREATE_COMMAND_MAP.put(XDimensionTable.class, "create dimtable --path %s");
+ UPDATE_COMMAND_MAP.put(XDimensionTable.class, "update dimtable --dimtable_name %s --path %s");
+ CREATE_COMMAND_MAP.put(XDimensionTable.class, "create dimtable --path %s");
+ UPDATE_COMMAND_MAP.put(XDimensionTable.class, "update dimtable --dimtable_name %s --path %s");
+ CREATE_COMMAND_MAP.put(XFactTable.class, "create fact --path %s");
+ UPDATE_COMMAND_MAP.put(XFactTable.class, "update fact --fact_name %s --path %s");
+ CREATE_COMMAND_MAP.put(XSegmentation.class, "create segmentation --path %s");
+ UPDATE_COMMAND_MAP.put(XSegmentation.class, "update segmentation --name %s --path %s");
+ }
+
+ private final SchemaTraverser.SchemaEntityProcessor processor = (entityFile, type) -> {
+ String entityName = entityFile.getName().substring(0, entityFile.getName().length() - 4);
+ String entityPath = entityFile.getAbsolutePath();
+ String createCommand = String.format(CREATE_COMMAND_MAP.get(type), entityPath);
+ String entityType = createCommand.substring(8, createCommand.indexOf(" ", 9));
+ logger.fine(createCommand);
+ if (shell.executeScriptLine(createCommand)) {
+ logger.info("Created " + entityType + " " + entityName);
+ } else {
+ logger.warning("Create failed, trying update");
+ String updateCommand = String.format(UPDATE_COMMAND_MAP.get(type), entityName, entityPath);
+ logger.fine(updateCommand);
+ if (shell.executeScriptLine(updateCommand)) {
+ logger.info("Updated " + entityType + " " + entityName);
+ } else {
+ logger.severe("Couldn't create or update " + entityType + " " + entityName);
+ }
+ }
+ };
+
@CliCommand(value = {"schema", "create schema"},
help = "Parses the specified resource file and executes commands for "
+ "creation/updation of schema\nExpected structure is " + STRUCTURE)
@@ -108,55 +156,10 @@
// ignore result. it can fail if database already exists
shell.executeCommand("create database " + database);
if (shell.executeScriptLine("use " + database)) {
- createOrUpdate(new File(schemaDirectory, "storages"), "storage",
- "create storage --path %s", "update storage --name %s --path %s");
- createOrUpdate(new File(schemaDirectory, "dimensions"), "dimension",
- "create dimension --path %s", "update dimension --name %s --path %s");
- createOrUpdate(new File(new File(schemaDirectory, "cubes"), "base"), "base cube",
- "create cube --path %s", "update cube --name %s --path %s");
- createOrUpdate(new File(new File(schemaDirectory, "cubes"), "derived"), "derived cube",
- "create cube --path %s", "update cube --name %s --path %s");
- createOrUpdate(new File(schemaDirectory, "dimensiontables"), "dimension table",
- "create dimtable --path %s", "update dimtable --dimtable_name %s --path %s");
- createOrUpdate(new File(schemaDirectory, "dimtables"), "dimension table",
- "create dimtable --path %s", "update dimtable --dimtable_name %s --path %s");
- createOrUpdate(new File(schemaDirectory, "facts"), "fact",
- "create fact --path %s", "update fact --fact_name %s --path %s");
- createOrUpdate(new File(schemaDirectory, "segmentations"), "fact",
- "create segmentation --path %s", "update segmentation --name %s --path %s");
+ SchemaTraverser schemaTraverser = new SchemaTraverser(schemaDirectory, processor);
+ schemaTraverser.run();
} else {
throw new IllegalStateException("Switching to database " + database + " failed");
}
}
-
- public List<File> createOrUpdate(File parent, String entityType, String createSyntax, String updateSyntax) {
- List<File> failedFiles = Lists.newArrayList();
- // Create/update entities
- if (parent.exists()) {
- Assert.isTrue(parent.isDirectory(), parent.toString() + " must be a directory");
- for (File entityFile : parent.listFiles(XML_FILTER)) {
- String entityName = entityFile.getName().substring(0, entityFile.getName().length() - 4);
- String entityPath = entityFile.getAbsolutePath();
- String createCommand = String.format(createSyntax, entityPath);
- logger.fine(createCommand);
- if (shell.executeScriptLine(createCommand)) {
- logger.info("Created " + entityType + " " + entityName);
- } else {
- logger.warning("Create failed, trying update");
- String updateCommand = String.format(updateSyntax, entityName, entityPath);
- logger.fine(updateCommand);
- if (shell.executeScriptLine(updateCommand)) {
- logger.info("Updated " + entityType + " " + entityName);
- } else {
- logger.severe("Couldn't create or update " + entityType + " " + entityName);
- failedFiles.add(entityFile);
- }
- }
- }
- }
- if (!failedFiles.isEmpty()) {
- logger.severe("Failed for " + entityType + ": " + failedFiles);
- }
- return failedFiles;
- }
}
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java
index 896a7a1..e00122d 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeFactTable.java
@@ -111,21 +111,16 @@
private Map<String, Map<UpdatePeriod, String>> getUpdatePeriodMap(String factName, Map<String, String> props) {
Map<String, Map<UpdatePeriod, String>> ret = new HashMap<>();
- for (Map.Entry entry : storageUpdatePeriods.entrySet()) {
- String storage = (String) entry.getKey();
- for (UpdatePeriod period : (Set<UpdatePeriod>) entry.getValue()) {
+ for (Map.Entry<String, Set<UpdatePeriod>> entry : storageUpdatePeriods.entrySet()) {
+ String storage = entry.getKey();
+ for (UpdatePeriod period : entry.getValue()) {
String storagePrefixKey = MetastoreUtil
.getUpdatePeriodStoragePrefixKey(factName.trim(), storage, period.getName());
String storageTableNamePrefix = props.get(storagePrefixKey);
if (storageTableNamePrefix == null) {
storageTableNamePrefix = storage;
}
- Map<UpdatePeriod, String> mapOfUpdatePeriods = ret.get(storage);
- if (mapOfUpdatePeriods == null) {
- mapOfUpdatePeriods = new HashMap<>();
- ret.put(storage, mapOfUpdatePeriods);
- }
- mapOfUpdatePeriods.put(period, storageTableNamePrefix);
+ ret.computeIfAbsent(storage, k -> new HashMap<>()).put(period, storageTableNamePrefix);
}
}
return ret;
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
index 78fb6d3..c8a2498 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
@@ -20,12 +20,25 @@
package org.apache.lens.cube.metadata;
import static org.apache.lens.cube.metadata.DateUtil.resolveDate;
+import static org.apache.lens.cube.metadata.JAXBUtils.getStorageTableDescFromHiveTable;
+import static org.apache.lens.cube.metadata.JAXBUtils.segmentationFromXSegmentation;
import static org.apache.lens.cube.metadata.MetastoreUtil.*;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.lens.api.metastore.XCube;
+import org.apache.lens.api.metastore.XDerivedCube;
+import org.apache.lens.api.metastore.XDimension;
+import org.apache.lens.api.metastore.XDimensionTable;
+import org.apache.lens.api.metastore.XFactTable;
+import org.apache.lens.api.metastore.XSegmentation;
+import org.apache.lens.api.metastore.XStorage;
+import org.apache.lens.api.metastore.XStorageTableElement;
+import org.apache.lens.api.metastore.XUpdatePeriod;
+import org.apache.lens.api.metastore.XUpdatePeriodTableDescriptor;
+import org.apache.lens.api.metastore.XUpdatePeriods;
import org.apache.lens.cube.error.LensCubeErrorCode;
import org.apache.lens.cube.metadata.Storage.LatestInfo;
import org.apache.lens.cube.metadata.Storage.LatestPartColumnInfo;
@@ -50,6 +63,10 @@
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.thrift.TException;
+import org.jvnet.jaxb2_commons.lang.Equals;
+import org.jvnet.jaxb2_commons.lang.HashCode;
+import org.jvnet.jaxb2_commons.lang.ToString;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -290,6 +307,61 @@
}
}
+
+ public <T extends Equals & HashCode & ToString> void createEntity(T entity) throws LensException {
+ if (entity instanceof XStorage) {
+ createStorage((XStorage) entity);
+ } else if (entity instanceof XCube) {
+ createCube((XCube)entity);
+ } else if (entity instanceof XDimension) {
+ createDimension((XDimension) entity);
+ } else if (entity instanceof XFactTable) {
+ createCubeFactTable((XFactTable) entity);
+ } else if (entity instanceof XDimensionTable) {
+ createCubeDimensionTable((XDimensionTable) entity);
+ } else if (entity instanceof XSegmentation) {
+ createSegmentation((XSegmentation) entity);
+ } else {
+ throw new LensException("Unable to create entity " + entity + " as it's unrecognizable: "+ entity.getClass());
+ }
+ }
+
+ public <T extends Equals & HashCode & ToString> void updateEntity(String name, T entity)
+ throws LensException, HiveException {
+ if (entity instanceof XStorage) {
+ alterStorage((XStorage) entity);
+ } else if (entity instanceof XCube) {
+ alterCube((XCube)entity);
+ } else if (entity instanceof XDimension) {
+ alterDimension((XDimension) entity);
+ } else if (entity instanceof XFactTable) {
+ alterCubeFactTable((XFactTable) entity);
+ } else if (entity instanceof XDimensionTable) {
+ alterCubeDimensionTable((XDimensionTable) entity);
+ } else if (entity instanceof XSegmentation) {
+ alterSegmentation((XSegmentation) entity);
+ } else {
+ throw new LensException("Unable to alter entity " + entity + " as it's unrecognizable: " + entity.getClass());
+ }
+ }
+
+
+ public static Map<String, String> addFactColStartTimePropertyToFactProperties(XFactTable fact) {
+ Map<String, String> props = new HashMap<String, String>();
+ props.putAll(JAXBUtils.mapFromXProperties(fact.getProperties()));
+ props.putAll(JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns()));
+ return props;
+ }
+ public void createCubeFactTable(XFactTable fact) throws LensException {
+ createCubeFactTable(fact.getCubeName(),
+ fact.getName(),
+ JAXBUtils.fieldSchemaListFromColumns(fact.getColumns()),
+ JAXBUtils.getFactUpdatePeriodsFromStorageTables(fact.getStorageTables()),
+ fact.getWeight(),
+ addFactColStartTimePropertyToFactProperties(fact),
+ JAXBUtils.tableDescPrefixMapFromXStorageTables(fact.getStorageTables()),
+ JAXBUtils.storageTablePrefixMapOfStorage(fact.getStorageTables()));
+ }
public void createCubeFactTable(String cubeName, String factName, List<FieldSchema> columns,
Map<String, Set<UpdatePeriod>> storageAggregatePeriods, double weight, Map<String, String> properties,
Map<String, StorageTableDesc> storageTableDescs, Map<String, Map<UpdatePeriod, String>> storageUpdatePeriodMap)
@@ -302,6 +374,7 @@
}
+
/**
* In-memory storage of {@link PartitionTimeline} objects for each valid
* storagetable-updateperiod-partitioncolumn tuple. also simultaneously stored in metastore table of the
@@ -619,12 +692,22 @@
}
}
+ public void createStorage(XStorage storage) throws LensException {
+ createStorage(JAXBUtils.storageFromXStorage(storage));
+ }
+
public void createStorage(Storage storage) throws LensException {
createCubeHiveTable(storage);
// do a get to update cache
getStorage(storage.getName());
}
+ public void createCube(XCube cube) throws LensException {
+ Cube parent = cube instanceof XDerivedCube ? (Cube) getCube(
+ ((XDerivedCube) cube).getParent()) : null;
+ createCube(JAXBUtils.hiveCubeFromXCube(cube, parent));
+ }
+
/**
* Create cube in metastore defined by {@link Cube} or {@link DerivedCube} object
*
@@ -714,6 +797,9 @@
createDimension(dim);
}
+ public void createDimension(XDimension dim) throws LensException {
+ createDimension(JAXBUtils.dimensionFromXDimension(dim));
+ }
/**
* Create dimension in metastore defined by {@link Dimension} object
*
@@ -783,6 +869,18 @@
getSegmentation(segmentationName);
}
+ public void createCubeDimensionTable(XDimensionTable xDimTable) throws LensException {
+ List<FieldSchema> columns = JAXBUtils.fieldSchemaListFromColumns(xDimTable.getColumns());
+ Map<String, UpdatePeriod> updatePeriodMap =
+ JAXBUtils.dumpPeriodsFromStorageTables(xDimTable.getStorageTables());
+
+ Map<String, String> properties = JAXBUtils.mapFromXProperties(xDimTable.getProperties());
+ Map<String, StorageTableDesc> storageDesc = JAXBUtils.tableDescPrefixMapFromXStorageTables(
+ xDimTable.getStorageTables());
+ log.info("# Columns: " + columns);
+ createCubeDimensionTable(xDimTable.getDimensionName(), xDimTable.getTableName(), columns, xDimTable.getWeight(),
+ updatePeriodMap, properties, storageDesc);
+ }
/**
* Create a cube dimension table
*
@@ -846,6 +944,14 @@
}
}
+ public void createSegmentation(XSegmentation cubeSeg) throws LensException {
+ createSegmentation(
+ cubeSeg.getCubeName(),
+ cubeSeg.getName(),
+ JAXBUtils.segmentsFromXSegments(cubeSeg.getSegements()),
+ cubeSeg.getWeight(),
+ JAXBUtils.mapFromXProperties(cubeSeg.getProperties()));
+ }
public void createSegmentation(Segmentation cubeSeg)
throws LensException {
// create virtual cube table in metastore
@@ -1618,6 +1724,47 @@
return CubeTableType.DIMENSION.name().equals(tableType);
}
+ public XFactTable getXFactTable(String tableName) throws LensException {
+ return getXFactTable(getFactTable(tableName));
+ }
+ public XFactTable getXFactTable(CubeFactTable cft) throws LensException {
+
+ XFactTable factTable = JAXBUtils.factTableFromCubeFactTable(cft);
+ Map<String, Map<UpdatePeriod, String>> storageMap = cft.getStoragePrefixUpdatePeriodMap();
+ for (String storageName : cft.getStorages()) {
+ Set<UpdatePeriod> updatePeriods = cft.getUpdatePeriods().get(storageName);
+ // This map tells if there are different tables for different update period.
+ Map<UpdatePeriod, String> updatePeriodToTableMap = storageMap.get(storageName);
+ Set<String> tableNames = new HashSet<>();
+ for (UpdatePeriod updatePeriod : updatePeriods) {
+ tableNames.add(updatePeriodToTableMap.get(updatePeriod));
+ }
+ if (tableNames.size() <= 1) {
+ XStorageTableElement tblElement = JAXBUtils.getXStorageTableFromHiveTable(
+ getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(cft.getName(), storageName)));
+ tblElement.setStorageName(storageName);
+ for (UpdatePeriod p : updatePeriods) {
+ tblElement.getUpdatePeriods().getUpdatePeriod().add(XUpdatePeriod.valueOf(p.name()));
+ }
+ factTable.getStorageTables().getStorageTable().add(tblElement);
+ } else {
+ // Multiple storage tables.
+ XStorageTableElement tblElement = new XStorageTableElement();
+ tblElement.setStorageName(storageName);
+ XUpdatePeriods xUpdatePeriods = new XUpdatePeriods();
+ tblElement.setUpdatePeriods(xUpdatePeriods);
+ for (Map.Entry entry : updatePeriodToTableMap.entrySet()) {
+ XUpdatePeriodTableDescriptor updatePeriodTableDescriptor = new XUpdatePeriodTableDescriptor();
+ updatePeriodTableDescriptor.setTableDesc(getStorageTableDescFromHiveTable(
+ this.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(cft.getName(), (String) entry.getValue()))));
+ updatePeriodTableDescriptor.setUpdatePeriod(XUpdatePeriod.valueOf(((UpdatePeriod)entry.getKey()).name()));
+ xUpdatePeriods.getUpdatePeriodTableDescriptor().add(updatePeriodTableDescriptor);
+ }
+ factTable.getStorageTables().getStorageTable().add(tblElement);
+ }
+ }
+ return factTable;
+ }
/**
* Get {@link CubeFactTable} object corresponding to the name
*
@@ -1634,6 +1781,25 @@
return new Segmentation(getTableWithTypeFailFast(tableName, CubeTableType.SEGMENTATION));
}
+ public XDimensionTable getXDimensionTable(String dimTable) throws LensException {
+ return getXDimensionTable(getDimensionTable(dimTable));
+ }
+ public XDimensionTable getXDimensionTable(CubeDimensionTable dimTable) throws LensException {
+ XDimensionTable dt = JAXBUtils.dimTableFromCubeDimTable(dimTable);
+ if (!dimTable.getStorages().isEmpty()) {
+ for (String storageName : dimTable.getStorages()) {
+ XStorageTableElement tblElement = JAXBUtils.getXStorageTableFromHiveTable(
+ this.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(dimTable.getName(), storageName)));
+ tblElement.setStorageName(storageName);
+ UpdatePeriod p = dimTable.getSnapshotDumpPeriods().get(storageName);
+ if (p != null) {
+ tblElement.getUpdatePeriods().getUpdatePeriod().add(XUpdatePeriod.valueOf(p.name()));
+ }
+ dt.getStorageTables().getStorageTable().add(tblElement);
+ }
+ }
+ return dt;
+ }
/**
* Get {@link CubeDimensionTable} object corresponding to the name
*
@@ -2144,6 +2310,11 @@
}
}
+ public void alterCube(XCube cube) throws HiveException, LensException {
+ Cube parent = cube instanceof XDerivedCube ? (Cube) getCube(
+ ((XDerivedCube) cube).getParent()) : null;
+ alterCube(cube.getName(), JAXBUtils.hiveCubeFromXCube(cube, parent));
+ }
/**
* Alter cube specified by the name to new definition
*
@@ -2162,10 +2333,13 @@
/**
* Alter dimension specified by the dimension name to new definition
*
- * @param dimName The cube name to be altered
* @param newDim The new dimension definition
* @throws HiveException
*/
+ public void alterDimension(XDimension newDim) throws HiveException, LensException {
+ alterDimension(newDim.getName(), JAXBUtils.dimensionFromXDimension(newDim));
+ }
+
public void alterDimension(String dimName, Dimension newDim) throws HiveException, LensException {
Table tbl = getTableWithTypeFailFast(dimName, CubeTableType.DIMENSION);
alterCubeTable(dimName, tbl, newDim);
@@ -2177,10 +2351,12 @@
/**
* Alter storage specified by the name to new definition
*
- * @param storageName The storage name to be altered
* @param storage The new storage definition
* @throws LensException
*/
+ public void alterStorage(XStorage storage) throws LensException, HiveException {
+ alterStorage(storage.getName(), JAXBUtils.storageFromXStorage(storage));
+ }
public void alterStorage(String storageName, Storage storage) throws LensException, HiveException {
Table storageTbl = getTableWithTypeFailFast(storageName, CubeTableType.STORAGE);
alterCubeTable(storageName, storageTbl, storage);
@@ -2333,7 +2509,11 @@
dropHiveTable(dimTblName);
allDimTables.remove(dimTblName.trim().toLowerCase());
}
-
+ public void alterCubeFactTable(XFactTable fact) throws LensException, HiveException {
+ alterCubeFactTable(fact.getName(), JAXBUtils.cubeFactFromFactTable(fact),
+ JAXBUtils.tableDescPrefixMapFromXStorageTables(fact.getStorageTables()),
+ JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns()));
+ }
/**
* Alter a cubefact with new definition and alter underlying storage tables as well.
*
@@ -2361,6 +2541,9 @@
updateFactCache(factTableName);
}
+ public void alterSegmentation(XSegmentation cubeSeg) throws LensException, HiveException {
+ alterSegmentation(cubeSeg.getName(), segmentationFromXSegmentation(cubeSeg));
+ }
public void alterSegmentation(String segName, Segmentation seg)
throws HiveException, LensException {
getTableWithTypeFailFast(segName, CubeTableType.SEGMENTATION);
@@ -2388,7 +2571,11 @@
allDimTables.put(dimTblName.trim().toLowerCase(), getDimensionTable(refreshTable(dimTblName)));
}
}
-
+ public void alterCubeDimensionTable(XDimensionTable dimensionTable) throws LensException, HiveException {
+ alterCubeDimensionTable(dimensionTable.getTableName(),
+ JAXBUtils.cubeDimTableFromDimTable(dimensionTable),
+ JAXBUtils.tableDescPrefixMapFromXStorageTables(dimensionTable.getStorageTables()));
+ }
/**
* Alter dimension table with new dimension definition and underlying storage tables as well
*
diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/JAXBUtils.java
similarity index 99%
rename from lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
rename to lens-cube/src/main/java/org/apache/lens/cube/metadata/JAXBUtils.java
index 7d54c7b..e1e3d16 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metastore/JAXBUtils.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/JAXBUtils.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.lens.server.metastore;
+package org.apache.lens.cube.metadata;
import java.lang.reflect.Constructor;
import java.text.ParseException;
@@ -28,7 +28,6 @@
import javax.xml.datatype.XMLGregorianCalendar;
import org.apache.lens.api.metastore.*;
-import org.apache.lens.cube.metadata.*;
import org.apache.lens.cube.metadata.ExprColumn.ExprSpec;
import org.apache.lens.cube.metadata.ReferencedDimAttribute.ChainRefCol;
import org.apache.lens.server.api.error.LensException;
@@ -743,7 +742,6 @@
fact.setColumns(new XColumns());
fact.setProperties(new XProperties());
fact.setStorageTables(new XStorageTables());
-
fact.getProperties().getProperty().addAll(xPropertiesFromMap(cFact.getProperties()));
fact.getColumns().getColumn().addAll(columnsFromFieldSchemaList(cFact.getColumns()));
fact.setWeight(cFact.weight());
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
index 25acb01..e6e9f8f 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
@@ -635,12 +635,8 @@
log.info("Completeness for the measure_tag {} is {}, threshold: {}, for the hour {}", tag,
completenessResult.getValue(), completenessThreshold, formatter.format(completenessResult.getKey()));
String measureorExprFromTag = tagToMeasureOrExprMap.get(tag);
- Map<String, Float> incompletePartition = dataCompletenessMap.get(measureorExprFromTag);
- if (incompletePartition == null) {
- incompletePartition = new HashMap<>();
- dataCompletenessMap.put(measureorExprFromTag, incompletePartition);
- }
- incompletePartition.put(formatter.format(completenessResult.getKey()), completenessResult.getValue());
+ dataCompletenessMap.computeIfAbsent(measureorExprFromTag, k -> new HashMap<>())
+ .put(formatter.format(completenessResult.getKey()), completenessResult.getValue());
isDataComplete = false;
}
}
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
index bc008ae..22e2e09 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
@@ -59,7 +59,7 @@
validDimTables = StringUtils.isBlank(str) ? null : Arrays.asList(StringUtils.split(str.toLowerCase(), ","));
String maxIntervalStr = conf.get(CubeQueryConfUtil.QUERY_MAX_INTERVAL);
if (maxIntervalStr != null) {
- this.maxInterval = UpdatePeriod.valueOf(maxIntervalStr);
+ this.maxInterval = UpdatePeriod.valueOf(maxIntervalStr.toUpperCase());
} else {
this.maxInterval = null;
}
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
index 94d4b40..2d031f4 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
@@ -27,29 +27,36 @@
import static org.testng.Assert.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
import java.util.*;
+import java.util.stream.Collectors;
+import javax.xml.bind.JAXBException;
+
+import org.apache.lens.api.ToXMLString;
+import org.apache.lens.api.jaxb.LensJAXBContext;
+import org.apache.lens.api.metastore.SchemaTraverser;
import org.apache.lens.cube.metadata.*;
-import org.apache.lens.cube.metadata.ExprColumn.ExprSpec;
-import org.apache.lens.cube.metadata.ReferencedDimAttribute.ChainRefCol;
import org.apache.lens.cube.metadata.timeline.EndsAndHolesPartitionTimeline;
import org.apache.lens.cube.metadata.timeline.PartitionTimeline;
import org.apache.lens.cube.metadata.timeline.StoreAllPartitionTimeline;
-import org.apache.lens.server.api.LensConfConstants;
import org.apache.lens.server.api.error.LensException;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.text.StrLookup;
+import org.apache.commons.lang3.text.StrSubstitutor;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.Database;
-import org.apache.hadoop.hive.metastore.api.FieldSchema;
-import org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat;
import org.apache.hadoop.hive.ql.metadata.Hive;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.metadata.Table;
-import org.apache.hadoop.hive.ql.parse.ParseException;
import org.apache.hadoop.hive.ql.session.SessionState;
-import org.apache.hadoop.hive.serde.serdeConstants;
-import org.apache.hadoop.mapred.TextInputFormat;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -92,9 +99,6 @@
public static final String TEST_CUBE_NAME = "testCube";
public static final String DERIVED_CUBE_NAME = "derivedCube";
public static final String BASE_CUBE_NAME = "baseCube";
- public static final String DERIVED_CUBE_NAME1 = "der1";
- public static final String DERIVED_CUBE_NAME2 = "der2";
- public static final String DERIVED_CUBE_NAME3 = "der3";
private static String c0 = "C0";
private static String c1 = "C1";
@@ -511,1305 +515,16 @@
return expected.toString();
}
- Set<ExprColumn> exprs;
+ private Set<ExprColumn> exprs;
- private void createCube(CubeMetastoreClient client) throws HiveException, ParseException, LensException {
- cubeMeasures = new HashSet<CubeMeasure>();
- Map<String, String> tags = new HashMap<>();
- tags.put(MetastoreConstants.MEASURE_DATACOMPLETENESS_TAG, "tag1");
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr1", "int", "first measure"), null, null, null, null, null,
- null, null, null, null, tags));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr2", "float", "second measure"), "Measure2", null, "SUM",
- "RS"));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr21", "float", "second measure"), "Measure22", null, "SUM",
- "RS"));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr22", "float", "second measure"), "Measure22", null, "SUM",
- "RS"));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr3", "double", "third measure"), "Measure3", null, "MAX",
- null));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr4", "bigint", "fourth measure"), "Measure4", null, "COUNT",
- null));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr9", "bigint", "ninth measure"), null, null, null, null,
- null, null, null, null, null, tags));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("noAggrMsr", "bigint", "measure without a default aggregate"),
- "No aggregateMsr", null, null, null));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("newmeasure", "bigint", "measure available from now"),
- "New measure", null, null, null, NOW, null, 100.0));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema("msr15", "int", "fifteenth measure"), "Measure15", null, "SUM",
- "RS"));
- String prefix = "union_join_ctx_";
- cubeMeasures.add(new ColumnMeasure(new FieldSchema(prefix + "msr1", "int", prefix + "first measure")));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema(prefix + "msr2", "int", prefix + "second measure")));
- cubeMeasures.add(new ColumnMeasure(new FieldSchema(prefix + "msr3", "int", prefix + "third measure")));
-
- cubeDimensions = new HashSet<CubeDimAttribute>();
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema(prefix + "cityid", "int", prefix + "the cityid ")));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema(prefix + "zipcode", "int", prefix + "the zipcode")));
-
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("d_time", "timestamp", "d time")));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("processing_time", "timestamp", "processing time")));
- List<CubeDimAttribute> locationHierarchy = new ArrayList<CubeDimAttribute>();
- locationHierarchy.add(new BaseDimAttribute(new FieldSchema("zipcode", "int", "zip")));
- locationHierarchy.add(new BaseDimAttribute(new FieldSchema("cityid", "int", "city")));
- locationHierarchy.add(new BaseDimAttribute(new FieldSchema("stateid", "int", "state")));
- locationHierarchy.add(new BaseDimAttribute(new FieldSchema("countryid", "int", "country")));
- List<String> regions = Arrays.asList("APAC", "EMEA", "USA");
- locationHierarchy.add(new BaseDimAttribute(new FieldSchema("regionname", "string", "region"), "regionname", null,
- null, null, null, regions));
-
- cubeDimensions.add(new HierarchicalDimAttribute("location", "Location hierarchy", locationHierarchy));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("dim1", "string", "basedim")));
- // Added for ambiguity test
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("ambigdim1", "string", "used in testColumnAmbiguity")));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("dim2", "int", "ref dim"), "dim2 refer",
- "dim2chain", "id", null, null, 0.0));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("cdim2", "int", "ref dim"), "Dim2 refer", NOW, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("urdimid", "int", "ref dim"), "urdim refer",
- null, null, 10.0));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("unreachableName", "string", ""), "urdim name",
- "unreachableDim_chain", "name", null, null, 10.0));
- // denormalized reference
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("dim2big1", "bigint", "ref dim"), "dim2 refer",
- "dim2chain", "bigid1", null, null, 0.0));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("dim2big2", "bigint", "ref dim"), "dim2 refer",
- "dim2chain", "bigid2", null, null, 0.0));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("dim2bignew", "bigint", "ref dim"), "Dim2 refer",
- NOW, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("test_time_dim_hour_id", "int", "ref dim"),
- "Timedim reference", null, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("test_time_dim_day_id", "int", "ref dim"),
- "Timedim reference", null, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("test_time_dim_hour_id2", "int", "ref dim")));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("test_time_dim_day_id2", "int", "ref dim")));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("testDim3id", "string", "direct id to testdim3"),
- "dim3 refer", "dim3chain", "id", null, null, 0.0));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("cityname", "string", "city name"),
- "city name", "cubecity", "name", null, null, 0.0));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema(prefix + "cityname", "string", prefix + "city name"),
- prefix + "city name", "cubeCityJoinUnionCtx", "name", null, null, 0.0));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("statename_cube", "string", "state name"),
- "state name", "cubestate", "name", null, null, 0.0));
- List<ChainRefCol> references = new ArrayList<>();
- references.add(new ChainRefCol("timedatechain1", "full_date"));
- references.add(new ChainRefCol("timehourchain1", "full_hour"));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("test_time_dim", "date", "ref dim"),
- "Timedim full date", references, null, null, null, null));
- List<ChainRefCol> chainRefs = new ArrayList<>();
- chainRefs.add(new ChainRefCol("timehourchain2", "full_hour"));
- chainRefs.add(new ChainRefCol("timedatechain2", "full_date"));
- cubeDimensions.add(new ReferencedDimAttribute(new FieldSchema("test_time_dim2", "date", "chained dim"),
- "Timedim full date", chainRefs, null, null, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("cityid1", "int", "id to city"),
- "City1", null, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("cityid2", "int", "id to city"),
- "City2", null, null, null));
- cubeDimensions.add(new BaseDimAttribute(new FieldSchema("concatedcitystate", "string", "citystate"),
- "CityState", null, null, null));
-
- Map<String, JoinChain> joinChains = new HashMap<>();
- addCubeChains(joinChains, TEST_CUBE_NAME);
-
- exprs = new HashSet<ExprColumn>();
- exprs.add(new ExprColumn(new FieldSchema("avgmsr", "double", "avg measure"), "Avg Msr", "avg(msr1 + msr2)"));
- exprs.add(new ExprColumn(new FieldSchema("singlecolmsr2expr", "double", "measure2"), "Msr2", "msr2)"));
- exprs.add(new ExprColumn(new FieldSchema("singlecolmsr2qualifiedexpr", "double", "testcube.measure2"),
- "Msr2", "testcube.msr2"));
- exprs.add(new ExprColumn(new FieldSchema("singlecoldim1expr", "string", "dim1"), "dim1", "dim1)"));
- exprs.add(new ExprColumn(new FieldSchema("singlecoldim1qualifiedexpr", "string", "testcube.dim1"),
- "dim1", "testcube.dim1"));
- exprs.add(new ExprColumn(new FieldSchema("singlecolchainid", "string", "dim3chain.id"),
- "dim3chainid", "dim3chain.id)"));
- exprs.add(new ExprColumn(new FieldSchema("singlecolchainrefexpr", "string", "testcube.testDim3id"),
- "dim3chainid", "testcube.testDim3id"));
- exprs.add(new ExprColumn(new FieldSchema("singlecolchainfield", "string", "cubecity.name"),
- "cubecityname", "cubecity.name"));
- exprs.add(new ExprColumn(new FieldSchema("summsrs", "double", "sum measures"), "Sum Msrs",
- "(1000 + sum(msr1) + sum(msr2))/100"));
- exprs.add(new ExprColumn(new FieldSchema("msr5", "double", "materialized in some facts"), "Fifth Msr",
- "msr2 + msr3"));
- exprs.add(new ExprColumn(new FieldSchema("msr8", "double", "measure expression"), "Sixth Msr",
- "msr2 + msr3"));
- exprs.add(new ExprColumn(new FieldSchema("msr7", "double", "measure expression"), "Seventh Msr",
- "case when sum(msr2) = 0 then 0 else sum(case when cityid='x' then msr21 else msr22 end)/sum(msr2) end"));
- exprs.add(new ExprColumn(new FieldSchema("equalsums", "double", "sums are equals"), "equalsums",
- new ExprSpec("msr3 + msr4", null, null), new ExprSpec("(msr3 + msr2)/100", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("roundedmsr1", "double", "rounded measure1"), "Rounded msr1",
- "round(msr1/1000)"));
- exprs.add(new ExprColumn(new FieldSchema("roundedmsr2", "double", "rounded measure2"), "Rounded msr2",
- "round(msr2/1000)"));
- exprs.add(new ExprColumn(new FieldSchema("flooredmsr12", "double", "floored measure12"), "Floored msr12",
- "floor(msr12)"));
- exprs.add(new ExprColumn(new FieldSchema("nestedexpr", "double", "nested expr"), "Nested expr",
- new ExprSpec("avg(roundedmsr2)", null, null), new ExprSpec("avg(equalsums)", null, null),
- new ExprSpec("case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end",
- null, null)));
- exprs.add(new ExprColumn(new FieldSchema("msr2expr", "double", "nested expr"), "Nested expr",
- new ExprSpec("case when cityStateName = 'xyz' then msr2 else 0 end", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("nestedExprWithTimes", "double", "nested expr"), "Nested expr",
- new ExprSpec("avg(roundedmsr2)", null, null), new ExprSpec("avg(equalsums)", null, null),
- new ExprSpec("case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end",
- NOW, null), new ExprSpec("avg(newmeasure)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("msr6", "bigint", "sixth measure"), "Measure6",
- "sum(msr2) + max(msr3)/ count(msr4)"));
- exprs.add(new ExprColumn(new FieldSchema("booleancut", "boolean", "a boolean expression"), "Boolean cut",
- "(dim1 != 'x' AND dim2 != 10)"));
- exprs.add(new ExprColumn(new FieldSchema("substrexpr", "string", "a sub-string expression"), "Substr expr",
- new ExprSpec("substr(dim1, 3))", null, null), new ExprSpec("substr(ascii(dim2chain.name), 3)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("substrexprdim2", "string", "a sub-string expression"), "Substr expr",
- new ExprSpec("substr(dim2, 3))", null, null), new ExprSpec("substr(ascii(dim2chain.name), 3)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("indiasubstr", "boolean", "nested sub string expression"), "Nested expr",
- "substrexpr = 'INDIA'"));
- exprs.add(new ExprColumn(new FieldSchema("refexpr", "string", "expression which facts and dimensions"),
- "Expr with cube and dim fields", "concat(dim1, \":\", citydim.name)"));
- exprs.add(new ExprColumn(new FieldSchema("nocolexpr", "string", "expression which non existing colun"),
- "No col expr", "myfun(nonexist)"));
- exprs.add(new ExprColumn(new FieldSchema("newexpr", "string", "expression which non existing colun"),
- "new measure expr", "myfun(newmeasure)"));
- exprs.add(new ExprColumn(new FieldSchema("cityAndState", "String", "city and state together"), "City and State",
- new ExprSpec("concat(cityname, \":\", statename_cube)", null, null),
- new ExprSpec("substr(concatedcitystate, 10)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("cityAndStateNew", "String", "city and state together"), "City and State",
- new ExprSpec("concat(cityname, \":\", statename_cube)", null, TWO_MONTHS_BACK),
- new ExprSpec("substr(concatedcitystate, 10)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("cityStateName", "String", "city state"), "City State",
- "concat('CityState:', cubecity.statename)"));
- exprs.add(new ExprColumn(new FieldSchema("isIndia", "String", "is indian city/state"), "Is Indian City/state",
- "cubecity.name == 'DELHI' OR cubestate.name == 'KARNATAKA' OR cubestate.name == 'MAHARASHTRA'"));
- exprs.add(new ExprColumn(new FieldSchema("cubeStateName", "String", "statename from cubestate"), "CubeState Name",
- "substr(cubestate.name, 5)"));
- exprs.add(new ExprColumn(new FieldSchema("substrdim2big1", "String", "substr of dim2big1"), "dim2big1 substr",
- "substr(dim2big1, 5)"));
- exprs.add(new ExprColumn(new FieldSchema("asciicity", "String", "ascii cityname"), "ascii cityname substr",
- "ascii(cityname)"));
- exprs.add(new ExprColumn(new FieldSchema("countofdistinctcityid", "int", "Count of Distinct CityId"),
- "Count of Distinct CityId Expr", "count(distinct(cityid))"));
- exprs.add(new ExprColumn(new FieldSchema("notnullcityid", "int", "Not null cityid"),
- "Not null cityid Expr", "case when cityid is null then 0 else cityid end"));
- // union join context
- exprs.add(new ExprColumn(new FieldSchema(prefix + "notnullcityid", "int", prefix + "Not null cityid"),
- prefix + "Not null cityid Expr", "case when union_join_ctx_cityid is null then 0 "
- + "else union_join_ctx_cityid end"));
- exprs.add(new ExprColumn(new FieldSchema(prefix + "sum_msr1_msr2", "int", prefix + "sum of msr1 and msr2"),
- prefix + "sum of msr1 and msr2", "sum(union_join_ctx_msr1) + sum(union_join_ctx_msr2)"));
- exprs.add(new ExprColumn(new FieldSchema(prefix + "msr1_greater_than_100", "int", prefix + "msr1 greater than 100"),
- prefix + "msr1 greater than 100", "case when sum(union_join_ctx_msr1) > 100 then \"high\" else \"low\" end"));
- exprs.add(new ExprColumn(new FieldSchema(prefix + "non_zero_msr2_sum", "int", prefix + "non zero msr2 sum"),
- prefix + "non zero msr2 sum", "sum(case when union_join_ctx_msr2 > 0 then union_join_ctx_msr2 else 0 end)"));
-
- Map<String, String> cubeProperties = new HashMap<String, String>();
- cubeProperties.put(MetastoreUtil.getCubeTimedDimensionListKey(TEST_CUBE_NAME),
- "d_time,pt,it,et,test_time_dim,test_time_dim2");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "test_time_dim", "ttd");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "test_time_dim2", "ttd2");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "d_time", "dt");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "it", "it");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "et", "et");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "pt", "pt");
- cubeProperties.put(MetastoreConstants.TIMEDIM_RELATION + "d_time", "test_time_dim+[-10 days,10 days]");
-
- client.createCube(TEST_CUBE_NAME, cubeMeasures, cubeDimensions, exprs, Sets.newHashSet(joinChains.values()),
- cubeProperties);
-
- Set<String> measures = new HashSet<String>();
- measures.add("msr1");
- measures.add("msr2");
- measures.add("msr3");
- measures.add("msr9");
- Set<String> dimensions = new HashSet<String>();
- dimensions.add("dim1");
- dimensions.add("dim2");
- dimensions.add("dim2big1");
- dimensions.add("dim2big2");
- dimensions.add("dim2bignew");
- // Try creating derived cube with non existant dim/measures
- try{
- client.createDerivedCube(TEST_CUBE_NAME, DERIVED_CUBE_NAME,
- Sets.newHashSet("random_measure"), Sets.newHashSet("random_dim_attribute"),
- new HashMap<String, String>(), 5L);
- } catch(LensException e) {
- assertTrue(e.getMessage().contains("random_measure"));
- assertTrue(e.getMessage().contains("random_dim_attribute"));
- assertTrue(e.getMessage().contains("not present"));
- }
- client.createDerivedCube(TEST_CUBE_NAME, DERIVED_CUBE_NAME,
- measures, dimensions, new HashMap<String, String>(), 5L);
- }
-
- private void addCubeChains(Map<String, JoinChain> joinChains, final String cubeName) {
- final String prefix = "union_join_ctx_";
- joinChains.put("timehourchain1", new JoinChain("timehourchain1", "time chain", "time dim thru hour dim") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "test_time_dim_hour_id"));
- add(new TableReference("hourdim", "id"));
- }
- });
- }
- });
- joinChains.put("timedatechain1", new JoinChain("timedatechain1", "time chain", "time dim thru date dim") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "test_time_dim_day_id"));
- add(new TableReference("daydim", "id"));
- }
- });
- }
- });
- joinChains.put("timehourchain2", new JoinChain("timehourchain2", "time chain", "time dim thru hour dim") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "test_time_dim_hour_id2"));
- add(new TableReference("hourdim", "id"));
- }
- });
- }
- });
- joinChains.put("timedatechain2", new JoinChain("timedatechain2", "time chain", "time dim thru date dim") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "test_time_dim_day_id2"));
- add(new TableReference("daydim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeCity", new JoinChain("cubeCity", "cube-city", "city thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "cityid"));
- add(new TableReference("citydim", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2"));
- add(new TableReference("testdim2", "id"));
- add(new TableReference("testdim2", "cityid"));
- add(new TableReference("citydim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeCityJoinUnionCtx", new JoinChain("cubeCityJoinUnionCtx", "cube-city", "city thru cube") {
- {
- // added for testing union join context
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, prefix + "cityid"));
- add(new TableReference("citydim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeCity1", new JoinChain("cubeCity1", "cube-city", "city thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "cityid1"));
- add(new TableReference("citydim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeCity2", new JoinChain("cubeCity2", "cube-city", "city thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "cityid2"));
- add(new TableReference("citydim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeState", new JoinChain("cubeState", "cube-state", "state thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "stateid"));
- add(new TableReference("statedim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeZip", new JoinChain("cubeZipJoinUnionCtx", "cube-zip", "Zipcode thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, prefix + "zipcode"));
- add(new TableReference("zipdim", "code"));
- }
- });
- }
- });
- joinChains.put("cubeZip", new JoinChain("cubeZip", "cube-zip", "Zipcode thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "zipcode"));
- add(new TableReference("zipdim", "code"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, prefix + "zipcode"));
- add(new TableReference("zipdim", "code"));
- }
- });
- }
- });
- joinChains.put("cubeCountry", new JoinChain("cubeCountry", "cube-country", "country thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- }
- });
- joinChains.put("dim2chain", new JoinChain("dim2chain", "cube-testdim2", "testdim2 thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2"));
- add(new TableReference("testdim2", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big1"));
- add(new TableReference("testdim2", "bigid1"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big2"));
- add(new TableReference("testdim2", "bigid2"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2bignew"));
- add(new TableReference("testdim2", "bigidnew"));
- }
- });
- }
- });
- joinChains.put("dim3chain", new JoinChain("dim3chain", "cube-testdim3", "cyclicdim thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2"));
- add(new TableReference("testdim2", "id"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big1"));
- add(new TableReference("testdim2", "bigid1"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big2"));
- add(new TableReference("testdim2", "bigid2"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2bignew"));
- add(new TableReference("testdim2", "bigidnew"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- }
- });
- joinChains.put("dim4chain", new JoinChain("dim4chain", "cube-testdim3", "cyclicdim thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2"));
- add(new TableReference("testdim2", "id"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big1"));
- add(new TableReference("testdim2", "bigid1"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2big2"));
- add(new TableReference("testdim2", "bigid2"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "dim2bignew"));
- add(new TableReference("testdim2", "bigidnew"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- }
- });
- joinChains.put("cdimChain", new JoinChain("cdimChain", "cube-cyclicdim", "cyclicdim thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "cdim2"));
- add(new TableReference("cycledim1", "id"));
- }
- });
- }
- });
- joinChains.put("unreachableDim_chain", new JoinChain("unreachableDim_chain", "cube-unreachableDim",
- "unreachableDim thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "urdimid"));
- add(new TableReference("unreachableDim", "id"));
- }
- });
- }
- });
- joinChains.put("cubeCountry", new JoinChain("cubeCountry", "cube-country", "country thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference(cubeName, "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- }
- });
- }
- private void createBaseAndDerivedCubes(CubeMetastoreClient client)
- throws HiveException, ParseException, LensException {
- Set<CubeMeasure> cubeMeasures2 = new HashSet<>(cubeMeasures);
- Set<CubeDimAttribute> cubeDimensions2 = new HashSet<>(cubeDimensions);
- cubeMeasures2.add(new ColumnMeasure(new FieldSchema("msr11", "int", "first measure")));
- cubeMeasures2.add(new ColumnMeasure(new FieldSchema("msr12", "float", "second measure"), "Measure2", null, "SUM",
- "RS"));
- cubeMeasures2.add(new ColumnMeasure(new FieldSchema("msr13", "double", "third measure"), "Measure3", null, "MAX",
- null));
- cubeMeasures2.add(new ColumnMeasure(new FieldSchema("msr14", "bigint", "fourth measure"), "Measure4", null,
- "COUNT", null));
- cubeMeasures2.add(new ColumnMeasure(new FieldSchema("directMsr", "bigint", "fifth measure"), "Direct Measure",
- null, "SUM", null));
-
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("dim11", "string", "basedim")));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("dim12", "int", "ref dim"), "Dim2 refer",
- "dim2chain", "id", null, null, null)); // used as key in the chains
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("dim22", "int", "ref dim"), "Dim2 refer",
- "dim2chain", "id", null, null, null)); // not used as key in the chains
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("dim13", "string", "basedim")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("userid", "int", "userid")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("xuserid", "int", "userid")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("yuserid", "int", "userid")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("user_id_added_in_past", "int", "user_id_added_in_past")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("user_id_added_far_future", "int",
- "user_id_added_far_future")));
- cubeDimensions2.add(new BaseDimAttribute(new FieldSchema("user_id_deprecated", "int", "user_id_deprecated")));
-
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("xsports", "array<string>", ""),
- "xuser sports", "xusersports", "name", null, null, null));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("ysports", "array<string>", ""),
- "yuser sports", "yusersports", "name", null, null, null));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("sports", "array<string>", ""),
- "user sports", "usersports", "name", null, null, null));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("sportids", "array<int>", ""),
- "user sports", "userInterestIds", "sport_id", null, null, null));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("statecountry", "string", ""),
- "state country", "cubestatecountry", "name", null, null, null));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("citycountry", "string", ""),
- "city country", "cubecitystatecountry", "name", null, null, null));
- List<ChainRefCol> refCols = new ArrayList<>();
- refCols.add(new ChainRefCol("cubeState", "countrycapital"));
- refCols.add(new ChainRefCol("cubeCityStateCountry", "capital"));
- cubeDimensions2.add(new ReferencedDimAttribute(new FieldSchema("cubeCountryCapital", "String", "ref dim"),
- "Country capital", refCols, null, null, null, null));
- Map<String, String> cubeProperties = new HashMap<>();
- cubeProperties.put(MetastoreUtil.getCubeTimedDimensionListKey(BASE_CUBE_NAME),
- "d_time,pt,it,et,test_time_dim,test_time_dim2");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "test_time_dim", "ttd");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "test_time_dim2", "ttd2");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "d_time", "dt");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "it", "it");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "et", "et");
- cubeProperties.put(MetastoreConstants.TIMEDIM_TO_PART_MAPPING_PFX + "processing_time", "pt");
- cubeProperties.put(MetastoreConstants.TIMEDIM_RELATION + "d_time", "processing_time+[-5 days,5 days]");
- cubeProperties.put(MetastoreConstants.TIMEDIM_RELATION + "processing_time", "test_time_dim+[-5 days,5 days]");
- cubeProperties.put(MetastoreConstants.CUBE_ALL_FIELDS_QUERIABLE, "false");
-
- Map<String, JoinChain> joinChainMap = new HashMap<>();
- addCubeChains(joinChainMap, "basecube");
- // update new paths
- joinChainMap.get("dim2chain").addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "dim12"));
- add(new TableReference("testdim2", "id"));
- }
- });
- joinChainMap.get("dim3chain").addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "dim12"));
- add(new TableReference("testdim2", "id"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- joinChainMap.get("dim4chain").addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "dim12"));
- add(new TableReference("testdim2", "id"));
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- Set<JoinChain> joinChains = Sets.newHashSet(joinChainMap.values());
- joinChains.add(new JoinChain("cityState", "city-state", "state thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "cityid"));
- add(new TableReference("citydim", "id"));
- add(new TableReference("citydim", "stateid"));
- add(new TableReference("statedim", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "cityid"));
- add(new TableReference("citydim", "id"));
- add(new TableReference("citydim", "statename"));
- add(new TableReference("statedim", "name"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("cityZip", "city-zip", "zip thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "cityid"));
- add(new TableReference("citydim", "id"));
- add(new TableReference("citydim", "zipcode"));
- add(new TableReference("zipdim", "code"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("cubeStateCountry", "cube-state-country", "country through state") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "stateid"));
- add(new TableReference("statedim", "id"));
- add(new TableReference("statedim", "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("cubeCityStateCountry", "cube-city-state-country", "country through state thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "cityid"));
- add(new TableReference("citydim", "id"));
- add(new TableReference("citydim", "stateid"));
- add(new TableReference("statedim", "id"));
- add(new TableReference("statedim", "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("userchain", "user-chain", "user chain") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "userid"));
- add(new TableReference("userdim", "id"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("user_id_added_far_future_chain", "user_id_added_far_future_chain",
- "user_id_added_far_future_chain") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "user_id_added_far_future"));
- add(new TableReference("userdim", "user_id_added_far_future"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("userSports", "user-sports", "user sports") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "userid"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("user_interests", "user_id", true));
- add(new TableReference("user_interests", "sport_id"));
- add(new TableReference("sports", "id"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("userInterestIds", "user-interestsIds", "user interest ids") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "userid"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("user_interests", "user_id", true));
- }
- });
- }
- });
- joinChains.add(new JoinChain("xuserSports", "xuser-sports", "xuser sports") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "xuserid"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("user_interests", "user_id", true));
- add(new TableReference("user_interests", "sport_id"));
- add(new TableReference("sports", "id"));
- }
- });
- }
- });
- joinChains.add(new JoinChain("yuserSports", "user-sports", "user sports") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("basecube", "yuserid"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("userdim", "id"));
- add(new TableReference("user_interests", "user_id", true));
- add(new TableReference("user_interests", "sport_id"));
- add(new TableReference("sports", "id"));
- }
- });
- }
- });
-
- // add ref dim through chain
- cubeDimensions2.add(
- new ReferencedDimAttribute(new FieldSchema("cityStateCapital", "string", "State's capital thru city"),
- "State's capital thru city", "cityState", "capital", null, null, null));
- Set<ExprColumn> baseExprs = new HashSet<>(exprs);
- baseExprs.add(new ExprColumn(new FieldSchema("substrsprorts", "String", "substr of sports"), "substr sports",
- "substr(sports, 10)"));
- baseExprs.add(new ExprColumn(new FieldSchema("xsports_abbr", "array<string>", ""),
- "xuser sports", "substr(xsports, 3)"));
- baseExprs.add(new ExprColumn(new FieldSchema("ysports_abbr", "array<string>", ""),
- "yuser sports", "substr(ysports, 3)"));
- baseExprs.add(new ExprColumn(new FieldSchema("sports_abbr", "array<string>", ""),
- "user sports", "substr(sports, 3)"));
- baseExprs.add(new ExprColumn(new FieldSchema("sportids_abbr", "array<string>", ""),
- "user sports", "case when sportids == 1 then 'CKT' when sportids == 2 then 'FTB' else 'NON' end"));
- baseExprs.add(new ExprColumn(new FieldSchema("directMsrExpr", "bigint", ""),
- "Direct Measure", new ExprSpec("directMsr + 0", null, null), new ExprSpec("msr13 + msr14", null, null)));
- client.createCube(BASE_CUBE_NAME, cubeMeasures2, cubeDimensions2, baseExprs, joinChains, cubeProperties);
-
- Map<String, String> derivedProperties = new HashMap<>();
- derivedProperties.put(MetastoreConstants.CUBE_ALL_FIELDS_QUERIABLE, "true");
- Set<String> measures = new HashSet<>();
- measures.add("msr1");
- measures.add("msr9");
- measures.add("msr11");
- Set<String> dimensions = new HashSet<>();
- dimensions.add("dim1");
- dimensions.add("dim11");
- dimensions.add("d_time");
- client.createDerivedCube(BASE_CUBE_NAME, DERIVED_CUBE_NAME1, measures, dimensions, derivedProperties, 5L);
-
- measures = new HashSet<>();
- measures.add("msr2");
- measures.add("msr12");
- measures.add("msr13");
- measures.add("msr14");
- measures.add("directmsr");
- dimensions = new HashSet<>();
- dimensions.add("cityid");
- dimensions.add("stateid");
- dimensions.add("userid");
- dimensions.add("xuserid");
- dimensions.add("yuserid");
- dimensions.add("dim1");
- dimensions.add("dim2");
- dimensions.add("dim2big1");
- dimensions.add("dim2big2");
- dimensions.add("dim2bignew");
- dimensions.add("dim11");
- dimensions.add("dim13");
- dimensions.add("dim12");
- dimensions.add("dim22");
- dimensions.add("d_time");
- dimensions.add("test_time_dim");
- dimensions.add("test_time_dim2");
- dimensions.add("test_time_dim_hour_id");
- dimensions.add("test_time_dim_day_id");
- dimensions.add("test_time_dim_hour_id2");
- dimensions.add("test_time_dim_day_id2");
- client.createDerivedCube(BASE_CUBE_NAME, DERIVED_CUBE_NAME2, measures, dimensions, derivedProperties, 10L);
- measures = new HashSet<>();
- measures.add("msr3");
- measures.add("msr13");
- dimensions = new HashSet<>();
- dimensions.add("dim1");
- dimensions.add("location");
- dimensions.add("d_time");
- dimensions.add("test_time_dim");
- dimensions.add("test_time_dim2");
- dimensions.add("test_time_dim_hour_id");
- dimensions.add("test_time_dim_day_id");
- dimensions.add("test_time_dim_hour_id2");
- dimensions.add("test_time_dim_day_id2");
- client.createDerivedCube(BASE_CUBE_NAME, DERIVED_CUBE_NAME3, measures, dimensions, derivedProperties, 20L);
-
- // create base cube facts
- createBaseCubeFacts(client);
- // create join and union ctx facts
- createUnionAndJoinContextFacts(client);
- }
-
- private void createUnionAndJoinContextFacts(CubeMetastoreClient client) throws HiveException, LensException {
- String prefix = "union_join_ctx_";
- String derivedCubeName = prefix + "der1";
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(DAILY);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
-
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- storageAggregatePeriods.put(c1, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- // create fact1 (all dim attributes only msr1)
- String factName = prefix + "fact1";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new ColumnMeasure(new FieldSchema(prefix + "msr1", "int", "first measure")).getColumn());
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema(prefix + "zipcode", "int", "zip"));
- factColumns.add(new FieldSchema(prefix + "cityid", "int", "city id"));
- // add fact start and end time property
- Map<String, String> properties = Maps.newHashMap(factValidityProperties);
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 90 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day - 30 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L, properties,
- storageTables);
-
- // create fact2 with same schema, but it starts after fact1 ends
- factName = prefix + "fact2";
- properties.clear();
- //factColumns.add(new ColumnMeasure(new FieldSchema(prefix + "msr2", "int", "second measure")).getColumn());
- // add fact start and end time property
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 31 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day + 7 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L, properties,
- storageTables);
-
- // create fact3 (all dim attributes only msr2)
- factName = prefix + "fact3";
- factColumns.clear();
- factColumns.add(new ColumnMeasure(new FieldSchema(prefix + "msr2", "int", "second measure")).getColumn());
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema(prefix + "zipcode", "int", "zip"));
- factColumns.add(new FieldSchema(prefix + "cityid", "int", "city id"));
- properties.clear();
- // add fact start and end time property
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 90 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day + 7 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L, properties,
- storageTables);
-
- /*
- // create fact4 will all all measures and entire timerange covered
- factName = prefix + "fact4";
- factColumns.add(new ColumnMeasure(new FieldSchema(prefix + "msr1", "int", "first measure")).getColumn());
- properties.clear();
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 90 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day + 7 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- properties, storageTables);
- */
- // create fact5 and fact6 with msr3 and covering timerange as set
- factName = prefix + "fact5";
- factColumns.clear();
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema(prefix + "zipcode", "int", "zip"));
- factColumns.add(new FieldSchema(prefix + "cityid", "int", "city id"));
- factColumns.add(new ColumnMeasure(new FieldSchema(prefix + "msr3", "int", "third measure")).getColumn());
- properties.clear();
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 90 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day -30 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L, properties,
- storageTables);
-
- factName = prefix + "fact6";
- properties.clear();
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day -31 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day + 7 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L, properties,
- storageTables);
-
- // Create derived cube
- Map<String, String> derivedProperties = new HashMap<>();
- derivedProperties.put(MetastoreConstants.CUBE_ALL_FIELDS_QUERIABLE, "true");
- Set<String> measures = new HashSet<>();
- measures.add(prefix + "msr1");
- measures.add(prefix + "msr2");
- measures.add(prefix + "msr3");
- Set<String> dimensions = new HashSet<>();
- dimensions.add(prefix + "cityid");
- dimensions.add(prefix + "zipcode");
- dimensions.add("d_time");
- dimensions.add(prefix + "cityname");
- client.createDerivedCube(BASE_CUBE_NAME, derivedCubeName, measures, dimensions, derivedProperties, 5L);
-
- }
-
- private void createBaseCubeFacts(CubeMetastoreClient client) throws HiveException, LensException {
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(MINUTELY);
- updates.add(HOURLY);
- updates.add(DAILY);
- updates.add(MONTHLY);
- updates.add(QUARTERLY);
- updates.add(YEARLY);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
-
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- ArrayList<FieldSchema> s2PartCols = new ArrayList<FieldSchema>();
- s2PartCols.add(new FieldSchema("ttd", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2PartCols.add(new FieldSchema("ttd2", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2.setPartCols(s2PartCols);
- s2.setTimePartCols(Arrays.asList("ttd", "ttd2"));
-
- storageAggregatePeriods.put(c1, updates);
- storageAggregatePeriods.put(c2, updates);
- storageAggregatePeriods.put(c3, updates);
- storageAggregatePeriods.put(c4, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c4, s2);
- storageTables.put(c2, s1);
- storageTables.put(c3, s1);
-
- String factName = "testFact1_BASE";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- factColumns.add(new FieldSchema("stateid", "int", "state id"));
- factColumns.add(new FieldSchema("userid", "int", "user id"));
- factColumns.add(new FieldSchema("xuserid", "int", "user id"));
- factColumns.add(new FieldSchema("yuserid", "int", "user id"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
- factColumns.add(new FieldSchema("test_time_dim_hour_id", "int", "time id"));
-
- // create cube fact with materialized expressions
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
-
- factName = "testFact5_BASE";
- factColumns = new ArrayList<>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("booleancut", "boolean", "expr dim"));
-
- // create cube fact
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 150L,
- factValidityProperties, storageTables);
-
- // create fact only with extra measures
- factName = "testFact2_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr12", "float", "second measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
- factColumns.add(new FieldSchema("dim2", "int", "dim2 id"));
- factColumns.add(new FieldSchema("userid", "int", "user id"));
- factColumns.add(new FieldSchema("xuserid", "int", "user id"));
- factColumns.add(new FieldSchema("yuserid", "int", "user id"));
- // create cube fact
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
- Map<String, String> properties = Maps.newHashMap(factValidityProperties);
- properties.put(MetastoreConstants.FACT_ABSOLUTE_END_TIME, DateUtil.relativeToAbsolute("now.day - 2 days"));
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 3 days"));
- client.createCubeFactTable(BASE_CUBE_NAME, "testfact_deprecated", factColumns, storageAggregatePeriods, 5L,
- properties, storageTables);
-
- // create fact only with extra measures
- factName = "testFact3_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr13", "double", "third measure"));
- factColumns.add(new FieldSchema("msr14", "bigint", "fourth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
-
- // create cube fact
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
-
- // create fact with materialized expression
- factName = "testFact6_BASE";
- factColumns = new ArrayList<>();
- factColumns.add(new FieldSchema("msr13", "double", "third measure"));
- factColumns.add(new FieldSchema("msr14", "bigint", "fourth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("booleancut", "boolean", "expr dim"));
-
- // create cube fact
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 150L,
- factValidityProperties, storageTables);
-
- // create raw fact only with extra measures
- factName = "testFact2_RAW_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr11", "int", "first measure"));
- factColumns.add(new FieldSchema("msr12", "float", "second measure"));
- factColumns.add(new FieldSchema("msr9", "bigint", "ninth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
- factColumns.add(new FieldSchema("dim13", "string", "base dim"));
- factColumns.add(new FieldSchema("dim12", "string", "base dim"));
- factColumns.add(new FieldSchema("dim22", "string", "base dim"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
-
- storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- updates = new HashSet<UpdatePeriod>();
- updates.add(HOURLY);
- storageAggregatePeriods.put(c1, updates);
-
- storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- // create cube fact
- properties.clear();
- properties.putAll(factValidityProperties);
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_DATA_COMPLETENESS_TAG, "f2");
-
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
-
- // create raw fact only with extra measures
- factName = "testFact3_RAW_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr13", "double", "third measure"));
- factColumns.add(new FieldSchema("msr14", "bigint", "fourth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
- factColumns.add(new FieldSchema("dim12", "string", "base dim"));
-
- storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- updates = new HashSet<UpdatePeriod>();
- updates.add(HOURLY);
- storageAggregatePeriods.put(c1, updates);
-
- storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- properties.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat("user_id_added_in_past"), "2016-01-01");
- properties.put(MetastoreConstants.FACT_COL_END_TIME_PFX.concat("user_id_deprecated"), "2016-01-01");
- properties.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat("user_id_added_far_future"), "2099-01-01");
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
-
- factName = "testFact4_RAW_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr13", "double", "third measure"));
- factColumns.add(new FieldSchema("msr14", "bigint", "fourth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("user_id_added_in_past", "int", "user id"));
- factColumns.add(new FieldSchema("user_id_added_far_future", "int", "user id"));
- factColumns.add(new FieldSchema("user_id_deprecated", "int", "user id"));
-
- storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- properties.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat("user_id_added_in_past"), "2016-01-01");
- properties.put(MetastoreConstants.FACT_COL_END_TIME_PFX.concat("user_id_deprecated"), "2016-01-01");
- properties.put(MetastoreConstants.FACT_COL_START_TIME_PFX.concat("user_id_added_far_future"), "2099-01-01");
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
-
- factName = "testFact5_RAW_BASE";
- factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr9", "bigint", "ninth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
-
- properties.clear();
- properties.putAll(factValidityProperties);
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_DATA_COMPLETENESS_TAG, "f2");
- client.createCubeFactTable(BASE_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
-
- CubeFactTable fact = client.getFactTable(factName);
- // Add all hourly partitions for two days
- Calendar cal = Calendar.getInstance();
- cal.setTime(TWODAYS_BACK);
- Date temp = cal.getTime();
- while (!(temp.after(NOW))) {
- Map<String, Date> timeParts = new HashMap<String, Date>();
- timeParts.put("dt", temp);
- StoragePartitionDesc sPartSpec = new StoragePartitionDesc(fact.getName(), timeParts, null, HOURLY);
- client.addPartition(sPartSpec, c1, CubeTableType.FACT);
- cal.add(HOUR_OF_DAY, 1);
- temp = cal.getTime();
- }
- }
-
- private void createCubeContinuousFact(CubeMetastoreClient client) throws Exception {
- // create continuous raw fact only with extra measures
- String factName = "testFact_CONTINUOUS";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>();
- factColumns.add(new FieldSchema("msr11", "double", "third measure"));
- factColumns.add(new FieldSchema("msr15", "int", "fifteenth measure"));
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("d_time", "timestamp", "event time"));
- factColumns.add(new FieldSchema("processing_time", "timestamp", "processing time"));
- factColumns.add(new FieldSchema("dim1", "string", "base dim"));
- factColumns.add(new FieldSchema("dim11", "string", "base dim"));
- factColumns.add(new FieldSchema("dim12", "string", "base dim"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(CONTINUOUS);
- storageAggregatePeriods.put(c0, updates);
-
- StorageTableDesc s0 = new StorageTableDesc();
- s0.setInputFormat(TextInputFormat.class.getCanonicalName());
- s0.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c0, s0);
- Map<String, String> properties = Maps.newHashMap(factValidityProperties);
- properties.put(MetastoreConstants.FACT_ABSOLUTE_START_TIME, DateUtil.relativeToAbsolute("now.day - 3 days"));
-
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
- }
-
- private void createCubeFact(CubeMetastoreClient client) throws Exception {
+ private void assertTestFactTimelineClass(CubeMetastoreClient client) throws Exception {
String factName = "testFact";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- if (!measure.getColumn().getName().equals("msr15")) { //do not add msr15
- factColumns.add(measure.getColumn());
- }
- }
- factColumns.add(new FieldSchema("msr5", "double", "msr5"));
- // add dimensions of the cube
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- factColumns.add(new FieldSchema("cityid1", "int", "city id"));
- factColumns.add(new FieldSchema("stateid", "int", "city id"));
- factColumns.add(new FieldSchema("test_time_dim_day_id", "int", "time id"));
- factColumns.add(new FieldSchema("test_time_dim_day_id2", "int", "time id"));
- factColumns.add(new FieldSchema("ambigdim1", "string", "used in" + " testColumnAmbiguity"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(MINUTELY);
- updates.add(HOURLY);
- updates.add(DAILY);
- updates.add(MONTHLY);
- updates.add(QUARTERLY);
- updates.add(YEARLY);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
-
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- ArrayList<FieldSchema> s2PartCols = new ArrayList<FieldSchema>();
- s2PartCols.add(new FieldSchema("ttd", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2PartCols.add(new FieldSchema("ttd2", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2.setPartCols(s2PartCols);
- s2.setTimePartCols(Arrays.asList("ttd", "ttd2"));
-
- StorageTableDesc s3 = new StorageTableDesc();
- s3.setInputFormat(TextInputFormat.class.getCanonicalName());
- s3.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s3.setPartCols(partCols);
- s3.setTimePartCols(timePartCols);
- s3.getTblProps().put(MetastoreUtil.getStoragetableStartTimesKey(), "now.day - 90 days");
- s3.getTblProps().put(MetastoreUtil.getStoragetableEndTimesKey(), "now.day - 10 days");
-
- StorageTableDesc s5 = new StorageTableDesc();
- s5.setInputFormat(TextInputFormat.class.getCanonicalName());
- s5.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s5.setPartCols(partCols);
- s5.setTimePartCols(timePartCols);
- s5.getTblProps().put(MetastoreUtil.getStoragetableStartTimesKey(), "now.day - 10 days");
-
- storageAggregatePeriods.put(c1, updates);
- storageAggregatePeriods.put(c2, updates);
- storageAggregatePeriods.put(c3, updates);
- storageAggregatePeriods.put(c4, updates);
- storageAggregatePeriods.put(c5, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c4, s2);
- storageTables.put(c2, s1);
- storageTables.put(c3, s3);
- storageTables.put(c5, s5);
-
- //add storage with continuous update period
- updates.add(CONTINUOUS);
- storageAggregatePeriods.put(c0, updates);
- StorageTableDesc s0 = new StorageTableDesc();
- s0.setInputFormat(TextInputFormat.class.getCanonicalName());
- s0.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- storageTables.put(c0, s0);
-
- // create cube fact
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
client.getTimelines(factName, c1, null, null);
client.getTimelines(factName, c4, null, null);
+
client.clearHiveTableCache();
+
CubeFactTable fact = client.getFactTable(factName);
Table table = client.getTable(MetastoreUtil.getStorageTableName(fact.getName(), Storage.getPrefix(c1)));
assertEquals(table.getParameters().get(MetastoreUtil.getPartitionTimelineCachePresenceKey()), "true");
@@ -1857,62 +572,8 @@
assertTimeline(client, factName, storageName, updatePeriod, timeDim, expectedTimeline);
}
- private void createCubeCheapFact(CubeMetastoreClient client) throws HiveException, LensException {
+ private void createCubeCheapFactPartitions(CubeMetastoreClient client) throws HiveException, LensException {
String factName = "cheapFact";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- factColumns.add(new FieldSchema("stateid", "int", "city id"));
- factColumns.add(new FieldSchema("test_time_dim_hour_id", "int", "time id"));
- factColumns.add(new FieldSchema("ambigdim1", "string", "used in" + " testColumnAmbiguity"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(MINUTELY);
- updates.add(HOURLY);
- updates.add(DAILY);
- updates.add(MONTHLY);
- updates.add(QUARTERLY);
- updates.add(YEARLY);
-
- ArrayList<FieldSchema> partCols = new ArrayList<>();
- List<String> timePartCols = new ArrayList<>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
-
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- s1.setTblProps(new HashMap<String, String>());
- s1.getTblProps().put(MetastoreUtil.getStoragetableStartTimesKey(), "2000, now - 10 years");
- s1.getTblProps().put(MetastoreUtil.getStoragetableEndTimesKey(), "now - 5 years, 2010");
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- ArrayList<FieldSchema> s2PartCols = new ArrayList<>();
- s2PartCols.add(new FieldSchema("ttd", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2PartCols.add(new FieldSchema("ttd2", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2.setPartCols(s2PartCols);
- s2.setTimePartCols(Arrays.asList("ttd", "ttd2"));
-
- storageAggregatePeriods.put(c99, updates);
- storageAggregatePeriods.put(c0, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<>();
- storageTables.put(c99, s2);
- storageTables.put(c0, s1);
- // create cube fact
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 0L,
- factValidityProperties, storageTables);
-
CubeFactTable fact = client.getFactTable(factName);
// Add all hourly partitions for two days
Calendar cal = Calendar.getInstance();
@@ -1942,88 +603,9 @@
}
}
- private void createCubeFactWeekly(CubeMetastoreClient client) throws Exception {
- String factName = "testFactWeekly";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
- // add dimensions of the cube
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(WEEKLY);
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- storageAggregatePeriods.put(c1, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- // create cube fact
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
- }
-
- private void createCubeFactOnlyHourly(CubeMetastoreClient client) throws Exception {
+ private void createTestFact2Partitions(CubeMetastoreClient client) throws Exception {
String factName = "testFact2";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- if (!measure.getName().equals("msr4")) {
- factColumns.add(measure.getColumn());
- }
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- factColumns.add(new FieldSchema("cityid2", "int", "city id"));
- factColumns.add(new FieldSchema("test_time_dim_hour_id", "int", "time id"));
- factColumns.add(new FieldSchema("test_time_dim_hour_id2", "int", "time id"));
- factColumns.add(new FieldSchema("cdim2", "int", "cycledim id"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(HOURLY);
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- ArrayList<FieldSchema> s2PartCols = new ArrayList<FieldSchema>();
- s2PartCols.add(new FieldSchema("ttd", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2PartCols.add(new FieldSchema("ttd2", serdeConstants.STRING_TYPE_NAME, "test date partition"));
- s2.setPartCols(s2PartCols);
- s2.setTimePartCols(Arrays.asList("ttd", "ttd2"));
-
- storageAggregatePeriods.put(c1, updates);
- storageAggregatePeriods.put(c4, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c4, s2);
-
- // create cube fact
- client
- .createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 10L,
- factValidityProperties, storageTables);
CubeFactTable fact = client.getFactTable(factName);
// Add all hourly partitions for two days
Calendar cal = Calendar.getInstance();
@@ -2110,54 +692,8 @@
}
}
- private void createCubeFactOnlyHourlyRaw(CubeMetastoreClient client) throws HiveException, LensException {
+ private void createTestFact2RawPartitions(CubeMetastoreClient client) throws HiveException, LensException {
String factName = "testFact2_raw";
- String factName2 = "testFact1_raw_BASE";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- factColumns.add(new FieldSchema("cityid1", "int", "city id"));
- factColumns.add(new FieldSchema("cityid2", "int", "city id"));
- factColumns.add(new FieldSchema("stateid", "int", "state id"));
- factColumns.add(new FieldSchema("countryid", "int", "country id"));
- factColumns.add(new FieldSchema("dim1", "string", "dim1"));
- factColumns.add(new FieldSchema("dim2", "int", "dim2"));
- factColumns.add(new FieldSchema("concatedCityState", "string", "citystate"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(HOURLY);
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- storageAggregatePeriods.put(c1, updates);
- storageAggregatePeriods.put(c3, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c3, s1);
-
- // create cube fact
- Map<String, String> properties = new HashMap<String, String>();
- properties.putAll(factValidityProperties);
- properties.put(MetastoreConstants.FACT_AGGREGATED_PROPERTY, "false");
- properties.put(MetastoreConstants.FACT_DATA_COMPLETENESS_TAG, "f1");
-
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
- client.createCubeFactTable(BASE_CUBE_NAME, factName2, factColumns, storageAggregatePeriods, 100L, properties,
- storageTables);
CubeFactTable fact2 = client.getFactTable(factName);
// Add all hourly partitions for two days
Calendar cal = Calendar.getInstance();
@@ -2173,917 +709,6 @@
}
}
- private void createCubeFactMonthly(CubeMetastoreClient client) throws Exception {
- String factName = "testFactMonthly";
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- }
-
- // add one dimension of the cube
- factColumns.add(new FieldSchema("countryid", "int", "country id"));
-
- Map<String, Set<UpdatePeriod>> storageAggregatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(MONTHLY);
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- storageAggregatePeriods.put(c2, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c2, s1);
-
- // create cube fact
- client.createCubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageAggregatePeriods, 5L,
- factValidityProperties, storageTables);
- }
-
- // DimWithTwoStorages
- private void createCityTable(CubeMetastoreClient client) throws Exception {
- Set<CubeDimAttribute> cityAttrs = new HashSet<CubeDimAttribute>();
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "city name")));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("ambigdim1", "string", "used in testColumnAmbiguity")));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("ambigdim2", "string", "used in testColumnAmbiguity")));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("nocandidatecol", "string", "used in testing no"
- + " candidate available")));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("stateid", "int", "state id")));
- cityAttrs.add(new ReferencedDimAttribute(new FieldSchema("statename", "string", "state name"), "State name",
- "citystate", "name", null, null, null, null));
- cityAttrs.add(new BaseDimAttribute(new FieldSchema("zipcode", "int", "zip code")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey("citydim"), TestCubeMetastoreClient.getDatePartitionKey());
- Set<ExprColumn> exprs = new HashSet<ExprColumn>();
- exprs.add(new ExprColumn(new FieldSchema("CityAddress", "string", "city with state and city and zip"),
- "City Address",
- new ExprSpec("concat(citydim.name, \":\", citystate.name, \":\", citycountry.name, \":\", cityzip.code)", null,
- null), new ExprSpec("concat(citydim.name, \":\", citystate.name)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("CityState", "string", "city's state"),
- "City State", new ExprSpec("concat(citydim.name, \":\", citydim.statename)", null, null)));
- exprs.add(new ExprColumn(new FieldSchema("AggrExpr", "int", "count(name)"), "city count",
- new ExprSpec("count(name)", null, null)));
- Set<JoinChain> joinchains = new HashSet<JoinChain>() {
- {
- add(new JoinChain("cityState", "city-state", "state thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("citydim", "stateid"));
- add(new TableReference("statedim", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("citydim", "statename"));
- add(new TableReference("statedim", "name"));
- }
- });
- }
- });
- }
- };
- joinchains.add(new JoinChain("cityCountry", "cube-zip", "country thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("citydim", "stateid"));
- add(new TableReference("statedim", "id"));
- add(new TableReference("statedim", "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("citydim", "statename"));
- add(new TableReference("statedim", "name"));
- add(new TableReference("statedim", "countryid"));
- add(new TableReference("countrydim", "id"));
- }
- });
- }
- });
- joinchains.add(new JoinChain("cityZip", "city-zip", "Zipcode thru city") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("citydim", "zipcode"));
- add(new TableReference("zipdim", "code"));
- }
- });
- }
- });
- Dimension cityDim = new Dimension("citydim", cityAttrs, exprs, joinchains, dimProps, 0L);
- client.createDimension(cityDim);
-
- String dimName = "citytable";
-
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("stateid", "int", "state id"));
- dimColumns.add(new FieldSchema("zipcode", "int", "zip code"));
- dimColumns.add(new FieldSchema("ambigdim1", "string", "used in" + " testColumnAmbiguity"));
- dimColumns.add(new FieldSchema("ambigdim2", "string", "used in " + "testColumnAmbiguity"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- Map<String, String> tblPros = Maps.newHashMap();
- tblPros.put(LensConfConstants.STORAGE_COST, "100");
- s1.setTblProps(tblPros);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(cityDim.getName(), dimName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- dimName = "citytable2";
-
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("stateid", "int", "state id"));
-
- dumpPeriods = new HashMap<String, UpdatePeriod>();
- storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c4, s2);
- dumpPeriods.put(c4, null);
-
- client.createCubeDimensionTable(cityDim.getName(), dimName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- dimName = "citytable3";
-
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "name"));
-
- client.createCubeDimensionTable(cityDim.getName(), dimName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- dimName = "citytable4";
-
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
-
- client.createCubeDimensionTable(cityDim.getName(), dimName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- }
-
- private void createTestDim2(CubeMetastoreClient client) throws Exception {
- String dimName = "testDim2";
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
-
- Set<JoinChain> joinchains = new HashSet<>();
- JoinChain cityState = new JoinChain("cityState", "city-state", "state thru city");
- List<TableReference> statePaths1 = new ArrayList<>();
- statePaths1.add(new TableReference("testDim2", "cityid"));
- statePaths1.add(new TableReference("citydim", "id"));
- statePaths1.add(new TableReference("citydim", "stateid"));
- statePaths1.add(new TableReference("statedim", "id"));
- cityState.addPath(statePaths1);
- List<TableReference> statePaths2 = new ArrayList<TableReference>();
- statePaths2.add(new TableReference("testDim2", "cityid"));
- statePaths2.add(new TableReference("citydim", "id"));
- statePaths2.add(new TableReference("citydim", "statename"));
- statePaths2.add(new TableReference("statedim", "name"));
- cityState.addPath(statePaths2);
- joinchains.add(cityState);
- joinchains.add(new JoinChain("dim2city", "dim2-city", "city thru dim2") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("testdim2", "cityid"));
- add(new TableReference("citydim", "id"));
- }
- });
- }
- });
- joinchains.add(new JoinChain("dim3chain", "dim3-chain", "dim3 thru dim2") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("testdim2", "testDim3id"));
- add(new TableReference("testdim3", "id"));
- }
- });
- }
- });
- joinchains.add(new JoinChain("unreachableDim_chain", "dim2-unreachableDim", "unreachableDim thru dim2") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("testdim2", "urdimid"));
- add(new TableReference("unreachableDim", "id"));
- }
- });
- }
- });
- joinchains.add(new JoinChain("dim4chain", "cube-testdim3", "cyclicdim thru cube") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("testdim2", "testdim3id"));
- add(new TableReference("testdim3", "id"));
- add(new TableReference("testdim3", "testdim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- }
- });
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("bigid1", "bigint", "big id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("bigid2", "bigint", "big id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("bigidnew", "bigint", "big id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new ReferencedDimAttribute(new FieldSchema("testDim3id", "string", "f-key to testdim3"), "dim3 refer",
- "dim3chain", "id", null, null, 0.0));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("cityId", "string", "f-key to citydim")));
- dimAttrs.add(new ReferencedDimAttribute(new FieldSchema("cityname", "string", "name"), "cityname",
- "dim2city", "name", null, null, 0.0));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("urdimid", "int", "ref dim"), "urdim refer",
- null, null, 10.0));
- dimAttrs.add(new ReferencedDimAttribute(new FieldSchema("unreachableName", "string", ""), "urdim name",
- "unreachableDim_chain", "name", null, null, 10.0));
- // add ref dim through chain
- dimAttrs.add(new ReferencedDimAttribute(
- new FieldSchema("cityStateCapital", "string", "State's capital thru city"), "State's capital thru city",
- "cityState", "capital", null, null, null));
-
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension testDim2 = new Dimension(dimName, dimAttrs, null, joinchains, dimProps, 0L);
- client.createDimension(testDim2);
-
- String dimTblName = "testDim2Tbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("cityId", "string", "f-key to cityDim"));
- dimColumns.add(new FieldSchema("testDim3id", "string", "f-key to testdim3"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- // create table2
- dimTblName = "testDim2Tbl2";
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("bigid1", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("cityId", "string", "f-key to cityDim"));
- storageTables.put(c3, s1);
- dumpPeriods.put(c3, HOURLY);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 10L, dumpPeriods, dimProps, storageTables);
-
- // create table2
- dimTblName = "testDim2Tbl3";
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("bigid1", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("testDim3id", "string", "f-key to testdim3"));
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 20L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createTimeDims(CubeMetastoreClient client) throws Exception {
- String dimName = "dayDim";
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("full_date", "string", "full date")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("calendar_quarter", "int", "quarter id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("day_number_of_year", "int", "day number in year")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("is_weekend", "boolean", "is weekend?")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension testDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(testDim);
-
- String dimTblName = "dayDimTbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("full_date", "string", "field1"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c3, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c4, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c3, s1);
- storageTables.put(c4, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- String dimName2 = "hourDim";
- dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("full_hour", "string", "full date")));
- dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName2), TestCubeMetastoreClient.getDatePartitionKey());
- testDim = new Dimension(dimName2, dimAttrs, dimProps, 0L);
- client.createDimension(testDim);
-
- String dimTblName2 = "hourDimTbl";
- dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("full_hour", "string", "field1"));
-
- client.createCubeDimensionTable(dimName2, dimTblName2, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- }
-
- private void createTestDim3(CubeMetastoreClient client) throws Exception {
- String dimName = "testDim3";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("testDim4id", "string", "f-key to testdim4")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Set<JoinChain> joinchains = new HashSet<JoinChain>() {
- {
- add(new JoinChain("dim4chain", "dim4-chain", "dim4 thru dim3") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("testdim3", "testDim4id"));
- add(new TableReference("testdim4", "id"));
- }
- });
- }
- });
- }
- };
- Dimension testDim3 = new Dimension(dimName, dimAttrs, null, joinchains, dimProps, 0L);
- client.createDimension(testDim3);
-
- String dimTblName = "testDim3Tbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("testDim4id", "string", "f-key to testDim4"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createTestDim4(CubeMetastoreClient client) throws Exception {
- String dimName = "testDim4";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension testDim4 = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(testDim4);
-
- String dimTblName = "testDim4Tbl";
-
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createCyclicDim1(CubeMetastoreClient client) throws Exception {
- String dimName = "cycleDim1";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("cyleDim2Id", "string", "link to cyclic dim 2")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Set<JoinChain> joinchains = new HashSet<JoinChain>() {
- {
- add(new JoinChain("cycledim2chain", "cycledim2chain", "cycledim2chain") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("cycledim1", "cyleDim2Id"));
- add(new TableReference("cycleDim2", "id"));
- }
- });
- }
- });
- }
- };
- Dimension cycleDim1 = new Dimension(dimName, dimAttrs, null, joinchains, dimProps, 0L);
- client.createDimension(cycleDim1);
-
- String dimTblName = "cycleDim1Tbl";
-
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("cyleDim2Id", "string", "link to cyclic dim 2"));
-
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createCyclicDim2(CubeMetastoreClient client) throws Exception {
- String dimName = "cycleDim2";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("cyleDim1Id", "string", "link to cyclic dim 1")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Set<JoinChain> joinchains = new HashSet<JoinChain>() {
- {
- add(new JoinChain("cycledim1chain", "cycledim1chain", "cycledim1chain") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("cycledim2", "cyleDim1Id"));
- add(new TableReference("cycleDim1", "id"));
- }
- });
- }
- });
- }
- };
- Dimension cycleDim2 = new Dimension(dimName, dimAttrs, null, joinchains, dimProps, 0L);
- client.createDimension(cycleDim2);
-
- String dimTblName = "cycleDim2Tbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("cyleDim1Id", "string", "link to cyclic dim 1"));
-
- Map<String, List<TableReference>> dimensionReferences = new HashMap<String, List<TableReference>>();
- dimensionReferences.put("cyleDim1Id", Arrays.asList(new TableReference("cycleDim1", "id")));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c2, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createZiptable(CubeMetastoreClient client) throws Exception {
- String dimName = "zipdim";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("code", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("f1", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("f2", "string", "name")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension zipDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(zipDim);
-
- String dimTblName = "ziptable";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("code", "int", "code"));
- dimColumns.add(new FieldSchema("f1", "string", "field1"));
- dimColumns.add(new FieldSchema("f2", "string", "field2"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createUnReachabletable(CubeMetastoreClient client) throws Exception {
- String dimName = "unreachableDim";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "int", "code")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension urDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(urDim);
-
- String dimTblName = "unreachableDimTable";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createCountryTable(CubeMetastoreClient client) throws Exception {
- String dimName = "countrydim";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("captial", "string", "field2")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("region", "string", "region name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("ambigdim2", "string", "used in testColumnAmbiguity")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension countryDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(countryDim);
-
- String dimTblName = "countrytable";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("capital", "string", "field2"));
- dimColumns.add(new FieldSchema("region", "string", "region name"));
- dimColumns.add(new FieldSchema("ambigdim2", "string", "used in" + " testColumnAmbiguity"));
-
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c1, null);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- dimTblName = "countrytable_partitioned";
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- ArrayList<FieldSchema> partCols = Lists.newArrayList();
- partCols.add(dimColumns.remove(dimColumns.size() - 2));
- s2.setPartCols(partCols);
- dumpPeriods.clear();
- dumpPeriods.put(c3, HOURLY);
- storageTables.clear();
- storageTables.put(c3, s2);
- dimProps.put(MetastoreUtil.getDimTablePartsKey(dimTblName), partCols.get(0).getName());
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createStateTable(CubeMetastoreClient client) throws Exception {
- String dimName = "statedim";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "code")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("capital", "string", "field2")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("countryid", "string", "link to country table")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Set<JoinChain> joinchains = new HashSet<JoinChain>() {
- {
- add(new JoinChain("countrychain", "countrychain", "countrychain") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("statedim", "countryid"));
- add(new TableReference("country", "id"));
- }
- });
- }
- });
- }
- };
- Dimension stateDim = new Dimension(dimName, dimAttrs, null, joinchains, dimProps, 0L);
- client.createDimension(stateDim);
-
- String dimTblName = "statetable";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "code"));
- dimColumns.add(new FieldSchema("name", "string", "field1"));
- dimColumns.add(new FieldSchema("capital", "string", "field2"));
- dimColumns.add(new FieldSchema("countryid", "string", "region name"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
- dumpPeriods.put(c1, HOURLY);
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
-
- // In this, country id will be a partition
- dimTblName = "statetable_partitioned";
-
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- partCols.add(dimColumns.remove(dimColumns.size() - 1));
- s2.setPartCols(partCols);
- s2.setTimePartCols(timePartCols);
- dumpPeriods.clear();
- dumpPeriods.put(c3, HOURLY);
- storageTables.clear();
- storageTables.put(c3, s2);
- dimProps.put(MetastoreUtil.getDimTablePartsKey(dimTblName), partCols.get(1).getName());
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createUserTable(CubeMetastoreClient client) throws Exception {
- String dimName = "userdim";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("age", "string", "age")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("gender", "string", "gender")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("gender", "string", "gender")));
-
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Set<JoinChain> joinChains = new HashSet<JoinChain>();
- joinChains.add(new JoinChain("userSports", "user-sports", "user sports") {
- {
- addPath(new ArrayList<TableReference>() {
- {
- add(new TableReference("userdim", "id"));
- add(new TableReference("user_interests", "user_id", true));
- add(new TableReference("user_interests", "sport_id"));
- add(new TableReference("sports", "id"));
- }
- });
- }
- });
- Dimension userDim = new Dimension(dimName, dimAttrs, null, joinChains, dimProps, 0L);
- client.createDimension(userDim);
-
- String dimTblName = "usertable";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "id"));
- dimColumns.add(new FieldSchema("name", "string", "name"));
- dimColumns.add(new FieldSchema("age", "string", "age"));
- dimColumns.add(new FieldSchema("gender", "string", "gender"));
- dimColumns.add(new FieldSchema("user_id_added_in_past", "int", "user_id_added_in_past"));
- dimColumns.add(new FieldSchema("user_id_added_far_future", "int", "user_id_added_far_future"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c1, null);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s2.setPartCols(partCols);
- s2.setTimePartCols(timePartCols);
- dumpPeriods.put(c2, HOURLY);
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createUserInterests(CubeMetastoreClient client) throws Exception {
- String dimName = "user_interests";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("user_id", "int", "user id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("sport_id", "int", "sport id")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension interestDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(interestDim);
-
- String dimTblName = "user_interests_tbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "id"));
- dimColumns.add(new FieldSchema("user_id", "int", "user id"));
- dimColumns.add(new FieldSchema("sport_id", "int", "sport id"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c1, null);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s2.setPartCols(partCols);
- s2.setTimePartCols(timePartCols);
- dumpPeriods.put(c2, HOURLY);
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
-
- private void createSports(CubeMetastoreClient client) throws Exception {
- String dimName = "sports";
-
- Set<CubeDimAttribute> dimAttrs = new HashSet<CubeDimAttribute>();
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("id", "int", "id")));
- dimAttrs.add(new BaseDimAttribute(new FieldSchema("name", "string", "name")));
- Map<String, String> dimProps = new HashMap<String, String>();
- dimProps.put(MetastoreUtil.getDimTimedDimensionKey(dimName), TestCubeMetastoreClient.getDatePartitionKey());
- Dimension interestDim = new Dimension(dimName, dimAttrs, dimProps, 0L);
- client.createDimension(interestDim);
-
- String dimTblName = "sports_tbl";
- List<FieldSchema> dimColumns = new ArrayList<FieldSchema>();
- dimColumns.add(new FieldSchema("id", "int", "id"));
- dimColumns.add(new FieldSchema("name", "string", "name"));
-
- Map<String, UpdatePeriod> dumpPeriods = new HashMap<String, UpdatePeriod>();
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- dumpPeriods.put(c1, null);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s2.setPartCols(partCols);
- s2.setTimePartCols(timePartCols);
- dumpPeriods.put(c2, HOURLY);
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- client.createCubeDimensionTable(dimName, dimTblName, dimColumns, 0L, dumpPeriods, dimProps, storageTables);
- }
public void createSources(HiveConf conf, String dbName) throws Exception {
try {
@@ -3093,149 +718,124 @@
Hive.get(conf).createDatabase(database);
SessionState.get().setCurrentDatabase(dbName);
CubeMetastoreClient client = CubeMetastoreClient.getInstance(conf);
- client.createStorage(new HDFSStorage(c0));
- client.createStorage(new HDFSStorage(c1));
- client.createStorage(new HDFSStorage(c2));
- client.createStorage(new HDFSStorage(c3));
- client.createStorage(new HDFSStorage(c4));
- client.createStorage(new HDFSStorage(c5));
- client.createStorage(new HDFSStorage(c99));
- createCube(client);
- createBaseAndDerivedCubes(client);
- createCubeFact(client);
- createCubeContinuousFact(client);
- createCubeCheapFact(client);
+ createFromXML(client);
+ assertTestFactTimelineClass(client);
+ createCubeCheapFactPartitions(client);
// commenting this as the week date format throws IllegalPatternException
// createCubeFactWeekly(client);
- createCubeFactOnlyHourly(client);
- createCubeFactOnlyHourlyRaw(client);
-
- createCityTable(client);
- // For join resolver test
- createTestDim2(client);
- createTestDim3(client);
- createTestDim4(client);
- createTimeDims(client);
-
- // For join resolver cyclic links in dimension tables
- createCyclicDim1(client);
- createCyclicDim2(client);
-
- createCubeFactMonthly(client);
- createZiptable(client);
- createCountryTable(client);
- createStateTable(client);
- createCubeFactsWithValidColumns(client);
- createUnReachabletable(client);
- createUserTable(client);
- createSports(client);
- createUserInterests(client);
+ createTestFact2Partitions(client);
+ createTestFact2RawPartitions(client);
+ createBaseCubeFactPartitions(client);
+ createSummaryPartitions(client);
+// dump(client);
} catch (Exception exc) {
log.error("Exception while creating sources.", exc);
throw exc;
}
}
+ StrSubstitutor substitutor = new StrSubstitutor(new StrLookup<String>() {
+ @Override
+ public String lookup(String s) {
+ try {
+ return JAXBUtils.getXMLGregorianCalendar(DateUtil.resolveDate(s, NOW)).toString();
+ } catch (LensException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }, "$gregorian{", "}", '$');
+ StrSubstitutor substitutor2 = new StrSubstitutor(new StrLookup<String>() {
+ @Override
+ public String lookup(String s) {
+ try {
+ return DateUtil.relativeToAbsolute(s, NOW);
+ } catch (LensException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }, "$absolute{", "}", '$');
+ private void createFromXML(CubeMetastoreClient client) {
+ SchemaTraverser.SchemaEntityProcessor processor = (file, aClass) -> {
+ try {
+ BufferedReader br = new BufferedReader(new FileReader(file));
+ String replaced = br.lines().map(s->substitutor2.replace(substitutor.replace(s)))
+ .collect(Collectors.joining("\n"));
+ StringReader sr = new StringReader(replaced);
+ client.createEntity(LensJAXBContext.unmarshall(sr));
+ } catch (LensException | JAXBException | IOException e) {
+ throw new RuntimeException(e);
+ }
+ };
+ new SchemaTraverser(new File(getClass().getResource("/schema").getFile()), processor).run();
+ }
+
+ private void dump(CubeMetastoreClient client) throws LensException, IOException {
+// for (CubeInterface cubeInterface : client.getAllCubes()) {
+// String path = getClass().getResource("/schema/cubes/" + ((cubeInterface instanceof Cube) ? "base" : "derived")).getPath() + "/" + cubeInterface.getName() + ".xml";
+// try(BufferedWriter bw = new BufferedWriter(new FileWriter(path))) {
+// bw.write(ToXMLString.toString(JAXBUtils.xCubeFromHiveCube(cubeInterface)));
+// }
+// }
+ for (CubeFactTable cubeFactTable : client.getAllFacts()) {
+ try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/facts").getPath()+"/"+cubeFactTable.getName()+".xml"))) {
+ bw.write(ToXMLString.toString(client.getXFactTable(cubeFactTable)));
+ }
+ }
+// for (Dimension dim : client.getAllDimensions()) {
+// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/dimensions").getPath()+"/"+dim.getName()+".xml"))) {
+// bw.write(ToXMLString.toString(JAXBUtils.xdimensionFromDimension(dim)));
+// }
+// }
+ for (CubeDimensionTable dim : client.getAllDimensionTables()) {
+ try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/dimtables").getPath()+"/"+dim.getName()+".xml"))) {
+ bw.write(ToXMLString.toString(client.getXDimensionTable(dim)));
+ }
+ }
+// for (Storage storage : client.getAllStorages()) {
+// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/storages").getPath()+"/"+storage.getName()+".xml"))) {
+// bw.write(ToXMLString.toString(JAXBUtils.xstorageFromStorage(storage)));
+// }
+// }
+ }
public void dropSources(HiveConf conf, String dbName) throws Exception {
Hive metastore = Hive.get(conf);
metastore.dropDatabase(dbName, true, true, true);
}
- private void createCubeFactsWithValidColumns(CubeMetastoreClient client) throws Exception {
+ private void createSummaryPartitions(CubeMetastoreClient client) throws Exception {
String factName = "summary1";
- StringBuilder commonCols = new StringBuilder();
- List<FieldSchema> factColumns = new ArrayList<FieldSchema>(cubeMeasures.size());
- for (CubeMeasure measure : cubeMeasures) {
- factColumns.add(measure.getColumn());
- commonCols.append(measure.getName());
- commonCols.append(",");
- }
-
- // add dimensions of the cube
- factColumns.add(new FieldSchema("dim1", "string", "dim1"));
- factColumns.add(new FieldSchema("dim2", "string", "dim2"));
- factColumns.add(new FieldSchema("testdim3id", "string", "dim2"));
- factColumns.add(new FieldSchema("dim2big", "string", "dim2"));
- factColumns.add(new FieldSchema("zipcode", "int", "zip"));
- factColumns.add(new FieldSchema("cityid", "int", "city id"));
- Set<UpdatePeriod> updates = new HashSet<UpdatePeriod>();
- updates.add(MINUTELY);
- updates.add(HOURLY);
- updates.add(DAILY);
-
- ArrayList<FieldSchema> partCols = new ArrayList<FieldSchema>();
- List<String> timePartCols = new ArrayList<String>();
- partCols.add(TestCubeMetastoreClient.getDatePartition());
- timePartCols.add(TestCubeMetastoreClient.getDatePartitionKey());
- StorageTableDesc s1 = new StorageTableDesc();
- s1.setInputFormat(TextInputFormat.class.getCanonicalName());
- s1.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s1.setPartCols(partCols);
- s1.setTimePartCols(timePartCols);
-
- ArrayList<FieldSchema> partCols2 = new ArrayList<FieldSchema>();
- List<String> timePartCols2 = new ArrayList<String>();
- partCols2.add(new FieldSchema("pt", "string", "p time"));
- partCols2.add(new FieldSchema("it", "string", "i time"));
- partCols2.add(new FieldSchema("et", "string", "e time"));
- timePartCols2.add("pt");
- timePartCols2.add("it");
- timePartCols2.add("et");
- StorageTableDesc s2 = new StorageTableDesc();
- s2.setInputFormat(TextInputFormat.class.getCanonicalName());
- s2.setOutputFormat(HiveIgnoreKeyTextOutputFormat.class.getCanonicalName());
- s2.setPartCols(partCols2);
- s2.setTimePartCols(timePartCols2);
-
- Map<String, Set<UpdatePeriod>> storageUpdatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- storageUpdatePeriods.put(c1, updates);
- storageUpdatePeriods.put(c2, updates);
-
- Map<String, StorageTableDesc> storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c1, s1);
- storageTables.put(c2, s2);
-
- // create cube fact summary1
- Map<String, String> properties = new HashMap<String, String>();
- properties.putAll(factValidityProperties);
- String validColumns = commonCols.toString() + ",dim1,testdim3id";
- properties.put(MetastoreUtil.getValidColumnsKey(factName), validColumns);
- CubeFactTable fact1 =
- new CubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageUpdatePeriods, 10L, properties);
- client.createCubeTable(fact1, storageTables);
+ CubeFactTable fact1 = client.getFactTable(factName);
createPIEParts(client, fact1, c2);
- // create summary2 - same schema, different valid columns
factName = "summary2";
- validColumns = commonCols.toString() + ",dim1,dim2";
- properties.put(MetastoreUtil.getValidColumnsKey(factName), validColumns);
- CubeFactTable fact2 =
- new CubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageUpdatePeriods, 20L, properties);
- client.createCubeTable(fact2, storageTables);
+ CubeFactTable fact2 = client.getFactTable(factName);
createPIEParts(client, fact2, c2);
factName = "summary3";
- validColumns = commonCols.toString() + ",dim1,dim2,cityid,stateid";
- properties.put(MetastoreUtil.getValidColumnsKey(factName), validColumns);
- CubeFactTable fact3 =
- new CubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageUpdatePeriods, 30L, properties);
- client.createCubeTable(fact3, storageTables);
+ CubeFactTable fact3 = client.getFactTable(factName);
createPIEParts(client, fact3, c2);
- // create summary4 only on c2
- storageUpdatePeriods = new HashMap<String, Set<UpdatePeriod>>();
- storageUpdatePeriods.put(c2, updates);
- storageTables = new HashMap<String, StorageTableDesc>();
- storageTables.put(c2, s2);
factName = "summary4";
- validColumns = commonCols.toString() + ",dim1,dim2big1,dim2big2,cityid";
- properties.put(MetastoreUtil.getValidColumnsKey(factName), validColumns);
- CubeFactTable fact4 =
- new CubeFactTable(TEST_CUBE_NAME, factName, factColumns, storageUpdatePeriods, 15L, properties);
- client.createCubeTable(fact4, storageTables);
+ CubeFactTable fact4 = client.getFactTable(factName);
createPIEParts(client, fact4, c2);
}
+ private void createBaseCubeFactPartitions(CubeMetastoreClient client) throws HiveException, LensException {
+ String factName = "testFact5_RAW_BASE";
+ CubeFactTable fact = client.getFactTable(factName);
+ // Add all hourly partitions for two days
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(TWODAYS_BACK);
+ Date temp = cal.getTime();
+ while (!(temp.after(NOW))) {
+ Map<String, Date> timeParts = new HashMap<String, Date>();
+ timeParts.put("dt", temp);
+ StoragePartitionDesc sPartSpec = new StoragePartitionDesc(fact.getName(), timeParts, null, HOURLY);
+ client.addPartition(sPartSpec, c1, CubeTableType.FACT);
+ cal.add(HOUR_OF_DAY, 1);
+ temp = cal.getTime();
+ }
+ }
private void createPIEParts(CubeMetastoreClient client, CubeFactTable fact, String storageName)
throws Exception {
diff --git a/lens-cube/src/test/resources/schema/cubes/base/basecube.xml b/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
new file mode 100644
index 0000000..b1fea1c
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
@@ -0,0 +1,952 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_base_cube name="basecube" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.timedim.partition.et" value="et"/>
+ <property name="cube.timedim.partition.it" value="it"/>
+ <property name="cube.timedim.partition.d_time" value="dt"/>
+ <property name="cube.timedim.relation.processing_time" value="test_time_dim+[-5 days,5 days]"/>
+ <property name="cube.timedim.partition.processing_time" value="pt"/>
+ <property name="cube.timedim.partition.test_time_dim" value="ttd"/>
+ <property name="cube.timedim.relation.d_time" value="processing_time+[-5 days,5 days]"/>
+ <property name="cube.timedim.partition.test_time_dim2" value="ttd2"/>
+ <property name="cube.basecube.timed.dimensions.list" value="d_time,pt,it,et,test_time_dim,test_time_dim2"/>
+ <property name="cube.allfields.queriable" value="false"/>
+ <property name="cube.table.basecube.weight" value="0.0"/>
+ </properties>
+ <measures>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr21" display_string="Measure22"
+ description="second measure">
+ </measure>
+ <measure _type="BIGINT" default_aggr="COUNT" name="msr4" display_string="Measure4" description="fourth measure">
+ </measure>
+ <measure _type="INT" default_aggr="SUM" unit="RS" name="msr15" display_string="Measure15"
+ description="fifteenth measure">
+ </measure>
+ <measure _type="INT" name="union_join_ctx_msr3" description="union_join_ctx_third measure">
+ </measure>
+ <measure _type="INT" name="union_join_ctx_msr2" description="union_join_ctx_second measure">
+ </measure>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr2" display_string="Measure2"
+ description="second measure">
+ </measure>
+ <measure _type="BIGINT" default_aggr="SUM" name="directMsr" display_string="Direct Measure"
+ description="fifth measure">
+ </measure>
+ <measure _type="DOUBLE" default_aggr="MAX" name="msr3" display_string="Measure3" description="third measure">
+ </measure>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr22" display_string="Measure22"
+ description="second measure">
+ </measure>
+ <measure _type="BIGINT" name="msr9" description="ninth measure">
+ <tags>
+ <property name="cube.measure.datacompleteness.tag" value="tag1"/>
+ </tags>
+ </measure>
+ <measure _type="INT" name="msr1" description="first measure">
+ <tags>
+ <property name="cube.measure.datacompleteness.tag" value="tag1"/>
+ </tags>
+ </measure>
+ <measure _type="BIGINT" default_aggr="COUNT" name="msr14" display_string="Measure4" description="fourth measure">
+ </measure>
+ <measure _type="BIGINT" name="noAggrMsr" display_string="No aggregateMsr"
+ description="measure without a default aggregate">
+ </measure>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr12" display_string="Measure2"
+ description="second measure">
+ </measure>
+ <measure _type="DOUBLE" default_aggr="MAX" name="msr13" display_string="Measure3" description="third measure">
+ </measure>
+ <measure _type="BIGINT" start_time="2017-03-07T19:30:00.000+05:30" name="newmeasure" display_string="New measure"
+ description="measure available from now">
+ </measure>
+ <measure _type="INT" name="msr11" description="first measure">
+ </measure>
+ <measure _type="INT" name="union_join_ctx_msr1" description="union_join_ctx_first measure">
+ </measure>
+ </measures>
+ <dim_attributes>
+ <dim_attribute _type="string" name="union_join_ctx_cityname" display_string="union_join_ctx_city name"
+ description="union_join_ctx_city name">
+ <chain_ref_column chain_name="cubecityjoinunionctx" ref_col="name" dest_table="citydim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="cityname" display_string="city name" description="city name">
+ <chain_ref_column chain_name="cubecity" ref_col="name" dest_table="citydim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="citycountry" display_string="city country" description="">
+ <chain_ref_column chain_name="cubecitystatecountry" ref_col="name" dest_table="countrydim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="union_join_ctx_zipcode" description="union_join_ctx_the zipcode">
+ </dim_attribute>
+ <dim_attribute _type="string" name="unreachablename" display_string="urdim name" description="">
+ <chain_ref_column chain_name="unreachabledim_chain" ref_col="name" dest_table="unreachabledim"/>
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="dim2big1" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="bigid1" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="array<string>" name="ysports" display_string="yuser sports" description="">
+ <chain_ref_column chain_name="yusersports" ref_col="name" dest_table="sports"/>
+ </dim_attribute>
+ <dim_attribute _type="array<int>" name="sportids" display_string="user sports" description="">
+ <chain_ref_column chain_name="userinterestids" ref_col="sport_id" dest_table="user_interests"/>
+ </dim_attribute>
+ <dim_attribute _type="String" name="cubecountrycapital" display_string="Country capital" description="ref dim">
+ <chain_ref_column chain_name="cubestate" ref_col="countrycapital" dest_table="statedim"/>
+ <chain_ref_column chain_name="cubecitystatecountry" ref_col="capital" dest_table="countrydim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="cityid1" display_string="City1" description="id to city">
+ </dim_attribute>
+ <dim_attribute _type="int" name="dim12" display_string="Dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="id" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="xuserid" description="userid">
+ </dim_attribute>
+ <dim_attribute _type="int" name="cityid2" display_string="City2" description="id to city">
+ </dim_attribute>
+ <dim_attribute _type="string" name="dim11" description="basedim">
+ </dim_attribute>
+ <dim_attribute _type="int" start_time="2017-03-07T19:30:00.000+05:30" name="cdim2" display_string="Dim2 refer"
+ description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_day_id2" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="union_join_ctx_cityid" description="union_join_ctx_the cityid ">
+ </dim_attribute>
+ <dim_attribute _type="int" name="urdimid" display_string="urdim refer" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="dim2big2" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="bigid2" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="user_id_deprecated" description="user_id_deprecated">
+ </dim_attribute>
+ <dim_attribute _type="date" name="test_time_dim2" display_string="Timedim full date" description="chained dim">
+ <chain_ref_column chain_name="timehourchain2" ref_col="full_hour" dest_table="hourdim"/>
+ <chain_ref_column chain_name="timedatechain2" ref_col="full_date" dest_table="daydim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="citystatecapital" display_string="State's capital thru city"
+ description="State's capital thru city">
+ <chain_ref_column chain_name="citystate" ref_col="capital" dest_table="statedim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="statecountry" display_string="state country" description="">
+ <chain_ref_column chain_name="cubestatecountry" ref_col="name" dest_table="countrydim"/>
+ </dim_attribute>
+ <dim_attribute _type="bigint" start_time="2017-03-07T19:30:00.000+05:30" name="dim2bignew"
+ display_string="Dim2 refer" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_hour_id2" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="dim2" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="id" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_hour_id" display_string="Timedim reference" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="timestamp" name="d_time" description="d time">
+ </dim_attribute>
+ <dim_attribute _type="string" name="dim1" description="basedim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="user_id_added_far_future" description="user_id_added_far_future">
+ </dim_attribute>
+ <dim_attribute _type="string" name="testdim3id" display_string="dim3 refer" description="direct id to testdim3">
+ <chain_ref_column chain_name="dim3chain" ref_col="id" dest_table="testdim3"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="yuserid" description="userid">
+ </dim_attribute>
+ <dim_attribute _type="array<string>" name="xsports" display_string="xuser sports" description="">
+ <chain_ref_column chain_name="xusersports" ref_col="name" dest_table="sports"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="ambigdim1" description="used in testColumnAmbiguity">
+ </dim_attribute>
+ <dim_attribute _type="array<string>" name="sports" display_string="user sports" description="">
+ <chain_ref_column chain_name="usersports" ref_col="name" dest_table="sports"/>
+ </dim_attribute>
+ <dim_attribute _type="date" name="test_time_dim" display_string="Timedim full date" description="ref dim">
+ <chain_ref_column chain_name="timedatechain1" ref_col="full_date" dest_table="daydim"/>
+ <chain_ref_column chain_name="timehourchain1" ref_col="full_hour" dest_table="hourdim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="concatedcitystate" display_string="CityState" description="citystate">
+ </dim_attribute>
+ <dim_attribute _type="string" name="dim13" description="basedim">
+ </dim_attribute>
+ <dim_attribute name="location" description="Location hierarchy">
+ <hierarchy>
+ <dim_attribute _type="int" name="zipcode" description="zip">
+ </dim_attribute>
+ <dim_attribute _type="int" name="cityid" description="city">
+ </dim_attribute>
+ <dim_attribute _type="int" name="stateid" description="state">
+ </dim_attribute>
+ <dim_attribute _type="int" name="countryid" description="country">
+ </dim_attribute>
+ <dim_attribute _type="string" num_distinct_values="3" name="regionname" display_string="regionname"
+ description="region">
+ <values>APAC</values>
+ <values>EMEA</values>
+ <values>USA</values>
+ </dim_attribute>
+ </hierarchy>
+ </dim_attribute>
+ <dim_attribute _type="timestamp" name="processing_time" description="processing time">
+ </dim_attribute>
+ <dim_attribute _type="int" name="dim22" display_string="Dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="id" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="userid" description="userid">
+ </dim_attribute>
+ <dim_attribute _type="string" name="statename_cube" display_string="state name" description="state name">
+ <chain_ref_column chain_name="cubestate" ref_col="name" dest_table="statedim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="user_id_added_in_past" description="user_id_added_in_past">
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_day_id" display_string="Timedim reference" description="ref dim">
+ </dim_attribute>
+ </dim_attributes>
+ <expressions>
+ <expression _type="string" name="singlecolchainfield" display_string="cubecityname" description="cubecity.name">
+ <expr_spec expr="cubecity.name"/>
+ </expression>
+ <expression _type="double" name="msr8" display_string="Sixth Msr" description="measure expression">
+ <expr_spec expr="msr2 + msr3"/>
+ </expression>
+ <expression _type="double" name="msr2expr" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="case when cityStateName = 'xyz' then msr2 else 0 end"/>
+ </expression>
+ <expression _type="String" name="cubestatename" display_string="CubeState Name"
+ description="statename from cubestate">
+ <expr_spec expr="substr(cubestate.name, 5)"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_non_zero_msr2_sum" display_string="union_join_ctx_non zero msr2 sum"
+ description="union_join_ctx_non zero msr2 sum">
+ <expr_spec expr="sum(case when union_join_ctx_msr2 > 0 then union_join_ctx_msr2 else 0 end)"/>
+ </expression>
+ <expression _type="double" name="flooredmsr12" display_string="Floored msr12" description="floored measure12">
+ <expr_spec expr="floor(msr12)"/>
+ </expression>
+ <expression _type="String" name="cityandstate" display_string="City and State"
+ description="city and state together">
+ <expr_spec expr="concat(cityname, ":", statename_cube)"/>
+ <expr_spec expr="substr(concatedcitystate, 10)"/>
+ </expression>
+ <expression _type="double" name="avgmsr" display_string="Avg Msr" description="avg measure">
+ <expr_spec expr="avg(msr1 + msr2)"/>
+ </expression>
+ <expression _type="double" name="equalsums" display_string="equalsums" description="sums are equals">
+ <expr_spec expr="msr3 + msr4"/>
+ <expr_spec expr="(msr3 + msr2)/100"/>
+ </expression>
+ <expression _type="array<string>" name="sportids_abbr" display_string="user sports" description="">
+ <expr_spec expr="case when sportids == 1 then 'CKT' when sportids == 2 then 'FTB' else 'NON' end"/>
+ </expression>
+ <expression _type="double" name="summsrs" display_string="Sum Msrs" description="sum measures">
+ <expr_spec expr="(1000 + sum(msr1) + sum(msr2))/100"/>
+ </expression>
+ <expression _type="boolean" name="booleancut" display_string="Boolean cut" description="a boolean expression">
+ <expr_spec expr="(dim1 != 'x' AND dim2 != 10)"/>
+ </expression>
+ <expression _type="int" name="notnullcityid" display_string="Not null cityid Expr" description="Not null cityid">
+ <expr_spec expr="case when cityid is null then 0 else cityid end"/>
+ </expression>
+ <expression _type="double" name="roundedmsr1" display_string="Rounded msr1" description="rounded measure1">
+ <expr_spec expr="round(msr1/1000)"/>
+ </expression>
+ <expression _type="double" name="msr5" display_string="Fifth Msr" description="materialized in some facts">
+ <expr_spec expr="msr2 + msr3"/>
+ </expression>
+ <expression _type="String" name="citystatename" display_string="City State" description="city state">
+ <expr_spec expr="concat('CityState:', cubecity.statename)"/>
+ </expression>
+ <expression _type="string" name="singlecoldim1expr" display_string="dim1" description="dim1">
+ <expr_spec expr="dim1)"/>
+ </expression>
+ <expression _type="string" name="singlecolchainrefexpr" display_string="dim3chainid"
+ description="testcube.testDim3id">
+ <expr_spec expr="testcube.testDim3id"/>
+ </expression>
+ <expression _type="bigint" name="directmsrexpr" display_string="Direct Measure" description="">
+ <expr_spec expr="directMsr + 0"/>
+ <expr_spec expr="msr13 + msr14"/>
+ </expression>
+ <expression _type="double" name="msr7" display_string="Seventh Msr" description="measure expression">
+ <expr_spec
+ expr="case when sum(msr2) = 0 then 0 else sum(case when cityid='x' then msr21 else msr22 end)/sum(msr2) end"/>
+ </expression>
+ <expression _type="string" name="substrexpr" display_string="Substr expr" description="a sub-string expression">
+ <expr_spec expr="substr(dim1, 3))"/>
+ <expr_spec expr="substr(ascii(dim2chain.name), 3)"/>
+ </expression>
+ <expression _type="string" name="refexpr" display_string="Expr with cube and dim fields"
+ description="expression which facts and dimensions">
+ <expr_spec expr="concat(dim1, ":", citydim.name)"/>
+ </expression>
+ <expression _type="string" name="singlecoldim1qualifiedexpr" display_string="dim1" description="testcube.dim1">
+ <expr_spec expr="testcube.dim1"/>
+ </expression>
+ <expression _type="int" name="countofdistinctcityid" display_string="Count of Distinct CityId Expr"
+ description="Count of Distinct CityId">
+ <expr_spec expr="count(distinct(cityid))"/>
+ </expression>
+ <expression _type="array<string>" name="xsports_abbr" display_string="xuser sports" description="">
+ <expr_spec expr="substr(xsports, 3)"/>
+ </expression>
+ <expression _type="string" name="singlecolchainid" display_string="dim3chainid" description="dim3chain.id">
+ <expr_spec expr="dim3chain.id)"/>
+ </expression>
+ <expression _type="String" name="asciicity" display_string="ascii cityname substr" description="ascii cityname">
+ <expr_spec expr="ascii(cityname)"/>
+ </expression>
+ <expression _type="string" name="nocolexpr" display_string="No col expr"
+ description="expression which non existing colun">
+ <expr_spec expr="myfun(nonexist)"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_sum_msr1_msr2" display_string="union_join_ctx_sum of msr1 and msr2"
+ description="union_join_ctx_sum of msr1 and msr2">
+ <expr_spec expr="sum(union_join_ctx_msr1) + sum(union_join_ctx_msr2)"/>
+ </expression>
+ <expression _type="array<string>" name="sports_abbr" display_string="user sports" description="">
+ <expr_spec expr="substr(sports, 3)"/>
+ </expression>
+ <expression _type="boolean" name="indiasubstr" display_string="Nested expr"
+ description="nested sub string expression">
+ <expr_spec expr="substrexpr = 'INDIA'"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_notnullcityid" display_string="union_join_ctx_Not null cityid Expr"
+ description="union_join_ctx_Not null cityid">
+ <expr_spec expr="case when union_join_ctx_cityid is null then 0 else union_join_ctx_cityid end"/>
+ </expression>
+ <expression _type="String" name="cityandstatenew" display_string="City and State"
+ description="city and state together">
+ <expr_spec expr="concat(cityname, ":", statename_cube)" end_time="$gregorian{now.month-2months}"/>
+ <expr_spec expr="substr(concatedcitystate, 10)"/>
+ </expression>
+ <expression _type="String" name="isindia" display_string="Is Indian City/state" description="is indian city/state">
+ <expr_spec expr="cubecity.name == 'DELHI' OR cubestate.name == 'KARNATAKA' OR cubestate.name == 'MAHARASHTRA'"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_msr1_greater_than_100"
+ display_string="union_join_ctx_msr1 greater than 100"
+ description="union_join_ctx_msr1 greater than 100">
+ <expr_spec expr="case when sum(union_join_ctx_msr1) > 100 then "high" else "low" end"/>
+ </expression>
+ <expression _type="double" name="singlecolmsr2qualifiedexpr" display_string="Msr2" description="testcube.measure2">
+ <expr_spec expr="testcube.msr2"/>
+ </expression>
+ <expression _type="bigint" name="msr6" display_string="Measure6" description="sixth measure">
+ <expr_spec expr="sum(msr2) + max(msr3)/ count(msr4)"/>
+ </expression>
+ <expression _type="double" name="nestedexpr" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="avg(roundedmsr2)"/>
+ <expr_spec expr="avg(equalsums)"/>
+ <expr_spec expr="case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end"/>
+ </expression>
+ <expression _type="String" name="substrsprorts" display_string="substr sports" description="substr of sports">
+ <expr_spec expr="substr(sports, 10)"/>
+ </expression>
+ <expression _type="array<string>" name="ysports_abbr" display_string="yuser sports" description="">
+ <expr_spec expr="substr(ysports, 3)"/>
+ </expression>
+ <expression _type="string" name="newexpr" display_string="new measure expr"
+ description="expression which non existing colun">
+ <expr_spec expr="myfun(newmeasure)"/>
+ </expression>
+ <expression _type="string" name="substrexprdim2" display_string="Substr expr" description="a sub-string expression">
+ <expr_spec expr="substr(dim2, 3))"/>
+ <expr_spec expr="substr(ascii(dim2chain.name), 3)"/>
+ </expression>
+ <expression _type="double" name="singlecolmsr2expr" display_string="Msr2" description="measure2">
+ <expr_spec expr="msr2)"/>
+ </expression>
+ <expression _type="String" name="substrdim2big1" display_string="dim2big1 substr" description="substr of dim2big1">
+ <expr_spec expr="substr(dim2big1, 5)"/>
+ </expression>
+ <expression _type="double" name="roundedmsr2" display_string="Rounded msr2" description="rounded measure2">
+ <expr_spec expr="round(msr2/1000)"/>
+ </expression>
+ <expression _type="double" name="nestedexprwithtimes" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="avg(roundedmsr2)"/>
+ <expr_spec expr="avg(equalsums)"/>
+ <expr_spec expr="case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end"
+ start_time="2017-03-07T19:30:00.000+05:30"/>
+ <expr_spec expr="avg(newmeasure)"/>
+ </expression>
+ </expressions>
+ <join_chains>
+ <join_chain dest_table="userdim" name="user_id_added_far_future_chain"
+ display_string="user_id_added_far_future_chain" description="user_id_added_far_future_chain">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="user_id_added_far_future" maps_to_many="false"/>
+ <to table="userdim" column="user_id_added_far_future" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="countrydim" name="cubecountry" display_string="cube-country"
+ description="country thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="userdim" name="userchain" display_string="user-chain" description="user chain">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="userid" maps_to_many="false"/>
+ <to table="userdim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="sports" name="usersports" display_string="user-sports" description="user sports">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="userid" maps_to_many="false"/>
+ <to table="userdim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="userdim" column="id" maps_to_many="false"/>
+ <to table="user_interests" column="user_id" maps_to_many="true"/>
+ </edge>
+ <edge>
+ <from table="user_interests" column="sport_id" maps_to_many="false"/>
+ <to table="sports" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim4" name="dim4chain" display_string="cube-testdim3" description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim12" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity2" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid2" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="statedim" name="citystate" display_string="city-state" description="state thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="statename" maps_to_many="false"/>
+ <to table="statedim" column="name" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="hourdim" name="timehourchain1" display_string="time chain"
+ description="time dim thru hour dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="test_time_dim_hour_id" maps_to_many="false"/>
+ <to table="hourdim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="zipdim" name="cubezip" display_string="cube-zip" description="Zipcode thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="union_join_ctx_zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="sports" name="xusersports" display_string="xuser-sports" description="xuser sports">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="xuserid" maps_to_many="false"/>
+ <to table="userdim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="userdim" column="id" maps_to_many="false"/>
+ <to table="user_interests" column="user_id" maps_to_many="true"/>
+ </edge>
+ <edge>
+ <from table="user_interests" column="sport_id" maps_to_many="false"/>
+ <to table="sports" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="statedim" name="cubestate" display_string="cube-state" description="state thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecityjoinunionctx" display_string="cube-city"
+ description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="union_join_ctx_cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="countrydim" name="cubecitystatecountry" display_string="cube-city-state-country"
+ description="country through state thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="statedim" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="zipdim" name="cityzip" display_string="city-zip" description="zip thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="daydim" name="timedatechain2" display_string="time chain"
+ description="time dim thru date dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="test_time_dim_day_id2" maps_to_many="false"/>
+ <to table="daydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim3" name="dim3chain" display_string="cube-testdim3" description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim12" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="cycledim1" name="cdimchain" display_string="cube-cyclicdim"
+ description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cdim2" maps_to_many="false"/>
+ <to table="cycledim1" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="unreachabledim" name="unreachabledim_chain" display_string="cube-unreachableDim"
+ description="unreachableDim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="urdimid" maps_to_many="false"/>
+ <to table="unreachabledim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity1" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="cityid1" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="sports" name="yusersports" display_string="user-sports" description="user sports">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="yuserid" maps_to_many="false"/>
+ <to table="userdim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="userdim" column="id" maps_to_many="false"/>
+ <to table="user_interests" column="user_id" maps_to_many="true"/>
+ </edge>
+ <edge>
+ <from table="user_interests" column="sport_id" maps_to_many="false"/>
+ <to table="sports" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="hourdim" name="timehourchain2" display_string="time chain"
+ description="time dim thru hour dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="test_time_dim_hour_id2" maps_to_many="false"/>
+ <to table="hourdim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="user_interests" name="userinterestids" display_string="user-interestsIds"
+ description="user interest ids">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="userid" maps_to_many="false"/>
+ <to table="userdim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="userdim" column="id" maps_to_many="false"/>
+ <to table="user_interests" column="user_id" maps_to_many="true"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim2" name="dim2chain" display_string="cube-testdim2" description="testdim2 thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="dim12" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="countrydim" name="cubestatecountry" display_string="cube-state-country"
+ description="country through state">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="statedim" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="daydim" name="timedatechain1" display_string="time chain"
+ description="time dim thru date dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="basecube" column="test_time_dim_day_id" maps_to_many="false"/>
+ <to table="daydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+</x_base_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/base/testcube.xml b/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
new file mode 100644
index 0000000..0338f55
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
@@ -0,0 +1,640 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_base_cube name="testcube" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.timedim.partition.et" value="et"/>
+ <property name="cube.timedim.partition.it" value="it"/>
+ <property name="cube.timedim.partition.d_time" value="dt"/>
+ <property name="cube.timedim.partition.pt" value="pt"/>
+ <property name="cube.timedim.partition.test_time_dim" value="ttd"/>
+ <property name="cube.timedim.relation.d_time" value="test_time_dim+[-10 days,10 days]"/>
+ <property name="cube.table.testcube.weight" value="0.0"/>
+ <property name="cube.testcube.timed.dimensions.list" value="d_time,pt,it,et,test_time_dim,test_time_dim2"/>
+ <property name="cube.timedim.partition.test_time_dim2" value="ttd2"/>
+ </properties>
+ <measures>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr21" display_string="Measure22"
+ description="second measure"/>
+ <measure _type="BIGINT" default_aggr="COUNT" name="msr4" display_string="Measure4" description="fourth measure"/>
+ <measure _type="INT" default_aggr="SUM" unit="RS" name="msr15" display_string="Measure15"
+ description="fifteenth measure"/>
+ <measure _type="INT" name="union_join_ctx_msr3" description="union_join_ctx_third measure"/>
+ <measure _type="INT" name="union_join_ctx_msr2" description="union_join_ctx_second measure"/>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr2" display_string="Measure2"
+ description="second measure"/>
+ <measure _type="DOUBLE" default_aggr="MAX" name="msr3" display_string="Measure3" description="third measure"/>
+ <measure _type="FLOAT" default_aggr="SUM" unit="RS" name="msr22" display_string="Measure22"
+ description="second measure">
+ </measure>
+ <measure _type="BIGINT" name="msr9" description="ninth measure">
+ <tags>
+ <property name="cube.measure.datacompleteness.tag" value="tag1"/>
+ </tags>
+ </measure>
+ <measure _type="BIGINT" start_time="$gregorian{now.hour}" name="newmeasure" display_string="New measure"
+ description="measure available from now">
+ </measure>
+ <measure _type="INT" name="msr1" description="first measure">
+ <tags>
+ <property name="cube.measure.datacompleteness.tag" value="tag1"/>
+ </tags>
+ </measure>
+ <measure _type="BIGINT" name="noAggrMsr" display_string="No aggregateMsr"
+ description="measure without a default aggregate">
+ </measure>
+ <measure _type="INT" name="union_join_ctx_msr1" description="union_join_ctx_first measure">
+ </measure>
+ </measures>
+ <dim_attributes>
+ <dim_attribute _type="string" name="union_join_ctx_cityname" display_string="union_join_ctx_city name"
+ description="union_join_ctx_city name">
+ <chain_ref_column chain_name="cubecityjoinunionctx" ref_col="name" dest_table="citydim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="cityname" display_string="city name" description="city name">
+ <chain_ref_column chain_name="cubecity" ref_col="name" dest_table="citydim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="union_join_ctx_zipcode" description="union_join_ctx_the zipcode">
+ </dim_attribute>
+ <dim_attribute _type="string" name="unreachablename" display_string="urdim name" description="">
+ <chain_ref_column chain_name="unreachabledim_chain" ref_col="name" dest_table="unreachabledim"/>
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="dim2big1" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="bigid1" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="cityid1" display_string="City1" description="id to city">
+ </dim_attribute>
+ <dim_attribute _type="bigint" start_time="$gregorian{now.hour}" name="dim2bignew"
+ display_string="Dim2 refer" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="cityid2" display_string="City2" description="id to city">
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_day_id2" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="union_join_ctx_cityid" description="union_join_ctx_the cityid ">
+ </dim_attribute>
+ <dim_attribute _type="int" name="urdimid" display_string="urdim refer" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="dim2big2" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="bigid2" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="date" name="test_time_dim2" display_string="Timedim full date" description="chained dim">
+ <chain_ref_column chain_name="timehourchain2" ref_col="full_hour" dest_table="hourdim"/>
+ <chain_ref_column chain_name="timedatechain2" ref_col="full_date" dest_table="daydim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_hour_id2" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="int" name="dim2" display_string="dim2 refer" description="ref dim">
+ <chain_ref_column chain_name="dim2chain" ref_col="id" dest_table="testdim2"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_hour_id" display_string="Timedim reference" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="timestamp" name="d_time" description="d time">
+ </dim_attribute>
+ <dim_attribute _type="string" name="dim1" description="basedim">
+ </dim_attribute>
+ <dim_attribute _type="string" name="testdim3id" display_string="dim3 refer" description="direct id to testdim3">
+ <chain_ref_column chain_name="dim3chain" ref_col="id" dest_table="testdim3"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="ambigdim1" description="used in testColumnAmbiguity">
+ </dim_attribute>
+ <dim_attribute _type="date" name="test_time_dim" display_string="Timedim full date" description="ref dim">
+ <chain_ref_column chain_name="timedatechain1" ref_col="full_date" dest_table="daydim"/>
+ <chain_ref_column chain_name="timehourchain1" ref_col="full_hour" dest_table="hourdim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="concatedcitystate" display_string="CityState" description="citystate">
+ </dim_attribute>
+ <dim_attribute _type="int" start_time="$gregorian{now.hour}" name="cdim2" display_string="Dim2 refer"
+ description="ref dim">
+ </dim_attribute>
+ <dim_attribute name="location" description="Location hierarchy">
+ <hierarchy>
+ <dim_attribute _type="int" name="zipcode" description="zip"/>
+ <dim_attribute _type="int" name="cityid" description="city"/>
+ <dim_attribute _type="int" name="stateid" description="state"/>
+ <dim_attribute _type="int" name="countryid" description="country"/>
+ <dim_attribute _type="string" num_distinct_values="3" name="regionname" display_string="regionname"
+ description="region">
+ <values>APAC</values>
+ <values>EMEA</values>
+ <values>USA</values>
+ </dim_attribute>
+ </hierarchy>
+ </dim_attribute>
+ <dim_attribute _type="timestamp" name="processing_time" description="processing time">
+ </dim_attribute>
+ <dim_attribute _type="string" name="statename_cube" display_string="state name" description="state name">
+ <chain_ref_column chain_name="cubestate" ref_col="name" dest_table="statedim"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="test_time_dim_day_id" display_string="Timedim reference" description="ref dim">
+ </dim_attribute>
+ </dim_attributes>
+ <expressions>
+ <expression _type="string" name="singlecolchainfield" display_string="cubecityname" description="cubecity.name">
+ <expr_spec expr="cubecity.name"/>
+ </expression>
+ <expression _type="double" name="msr8" display_string="Sixth Msr" description="measure expression">
+ <expr_spec expr="msr2 + msr3"/>
+ </expression>
+ <expression _type="double" name="msr2expr" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="case when cityStateName = 'xyz' then msr2 else 0 end"/>
+ </expression>
+ <expression _type="String" name="cubestatename" display_string="CubeState Name"
+ description="statename from cubestate">
+ <expr_spec expr="substr(cubestate.name, 5)"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_non_zero_msr2_sum" display_string="union_join_ctx_non zero msr2 sum"
+ description="union_join_ctx_non zero msr2 sum">
+ <expr_spec expr="sum(case when union_join_ctx_msr2 > 0 then union_join_ctx_msr2 else 0 end)"/>
+ </expression>
+ <expression _type="double" name="flooredmsr12" display_string="Floored msr12" description="floored measure12">
+ <expr_spec expr="floor(msr12)"/>
+ </expression>
+ <expression _type="String" name="cityandstate" display_string="City and State"
+ description="city and state together">
+ <expr_spec expr="concat(cityname, ":", statename_cube)"/>
+ <expr_spec expr="substr(concatedcitystate, 10)"/>
+ </expression>
+ <expression _type="double" name="avgmsr" display_string="Avg Msr" description="avg measure">
+ <expr_spec expr="avg(msr1 + msr2)"/>
+ </expression>
+ <expression _type="double" name="equalsums" display_string="equalsums" description="sums are equals">
+ <expr_spec expr="msr3 + msr4"/>
+ <expr_spec expr="(msr3 + msr2)/100"/>
+ </expression>
+ <expression _type="double" name="summsrs" display_string="Sum Msrs" description="sum measures">
+ <expr_spec expr="(1000 + sum(msr1) + sum(msr2))/100"/>
+ </expression>
+ <expression _type="boolean" name="booleancut" display_string="Boolean cut" description="a boolean expression">
+ <expr_spec expr="(dim1 != 'x' AND dim2 != 10)"/>
+ </expression>
+ <expression _type="int" name="notnullcityid" display_string="Not null cityid Expr" description="Not null cityid">
+ <expr_spec expr="case when cityid is null then 0 else cityid end"/>
+ </expression>
+ <expression _type="double" name="roundedmsr1" display_string="Rounded msr1" description="rounded measure1">
+ <expr_spec expr="round(msr1/1000)"/>
+ </expression>
+ <expression _type="String" name="cityandstatenew" display_string="City and State"
+ description="city and state together">
+ <expr_spec expr="concat(cityname, ":", statename_cube)" end_time="$gregorian{now.month-2months}"/>
+ <expr_spec expr="substr(concatedcitystate, 10)"/>
+ </expression>
+ <expression _type="double" name="msr5" display_string="Fifth Msr" description="materialized in some facts">
+ <expr_spec expr="msr2 + msr3"/>
+ </expression>
+ <expression _type="String" name="citystatename" display_string="City State" description="city state">
+ <expr_spec expr="concat('CityState:', cubecity.statename)"/>
+ </expression>
+ <expression _type="string" name="singlecoldim1expr" display_string="dim1" description="dim1">
+ <expr_spec expr="dim1)"/>
+ </expression>
+ <expression _type="string" name="singlecolchainrefexpr" display_string="dim3chainid"
+ description="testcube.testDim3id">
+ <expr_spec expr="testcube.testDim3id"/>
+ </expression>
+ <expression _type="double" name="msr7" display_string="Seventh Msr" description="measure expression">
+ <expr_spec
+ expr="case when sum(msr2) = 0 then 0 else sum(case when cityid='x' then msr21 else msr22 end)/sum(msr2) end"/>
+ </expression>
+ <expression _type="string" name="substrexpr" display_string="Substr expr" description="a sub-string expression">
+ <expr_spec expr="substr(dim1, 3))"/>
+ <expr_spec expr="substr(ascii(dim2chain.name), 3)"/>
+ </expression>
+ <expression _type="string" name="refexpr" display_string="Expr with cube and dim fields"
+ description="expression which facts and dimensions">
+ <expr_spec expr="concat(dim1, ":", citydim.name)"/>
+ </expression>
+ <expression _type="string" name="singlecoldim1qualifiedexpr" display_string="dim1" description="testcube.dim1">
+ <expr_spec expr="testcube.dim1"/>
+ </expression>
+ <expression _type="int" name="countofdistinctcityid" display_string="Count of Distinct CityId Expr"
+ description="Count of Distinct CityId">
+ <expr_spec expr="count(distinct(cityid))"/>
+ </expression>
+ <expression _type="string" name="singlecolchainid" display_string="dim3chainid" description="dim3chain.id">
+ <expr_spec expr="dim3chain.id)"/>
+ </expression>
+ <expression _type="String" name="asciicity" display_string="ascii cityname substr" description="ascii cityname">
+ <expr_spec expr="ascii(cityname)"/>
+ </expression>
+ <expression _type="string" name="nocolexpr" display_string="No col expr"
+ description="expression which non existing colun">
+ <expr_spec expr="myfun(nonexist)"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_sum_msr1_msr2" display_string="union_join_ctx_sum of msr1 and msr2"
+ description="union_join_ctx_sum of msr1 and msr2">
+ <expr_spec expr="sum(union_join_ctx_msr1) + sum(union_join_ctx_msr2)"/>
+ </expression>
+ <expression _type="boolean" name="indiasubstr" display_string="Nested expr"
+ description="nested sub string expression">
+ <expr_spec expr="substrexpr = 'INDIA'"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_notnullcityid" display_string="union_join_ctx_Not null cityid Expr"
+ description="union_join_ctx_Not null cityid">
+ <expr_spec expr="case when union_join_ctx_cityid is null then 0 else union_join_ctx_cityid end"/>
+ </expression>
+ <expression _type="String" name="isindia" display_string="Is Indian City/state" description="is indian city/state">
+ <expr_spec expr="cubecity.name == 'DELHI' OR cubestate.name == 'KARNATAKA' OR cubestate.name == 'MAHARASHTRA'"/>
+ </expression>
+ <expression _type="int" name="union_join_ctx_msr1_greater_than_100"
+ display_string="union_join_ctx_msr1 greater than 100"
+ description="union_join_ctx_msr1 greater than 100">
+ <expr_spec expr="case when sum(union_join_ctx_msr1) > 100 then "high" else "low" end"/>
+ </expression>
+ <expression _type="double" name="singlecolmsr2qualifiedexpr" display_string="Msr2" description="testcube.measure2">
+ <expr_spec expr="testcube.msr2"/>
+ </expression>
+ <expression _type="double" name="nestedexprwithtimes" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="avg(roundedmsr2)"/>
+ <expr_spec expr="avg(equalsums)"/>
+ <expr_spec expr="case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end"
+ start_time="$gregorian{now.hour}"/>
+ <expr_spec expr="avg(newmeasure)"/>
+ </expression>
+ <expression _type="bigint" name="msr6" display_string="Measure6" description="sixth measure">
+ <expr_spec expr="sum(msr2) + max(msr3)/ count(msr4)"/>
+ </expression>
+ <expression _type="double" name="nestedexpr" display_string="Nested expr" description="nested expr">
+ <expr_spec expr="avg(roundedmsr2)"/>
+ <expr_spec expr="avg(equalsums)"/>
+ <expr_spec expr="case when substrexpr = 'xyz' then avg(msr5) when substrexpr = 'abc' then avg(msr4)/100 end"/>
+ </expression>
+ <expression _type="string" name="newexpr" display_string="new measure expr"
+ description="expression which non existing colun">
+ <expr_spec expr="myfun(newmeasure)"/>
+ </expression>
+ <expression _type="string" name="substrexprdim2" display_string="Substr expr" description="a sub-string expression">
+ <expr_spec expr="substr(dim2, 3))"/>
+ <expr_spec expr="substr(ascii(dim2chain.name), 3)"/>
+ </expression>
+ <expression _type="double" name="singlecolmsr2expr" display_string="Msr2" description="measure2">
+ <expr_spec expr="msr2)"/>
+ </expression>
+ <expression _type="String" name="substrdim2big1" display_string="dim2big1 substr" description="substr of dim2big1">
+ <expr_spec expr="substr(dim2big1, 5)"/>
+ </expression>
+ <expression _type="double" name="roundedmsr2" display_string="Rounded msr2" description="rounded measure2">
+ <expr_spec expr="round(msr2/1000)"/>
+ </expression>
+ </expressions>
+ <join_chains>
+ <join_chain dest_table="zipdim" name="cubezip" display_string="cube-zip" description="Zipcode thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="union_join_ctx_zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity1" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="cityid1" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="hourdim" name="timehourchain2" display_string="time chain"
+ description="time dim thru hour dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="test_time_dim_hour_id2" maps_to_many="false"/>
+ <to table="hourdim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="hourdim" name="timehourchain1" display_string="time chain"
+ description="time dim thru hour dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="test_time_dim_hour_id" maps_to_many="false"/>
+ <to table="hourdim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim2" name="dim2chain" display_string="cube-testdim2" description="testdim2 thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecity2" display_string="cube-city" description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="cityid2" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim4" name="dim4chain" display_string="cube-testdim3" description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="citydim" name="cubecityjoinunionctx" display_string="cube-city"
+ description="city thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="union_join_ctx_cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim3" name="dim3chain" display_string="cube-testdim3" description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2" maps_to_many="false"/>
+ <to table="testdim2" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big1" maps_to_many="false"/>
+ <to table="testdim2" column="bigid1" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2big2" maps_to_many="false"/>
+ <to table="testdim2" column="bigid2" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="dim2bignew" maps_to_many="false"/>
+ <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="daydim" name="timedatechain1" display_string="time chain"
+ description="time dim thru date dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="test_time_dim_day_id" maps_to_many="false"/>
+ <to table="daydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="statedim" name="cubestate" display_string="cube-state" description="state thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="countrydim" name="cubecountry" display_string="cube-country"
+ description="country thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="cycledim1" name="cdimchain" display_string="cube-cyclicdim"
+ description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="cdim2" maps_to_many="false"/>
+ <to table="cycledim1" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="daydim" name="timedatechain2" display_string="time chain"
+ description="time dim thru date dim">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="test_time_dim_day_id2" maps_to_many="false"/>
+ <to table="daydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="unreachabledim" name="unreachabledim_chain" display_string="cube-unreachableDim"
+ description="unreachableDim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testcube" column="urdimid" maps_to_many="false"/>
+ <to table="unreachabledim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+</x_base_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/derived/der1.xml b/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
new file mode 100644
index 0000000..dadf545
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_derived_cube parent="basecube" name="der1" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.der1.weight" value="5.0"/>
+ <property name="cube.allfields.queriable" value="true"/>
+ <property name="cube.der1.measures.list0" value="msr1,msr11,msr9"/>
+ <property name="cube.der1.measures.list.size" value="1"/>
+ <property name="cube.der1.dimensions.list0" value="d_time,dim1,dim11"/>
+ <property name="cube.der1.parent.cube" value="basecube"/>
+ <property name="cube.der1.dimensions.list.size" value="1"/>
+ </properties>
+ <measure_names>
+ <measure_name>msr1</measure_name>
+ <measure_name>msr11</measure_name>
+ <measure_name>msr9</measure_name>
+ </measure_names>
+ <dim_attr_names>
+ <attr_name>dim1</attr_name>
+ <attr_name>dim11</attr_name>
+ <attr_name>d_time</attr_name>
+ </dim_attr_names>
+</x_derived_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/derived/der2.xml b/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
new file mode 100644
index 0000000..0d0c9af
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_derived_cube parent="basecube" name="der2" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.der2.measures.list.size" value="1"/>
+ <property name="cube.der2.parent.cube" value="basecube"/>
+ <property name="cube.allfields.queriable" value="true"/>
+ <property name="cube.der2.dimensions.list0"
+ value="dim22,test_time_dim_day_id,dim13,dim12,test_time_dim2,test_time_dim_day_id2,test_time_dim_hour_id2,yuserid,d_time,dim2bignew,test_time_dim,dim2big1,dim11,dim2,cityid,dim1,dim2big2,stateid,test_time_dim_hour_id,userid,xuserid"/>
+ <property name="cube.der2.measures.list0" value="msr2,msr12,msr14,msr13,directmsr"/>
+ <property name="cube.der2.dimensions.list.size" value="1"/>
+ <property name="cube.table.der2.weight" value="10.0"/>
+ </properties>
+ <measure_names>
+ <measure_name>directmsr</measure_name>
+ <measure_name>msr2</measure_name>
+ <measure_name>msr12</measure_name>
+ <measure_name>msr14</measure_name>
+ <measure_name>msr13</measure_name>
+ </measure_names>
+ <dim_attr_names>
+ <attr_name>test_time_dim_hour_id</attr_name>
+ <attr_name>test_time_dim_hour_id2</attr_name>
+ <attr_name>yuserid</attr_name>
+ <attr_name>test_time_dim_day_id</attr_name>
+ <attr_name>dim2</attr_name>
+ <attr_name>dim2bignew</attr_name>
+ <attr_name>dim1</attr_name>
+ <attr_name>stateid</attr_name>
+ <attr_name>test_time_dim2</attr_name>
+ <attr_name>xuserid</attr_name>
+ <attr_name>dim2big1</attr_name>
+ <attr_name>cityid</attr_name>
+ <attr_name>userid</attr_name>
+ <attr_name>dim2big2</attr_name>
+ <attr_name>test_time_dim</attr_name>
+ <attr_name>test_time_dim_day_id2</attr_name>
+ <attr_name>dim13</attr_name>
+ <attr_name>dim11</attr_name>
+ <attr_name>dim22</attr_name>
+ <attr_name>dim12</attr_name>
+ <attr_name>d_time</attr_name>
+ </dim_attr_names>
+</x_derived_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/derived/der3.xml b/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
new file mode 100644
index 0000000..a91d11f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_derived_cube parent="basecube" name="der3" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.der3.dimensions.list0"
+ value="test_time_dim_hour_id2,d_time,test_time_dim_hour_id,test_time_dim2,test_time_dim_day_id,test_time_dim_day_id2,test_time_dim,dim1,location"/>
+ <property name="cube.der3.measures.list0" value="msr3,msr13"/>
+ <property name="cube.allfields.queriable" value="true"/>
+ <property name="cube.der3.measures.list.size" value="1"/>
+ <property name="cube.der3.dimensions.list.size" value="1"/>
+ <property name="cube.table.der3.weight" value="20.0"/>
+ <property name="cube.der3.parent.cube" value="basecube"/>
+ </properties>
+ <measure_names>
+ <measure_name>msr3</measure_name>
+ <measure_name>msr13</measure_name>
+ </measure_names>
+ <dim_attr_names>
+ <attr_name>test_time_dim_hour_id</attr_name>
+ <attr_name>test_time_dim_hour_id2</attr_name>
+ <attr_name>test_time_dim_day_id</attr_name>
+ <attr_name>dim1</attr_name>
+ <attr_name>stateid</attr_name>
+ <attr_name>test_time_dim2</attr_name>
+ <attr_name>cityid</attr_name>
+ <attr_name>countryid</attr_name>
+ <attr_name>zipcode</attr_name>
+ <attr_name>test_time_dim</attr_name>
+ <attr_name>test_time_dim_day_id2</attr_name>
+ <attr_name>regionname</attr_name>
+ <attr_name>d_time</attr_name>
+ </dim_attr_names>
+</x_derived_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml b/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
new file mode 100644
index 0000000..b86fc04
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_derived_cube parent="testcube" name="derivedcube" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.derivedcube.measures.list0" value="msr3,msr1,msr2,msr9"/>
+ <property name="cube.derivedcube.measures.list.size" value="1"/>
+ <property name="cube.derivedcube.dimensions.list0" value="dim2,dim1,dim2big2,dim2bignew,dim2big1"/>
+ <property name="cube.derivedcube.dimensions.list.size" value="1"/>
+ <property name="cube.derivedcube.parent.cube" value="testcube"/>
+ <property name="cube.table.derivedcube.weight" value="5.0"/>
+ </properties>
+ <measure_names>
+ <measure_name>msr3</measure_name>
+ <measure_name>msr2</measure_name>
+ <measure_name>msr1</measure_name>
+ <measure_name>msr9</measure_name>
+ </measure_names>
+ <dim_attr_names>
+ <attr_name>dim2</attr_name>
+ <attr_name>dim2bignew</attr_name>
+ <attr_name>dim1</attr_name>
+ <attr_name>dim2big1</attr_name>
+ <attr_name>dim2big2</attr_name>
+ </dim_attr_names>
+</x_derived_cube>
diff --git a/lens-cube/src/test/resources/schema/cubes/derived/union_join_ctx_der1.xml b/lens-cube/src/test/resources/schema/cubes/derived/union_join_ctx_der1.xml
new file mode 100644
index 0000000..a99f5d2
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/union_join_ctx_der1.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_derived_cube parent="basecube" name="union_join_ctx_der1" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.allfields.queriable" value="true"/>
+ <property name="cube.table.union_join_ctx_der1.weight" value="5.0"/>
+ <property name="cube.union_join_ctx_der1.measures.list.size" value="1"/>
+ <property name="cube.union_join_ctx_der1.measures.list0"
+ value="union_join_ctx_msr1,union_join_ctx_msr2,union_join_ctx_msr3"/>
+ <property name="cube.union_join_ctx_der1.dimensions.list.size" value="1"/>
+ <property name="cube.union_join_ctx_der1.dimensions.list0"
+ value="union_join_ctx_cityname,d_time,union_join_ctx_zipcode,union_join_ctx_cityid"/>
+ <property name="cube.union_join_ctx_der1.parent.cube" value="basecube"/>
+ </properties>
+ <measure_names>
+ <measure_name>union_join_ctx_msr2</measure_name>
+ <measure_name>union_join_ctx_msr1</measure_name>
+ <measure_name>union_join_ctx_msr3</measure_name>
+ </measure_names>
+ <dim_attr_names>
+ <attr_name>union_join_ctx_zipcode</attr_name>
+ <attr_name>union_join_ctx_cityname</attr_name>
+ <attr_name>d_time</attr_name>
+ <attr_name>union_join_ctx_cityid</attr_name>
+ </dim_attr_names>
+</x_derived_cube>
diff --git a/lens-cube/src/test/resources/schema/dimensions/citydim.xml b/lens-cube/src/test/resources/schema/dimensions/citydim.xml
new file mode 100644
index 0000000..cd884da
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/citydim.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="citydim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="stateid" description="state id">
+ </dim_attribute>
+ <dim_attribute _type="int" name="zipcode" description="zip code">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="statename" display_string="State name" description="state name">
+ <chain_ref_column chain_name="citystate" ref_col="name" dest_table="statedim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="nocandidatecol" description="used in testing no candidate available">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="city name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="ambigdim1" description="used in testColumnAmbiguity">
+ </dim_attribute>
+ <dim_attribute _type="string" name="ambigdim2" description="used in testColumnAmbiguity">
+ </dim_attribute>
+ </attributes>
+ <expressions>
+ <expression _type="string" name="citystate" display_string="City State" description="city's state">
+ <expr_spec expr="concat(citydim.name, ":", citydim.statename)"/>
+ </expression>
+ <expression _type="string" name="cityaddress" display_string="City Address"
+ description="city with state and city and zip">
+ <expr_spec
+ expr="concat(citydim.name, ":", citystate.name, ":", citycountry.name, ":", cityzip.code)"/>
+ <expr_spec expr="concat(citydim.name, ":", citystate.name)"/>
+ </expression>
+ <expression _type="int" name="aggrexpr" display_string="city count" description="count(name)">
+ <expr_spec expr="count(name)"/>
+ </expression>
+ </expressions>
+ <join_chains>
+ <join_chain dest_table="countrydim" name="citycountry" display_string="cube-zip" description="country thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="citydim" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="statedim" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="citydim" column="statename" maps_to_many="false"/>
+ <to table="statedim" column="name" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="statedim" column="countryid" maps_to_many="false"/>
+ <to table="countrydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="statedim" name="citystate" display_string="city-state" description="state thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="citydim" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="citydim" column="statename" maps_to_many="false"/>
+ <to table="statedim" column="name" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="zipdim" name="cityzip" display_string="city-zip" description="Zipcode thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="citydim" column="zipcode" maps_to_many="false"/>
+ <to table="zipdim" column="code" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="dimension.citydim.timed.dimension" value="dt"/>
+ <property name="cube.table.citydim.weight" value="0.0"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/countrydim.xml b/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
new file mode 100644
index 0000000..1e95416
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="countrydim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="string" name="captial" description="field2">
+ </dim_attribute>
+ <dim_attribute _type="string" name="region" description="region name">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="ambigdim2" description="used in testColumnAmbiguity">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.table.countrydim.weight" value="0.0"/>
+ <property name="dimension.countrydim.timed.dimension" value="dt"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml b/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
new file mode 100644
index 0000000..a9cc3ae
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="cycledim1" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="cyledim2id" description="link to cyclic dim 2">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="cycledim2" name="cycledim2chain" display_string="cycledim2chain"
+ description="cycledim2chain">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="cycledim1" column="cyledim2id" maps_to_many="false"/>
+ <to table="cycledim2" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.cycledim1.timed.dimension" value="dt"/>
+ <property name="dimension.joinchain.cycledim2chain.displaystring" value="cycledim2chain"/>
+ <property name="dimension.joinchain.cycledim2chain.numchains" value="1"/>
+ <property name="transient_lastDdlTime" value="1488895853"/>
+ <property name="dimension.cycledim1.joinchains.list.size" value="1"/>
+ <property name="cube.col.cyledim2id.description" value="link to cyclic dim 2"/>
+ <property name="base.cycledim1.expressions.list.size" value="0"/>
+ <property name="dimension.cycledim1.joinchains.list0" value="cycledim2chain"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.cycledim1.attributes.list0" value="id,name,cyledim2id"/>
+ <property name="dimension.cycledim1.attributes.list.size" value="1"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.table.cycledim1.weight" value="0.0"/>
+ <property name="dimension.joinchain.cycledim2chain.description" value="cycledim2chain"/>
+ <property name="cube.dimension.cyledim2id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="cube.dimension.cyledim2id.type" value="string"/>
+ <property name="dimension.joinchain.cycledim2chain.fullchain.0"
+ value="cycledim1.cyledim2id.false,cycledim2.id.false"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml b/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
new file mode 100644
index 0000000..b714f50
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="cycledim2" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="cyledim1id" description="link to cyclic dim 1">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="cycledim1" name="cycledim1chain" display_string="cycledim1chain"
+ description="cycledim1chain">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="cycledim2" column="cyledim1id" maps_to_many="false"/>
+ <to table="cycledim1" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="cube.col.cyledim1id.description" value="link to cyclic dim 1"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.joinchain.cycledim1chain.fullchain.0"
+ value="cycledim2.cyledim1id.false,cycledim1.id.false"/>
+ <property name="dimension.joinchain.cycledim1chain.displaystring" value="cycledim1chain"/>
+ <property name="cube.table.cycledim2.weight" value="0.0"/>
+ <property name="dimension.cycledim2.attributes.list0" value="id,name,cyledim1id"/>
+ <property name="dimension.joinchain.cycledim1chain.description" value="cycledim1chain"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.cycledim2.joinchains.list.size" value="1"/>
+ <property name="dimension.joinchain.cycledim1chain.numchains" value="1"/>
+ <property name="cube.dimension.cyledim1id.type" value="string"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="base.cycledim2.expressions.list.size" value="0"/>
+ <property name="dimension.cycledim2.joinchains.list0" value="cycledim1chain"/>
+ <property name="dimension.cycledim2.timed.dimension" value="dt"/>
+ <property name="cube.dimension.cyledim1id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.cycledim2.attributes.list.size" value="1"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/daydim.xml b/lens-cube/src/test/resources/schema/dimensions/daydim.xml
new file mode 100644
index 0000000..0ba6cee
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/daydim.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="daydim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="boolean" name="is_weekend" description="is weekend?">
+ </dim_attribute>
+ <dim_attribute _type="int" name="day_number_of_year" description="day number in year">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="full_date" description="full date">
+ </dim_attribute>
+ <dim_attribute _type="int" name="calendar_quarter" description="quarter id">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.col.is_weekend.description" value="is weekend?"/>
+ <property name="cube.dimension.calendar_quarter.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="cube.table.daydim.weight" value="0.0"/>
+ <property name="cube.col.calendar_quarter.description" value="quarter id"/>
+ <property name="base.daydim.expressions.list.size" value="0"/>
+ <property name="dimension.daydim.attributes.list.size" value="1"/>
+ <property name="cube.dimension.day_number_of_year.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.day_number_of_year.type" value="int"/>
+ <property name="cube.dimension.is_weekend.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.full_date.description" value="full date"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="dimension.daydim.timed.dimension" value="dt"/>
+ <property name="cube.dimension.is_weekend.type" value="boolean"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.full_date.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.full_date.type" value="string"/>
+ <property name="cube.col.day_number_of_year.description" value="day number in year"/>
+ <property name="cube.dimension.calendar_quarter.type" value="int"/>
+ <property name="dimension.daydim.attributes.list0"
+ value="is_weekend,day_number_of_year,id,full_date,calendar_quarter"/>
+ <property name="dimension.daydim.joinchains.list.size" value="0"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/hourdim.xml b/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
new file mode 100644
index 0000000..c7bf7fb
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="hourdim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="string" name="full_hour" description="full date">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.hourdim.timed.dimension" value="dt"/>
+ <property name="base.hourdim.expressions.list.size" value="0"/>
+ <property name="cube.dimension.full_hour.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.table.hourdim.weight" value="0.0"/>
+ <property name="dimension.hourdim.attributes.list0" value="full_hour,id"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.full_hour.description" value="full date"/>
+ <property name="dimension.hourdim.attributes.list.size" value="1"/>
+ <property name="dimension.hourdim.joinchains.list.size" value="0"/>
+ <property name="cube.dimension.full_hour.type" value="string"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/sports.xml b/lens-cube/src/test/resources/schema/dimensions/sports.xml
new file mode 100644
index 0000000..d237069
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/sports.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="sports" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="id">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.sports.attributes.list.size" value="1"/>
+ <property name="dimension.sports.attributes.list0" value="name,id"/>
+ <property name="cube.table.sports.weight" value="0.0"/>
+ <property name="cube.col.id.description" value="id"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="base.sports.expressions.list.size" value="0"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="dimension.sports.timed.dimension" value="dt"/>
+ <property name="dimension.sports.joinchains.list.size" value="0"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/statedim.xml b/lens-cube/src/test/resources/schema/dimensions/statedim.xml
new file mode 100644
index 0000000..ab55bdf
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/statedim.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="statedim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="countryid" description="link to country table">
+ </dim_attribute>
+ <dim_attribute _type="string" name="capital" description="field2">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="country" name="countrychain" display_string="countrychain" description="countrychain">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="statedim" column="countryid" maps_to_many="false"/>
+ <to table="country" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="dimension.joinchain.countrychain.displaystring" value="countrychain"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.col.capital.description" value="field2"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.countrychain.fullchain.0" value="statedim.countryid.false,country.id.false"/>
+ <property name="cube.dimension.capital.type" value="string"/>
+ <property name="dimension.joinchain.countrychain.description" value="countrychain"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.statedim.attributes.list.size" value="1"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="cube.dimension.capital.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.statedim.timed.dimension" value="dt"/>
+ <property name="cube.table.statedim.weight" value="0.0"/>
+ <property name="cube.col.countryid.description" value="link to country table"/>
+ <property name="dimension.statedim.attributes.list0" value="id,name,countryid,capital"/>
+ <property name="dimension.statedim.joinchains.list.size" value="1"/>
+ <property name="cube.dimension.countryid.type" value="string"/>
+ <property name="cube.dimension.countryid.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="base.statedim.expressions.list.size" value="0"/>
+ <property name="dimension.statedim.joinchains.list0" value="countrychain"/>
+ <property name="dimension.joinchain.countrychain.numchains" value="1"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/testdim2.xml b/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
new file mode 100644
index 0000000..65ebc3f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="testdim2" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="bigint" name="bigidnew" description="big id">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="unreachablename" display_string="urdim name" description="">
+ <chain_ref_column chain_name="unreachabledim_chain" ref_col="name" dest_table="unreachabledim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="cityname" display_string="cityname" description="name">
+ <chain_ref_column chain_name="dim2city" ref_col="name" dest_table="citydim"/>
+ </dim_attribute>
+ <dim_attribute _type="string" name="testdim3id" display_string="dim3 refer" description="f-key to testdim3">
+ <chain_ref_column chain_name="dim3chain" ref_col="id" dest_table="testdim3"/>
+ </dim_attribute>
+ <dim_attribute _type="int" name="urdimid" display_string="urdim refer" description="ref dim">
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="bigid1" description="big id">
+ </dim_attribute>
+ <dim_attribute _type="bigint" name="bigid2" description="big id">
+ </dim_attribute>
+ <dim_attribute _type="string" name="cityid" description="f-key to citydim">
+ </dim_attribute>
+ <dim_attribute _type="string" name="citystatecapital" display_string="State's capital thru city"
+ description="State's capital thru city">
+ <chain_ref_column chain_name="citystate" ref_col="capital" dest_table="statedim"/>
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="citydim" name="dim2city" display_string="dim2-city" description="city thru dim2">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim3" name="dim3chain" display_string="dim3-chain" description="dim3 thru dim2">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="testdim4" name="dim4chain" display_string="cube-testdim3" description="cyclicdim thru cube">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="testdim3id" maps_to_many="false"/>
+ <to table="testdim3" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="statedim" name="citystate" display_string="city-state" description="state thru city">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="stateid" maps_to_many="false"/>
+ <to table="statedim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="cityid" maps_to_many="false"/>
+ <to table="citydim" column="id" maps_to_many="false"/>
+ </edge>
+ <edge>
+ <from table="citydim" column="statename" maps_to_many="false"/>
+ <to table="statedim" column="name" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ <join_chain dest_table="unreachabledim" name="unreachabledim_chain" display_string="dim2-unreachableDim"
+ description="unreachableDim thru dim2">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim2" column="urdimid" maps_to_many="false"/>
+ <to table="unreachabledim" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="cube.dimension.urdimid.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.citystate.description" value="state thru city"/>
+ <property name="cube.col.testdim3id.displaystring" value="dim3 refer"/>
+ <property name="cube.dimension.citystatecapital.type" value="string"/>
+ <property name="cube.dimension.unreachablename.class" value="org.apache.lens.cube.metadata.ReferencedDimAttribute"/>
+ <property name="cube.col.cityid.description" value="f-key to citydim"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.dimension.bigidnew.type" value="bigint"/>
+ <property name="dimension.joinchain.citystate.fullchain.0"
+ value="testdim2.cityid.false,citydim.id.false,citydim.stateid.false,statedim.id.false"/>
+ <property name="cube.dimension.cityid.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.citystate.fullchain.1"
+ value="testdim2.cityid.false,citydim.id.false,citydim.statename.false,statedim.name.false"/>
+ <property name="dimension.testdim2.attributes.list0"
+ value="bigidnew,id,name,unreachablename,cityname,testdim3id,urdimid,bigid1,bigid2,cityid,citystatecapital"/>
+ <property name="dimension.joinchain.dim3chain.displaystring" value="dim3-chain"/>
+ <property name="cube.col.cityname.description" value="name"/>
+ <property name="cube.col.citystatecapital.description" value="State's capital thru city"/>
+ <property name="cube.col.testdim3id.description" value="f-key to testdim3"/>
+ <property name="cube.dimension.cityname.class" value="org.apache.lens.cube.metadata.ReferencedDimAttribute"/>
+ <property name="dimension.joinchain.dim2city.fullchain.0" value="testdim2.cityid.false,citydim.id.false"/>
+ <property name="cube.col.bigidnew.description" value="big id"/>
+ <property name="dimension.joinchain.unreachabledim_chain.description" value="unreachableDim thru dim2"/>
+ <property name="cube.col.cityname.displaystring" value="cityname"/>
+ <property name="dimension.joinchain.citystate.displaystring" value="city-state"/>
+ <property name="cube.col.bigid1.description" value="big id"/>
+ <property name="cube.col.bigid2.description" value="big id"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="cube.dimension.cityid.type" value="string"/>
+ <property name="dimension.joinchain.unreachabledim_chain.fullchain.0"
+ value="testdim2.urdimid.false,unreachabledim.id.false"/>
+ <property name="cube.table.testdim2.weight" value="0.0"/>
+ <property name="cube.dimension.cityname.chain.column.name" value="name"/>
+ <property name="dimension.joinchain.dim4chain.description" value="cyclicdim thru cube"/>
+ <property name="cube.dimension.unreachablename.chain.column.name" value="name"/>
+ <property name="cube.dimension.bigid2.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.unreachablename.type" value="string"/>
+ <property name="dimension.joinchain.dim4chain.numchains" value="1"/>
+ <property name="dimension.joinchain.dim3chain.fullchain.0" value="testdim2.testdim3id.false,testdim3.id.false"/>
+ <property name="dimension.testdim2.joinchains.list.size" value="1"/>
+ <property name="cube.col.unreachablename.description" value=""/>
+ <property name="dimension.joinchain.unreachabledim_chain.displaystring" value="dim2-unreachableDim"/>
+ <property name="dimension.joinchain.dim3chain.numchains" value="1"/>
+ <property name="cube.dimension.testdim3id.chain.column.name" value="id"/>
+ <property name="cube.dimension.testdim3id.type" value="string"/>
+ <property name="dimension.joinchain.citystate.numchains" value="2"/>
+ <property name="dimension.joinchain.dim3chain.description" value="dim3 thru dim2"/>
+ <property name="dimension.joinchain.dim4chain.fullchain.0"
+ value="testdim2.testdim3id.false,testdim3.id.false,testdim3.testdim4id.false,testdim4.id.false"/>
+ <property name="cube.col.cityname.cost" value="0.0"/>
+ <property name="cube.dimension.bigid2.type" value="bigint"/>
+ <property name="cube.dimension.bigid1.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.testdim3id.class" value="org.apache.lens.cube.metadata.ReferencedDimAttribute"/>
+ <property name="dimension.joinchain.unreachabledim_chain.numchains" value="1"/>
+ <property name="cube.col.testdim3id.cost" value="0.0"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.cityname.type" value="string"/>
+ <property name="cube.dimension.citystatecapital.class"
+ value="org.apache.lens.cube.metadata.ReferencedDimAttribute"/>
+ <property name="cube.col.urdimid.displaystring" value="urdim refer"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="cube.col.urdimid.cost" value="10.0"/>
+ <property name="cube.dimension.cityname.chain.name" value="dim2city"/>
+ <property name="cube.dimension.testdim3id.chain.name" value="dim3chain"/>
+ <property name="dimension.joinchain.dim2city.description" value="city thru dim2"/>
+ <property name="dimension.joinchain.dim4chain.displaystring" value="cube-testdim3"/>
+ <property name="dimension.testdim2.timed.dimension" value="dt"/>
+ <property name="cube.dimension.bigidnew.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.dim2city.numchains" value="1"/>
+ <property name="dimension.testdim2.attributes.list.size" value="1"/>
+ <property name="cube.col.urdimid.description" value="ref dim"/>
+ <property name="cube.dimension.citystatecapital.chain.column.name" value="capital"/>
+ <property name="dimension.testdim2.joinchains.list0"
+ value="dim2city,dim3chain,dim4chain,citystate,unreachabledim_chain"/>
+ <property name="cube.col.unreachablename.displaystring" value="urdim name"/>
+ <property name="cube.dimension.urdimid.type" value="int"/>
+ <property name="base.testdim2.expressions.list.size" value="0"/>
+ <property name="cube.col.unreachablename.cost" value="10.0"/>
+ <property name="dimension.joinchain.dim2city.displaystring" value="dim2-city"/>
+ <property name="cube.dimension.citystatecapital.chain.name" value="citystate"/>
+ <property name="cube.dimension.bigid1.type" value="bigint"/>
+ <property name="cube.col.citystatecapital.displaystring" value="State's capital thru city"/>
+ <property name="cube.dimension.unreachablename.chain.name" value="unreachabledim_chain"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/testdim3.xml b/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
new file mode 100644
index 0000000..c9003f8
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="testdim3" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="testdim4id" description="f-key to testdim4">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="testdim4" name="dim4chain" display_string="dim4-chain" description="dim4 thru dim3">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="testdim3" column="testdim4id" maps_to_many="false"/>
+ <to table="testdim4" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="base.testdim3.expressions.list.size" value="0"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.testdim3.attributes.list0" value="id,name,testdim4id"/>
+ <property name="dimension.testdim3.timed.dimension" value="dt"/>
+ <property name="cube.dimension.testdim4id.type" value="string"/>
+ <property name="dimension.testdim3.attributes.list.size" value="1"/>
+ <property name="dimension.joinchain.dim4chain.fullchain.0" value="testdim3.testdim4id.false,testdim4.id.false"/>
+ <property name="cube.table.testdim3.weight" value="0.0"/>
+ <property name="dimension.joinchain.dim4chain.description" value="dim4 thru dim3"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="dimension.testdim3.joinchains.list.size" value="1"/>
+ <property name="dimension.testdim3.joinchains.list0" value="dim4chain"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.testdim4id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.dim4chain.numchains" value="1"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="cube.col.testdim4id.description" value="f-key to testdim4"/>
+ <property name="dimension.joinchain.dim4chain.displaystring" value="dim4-chain"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/testdim4.xml b/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
new file mode 100644
index 0000000..a5024da
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="testdim4" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.testdim4.attributes.list.size" value="1"/>
+ <property name="dimension.testdim4.timed.dimension" value="dt"/>
+ <property name="base.testdim4.expressions.list.size" value="0"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.table.testdim4.weight" value="0.0"/>
+ <property name="dimension.testdim4.attributes.list0" value="id,name"/>
+ <property name="dimension.testdim4.joinchains.list.size" value="0"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml b/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
new file mode 100644
index 0000000..5e4ff70
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="unreachabledim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="id" description="code">
+ </dim_attribute>
+ <dim_attribute _type="int" name="name" description="code">
+ </dim_attribute>
+ </attributes>
+ <join_chains/>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.unreachabledim.attributes.list.size" value="1"/>
+ <property name="dimension.unreachabledim.attributes.list0" value="id,name"/>
+ <property name="base.unreachabledim.expressions.list.size" value="0"/>
+ <property name="dimension.unreachabledim.joinchains.list.size" value="0"/>
+ <property name="cube.col.id.description" value="code"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.unreachabledim.timed.dimension" value="dt"/>
+ <property name="cube.col.name.description" value="code"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="int"/>
+ <property name="cube.table.unreachabledim.weight" value="0.0"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/user_interests.xml b/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
new file mode 100644
index 0000000..caadf91
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="user_interests" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="int" name="user_id" description="user id">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="id">
+ </dim_attribute>
+ <dim_attribute _type="int" name="sport_id" description="sport id">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="cube.dimension.user_id.type" value="int"/>
+ <property name="cube.table.user_interests.weight" value="0.0"/>
+ <property name="cube.dimension.user_id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.user_interests.attributes.list.size" value="1"/>
+ <property name="cube.dimension.sport_id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.sport_id.description" value="sport id"/>
+ <property name="cube.col.id.description" value="id"/>
+ <property name="dimension.user_interests.attributes.list0" value="user_id,id,sport_id"/>
+ <property name="dimension.user_interests.joinchains.list.size" value="0"/>
+ <property name="cube.col.user_id.description" value="user id"/>
+ <property name="base.user_interests.expressions.list.size" value="0"/>
+ <property name="dimension.user_interests.timed.dimension" value="dt"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.sport_id.type" value="int"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/userdim.xml b/lens-cube/src/test/resources/schema/dimensions/userdim.xml
new file mode 100644
index 0000000..0ffbb6f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/userdim.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="userdim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="string" name="name" description="name">
+ </dim_attribute>
+ <dim_attribute _type="string" name="age" description="age">
+ </dim_attribute>
+ <dim_attribute _type="string" name="gender" description="gender">
+ </dim_attribute>
+ <dim_attribute _type="int" name="id" description="id">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains>
+ <join_chain dest_table="sports" name="usersports" display_string="user-sports" description="user sports">
+ <paths>
+ <path>
+ <edges>
+ <edge>
+ <from table="userdim" column="id" maps_to_many="false"/>
+ <to table="user_interests" column="user_id" maps_to_many="true"/>
+ </edge>
+ <edge>
+ <from table="user_interests" column="sport_id" maps_to_many="false"/>
+ <to table="sports" column="id" maps_to_many="false"/>
+ </edge>
+ </edges>
+ </path>
+ </paths>
+ </join_chain>
+ </join_chains>
+ <properties>
+ <property name="cube.dimension.age.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.joinchain.usersports.numchains" value="1"/>
+ <property name="dimension.userdim.joinchains.list.size" value="1"/>
+ <property name="cube.col.id.description" value="id"/>
+ <property name="cube.dimension.age.type" value="string"/>
+ <property name="dimension.userdim.attributes.list.size" value="1"/>
+ <property name="cube.dimension.name.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.name.description" value="name"/>
+ <property name="cube.dimension.id.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.name.type" value="string"/>
+ <property name="cube.table.userdim.weight" value="0.0"/>
+ <property name="dimension.userdim.joinchains.list0" value="usersports"/>
+ <property name="dimension.userdim.attributes.list0" value="name,age,gender,id"/>
+ <property name="cube.dimension.gender.type" value="string"/>
+ <property name="cube.dimension.id.type" value="int"/>
+ <property name="dimension.joinchain.usersports.displaystring" value="user-sports"/>
+ <property name="cube.col.gender.description" value="gender"/>
+ <property name="base.userdim.expressions.list.size" value="0"/>
+ <property name="dimension.joinchain.usersports.description" value="user sports"/>
+ <property name="dimension.userdim.timed.dimension" value="dt"/>
+ <property name="dimension.joinchain.usersports.fullchain.0"
+ value="userdim.id.false,user_interests.user_id.true,user_interests.sport_id.false,sports.id.false"/>
+ <property name="cube.dimension.gender.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.age.description" value="age"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimensions/zipdim.xml b/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
new file mode 100644
index 0000000..22755ca
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension name="zipdim" xmlns="uri:lens:cube:0.1">
+ <attributes>
+ <dim_attribute _type="string" name="f2" description="name">
+ </dim_attribute>
+ <dim_attribute _type="int" name="code" description="code">
+ </dim_attribute>
+ <dim_attribute _type="string" name="f1" description="name">
+ </dim_attribute>
+ </attributes>
+ <expressions/>
+ <join_chains/>
+ <properties>
+ <property name="dimension.zipdim.attributes.list0" value="f2,code,f1"/>
+ <property name="cube.dimension.code.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.col.code.description" value="code"/>
+ <property name="cube.dimension.f1.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="dimension.zipdim.joinchains.list.size" value="0"/>
+ <property name="dimension.zipdim.timed.dimension" value="dt"/>
+ <property name="base.zipdim.expressions.list.size" value="0"/>
+ <property name="cube.col.f1.description" value="name"/>
+ <property name="cube.table.zipdim.weight" value="0.0"/>
+ <property name="cube.dimension.f1.type" value="string"/>
+ <property name="cube.col.f2.description" value="name"/>
+ <property name="cube.dimension.f2.type" value="string"/>
+ <property name="cube.dimension.f2.class" value="org.apache.lens.cube.metadata.BaseDimAttribute"/>
+ <property name="cube.dimension.code.type" value="int"/>
+ <property name="dimension.zipdim.attributes.list.size" value="1"/>
+ </properties>
+</x_dimension>
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable.xml b/lens-cube/src/test/resources/schema/dimtables/citytable.xml
new file mode 100644
index 0000000..507369a
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="citydim" table_name="citytable" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="stateid" _type="int" comment="state id"/>
+ <column name="zipcode" _type="int" comment="zip code"/>
+ <column name="ambigdim1" _type="string" comment="used in testColumnAmbiguity"/>
+ <column name="ambigdim2" _type="string" comment="used in testColumnAmbiguity"/>
+ </columns>
+ <properties>
+ <property name="dimension.citydim.timed.dimension" value="dt"/>
+ <property name="dimtble.citytable.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.citytable.storages" value="C1,C2"/>
+ <property name="dimtble.citytable.dim.name" value="citydim"/>
+ <property name="cube.table.citytable.weight" value="0.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="lens.metastore.table.storage.cost" value="100"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable2.xml b/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
new file mode 100644
index 0000000..7b9ef97
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="citydim" table_name="citytable2" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="stateid" _type="int" comment="state id"/>
+ </columns>
+ <properties>
+ <property name="dimension.citydim.timed.dimension" value="dt"/>
+ <property name="cube.table.citytable2.weight" value="0.0"/>
+ <property name="dimtble.citytable2.storages" value="C4"/>
+ <property name="dimtble.citytable2.dim.name" value="citydim"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable3.xml b/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
new file mode 100644
index 0000000..f599eb2
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="citydim" table_name="citytable3" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="name"/>
+ </columns>
+ <properties>
+ <property name="dimension.citydim.timed.dimension" value="dt"/>
+ <property name="dimtble.citytable3.dim.name" value="citydim"/>
+ <property name="cube.table.citytable3.weight" value="0.0"/>
+ <property name="dimtble.citytable3.storages" value="C4"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable4.xml b/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
new file mode 100644
index 0000000..2b70995
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="citydim" table_name="citytable4" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ </columns>
+ <properties>
+ <property name="cube.table.citytable4.weight" value="0.0"/>
+ <property name="dimension.citydim.timed.dimension" value="dt"/>
+ <property name="dimtble.citytable4.dim.name" value="citydim"/>
+ <property name="dimtble.citytable4.storages" value="C4"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/countrytable.xml b/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
new file mode 100644
index 0000000..a82d7bc
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="countrydim" table_name="countrytable" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="capital" _type="string" comment="field2"/>
+ <column name="region" _type="string" comment="region name"/>
+ <column name="ambigdim2" _type="string" comment="used in testColumnAmbiguity"/>
+ </columns>
+ <properties>
+ <property name="dimtble.countrytable.dim.name" value="countrydim"/>
+ <property name="dimension.countrydim.timed.dimension" value="dt"/>
+ <property name="cube.table.countrytable.weight" value="0.0"/>
+ <property name="dimtble.countrytable.storages" value="C1"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml b/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
new file mode 100644
index 0000000..ecf88ac
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="countrydim" table_name="countrytable_partitioned" weight="0.0"
+ xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="capital" _type="string" comment="field2"/>
+ <column name="ambigdim2" _type="string" comment="used in testColumnAmbiguity"/>
+ </columns>
+ <properties>
+ <property name="dimtble.countrytable_partitioned.dim.name" value="countrydim"/>
+ <property name="dimtble.countrytable_partitioned.storages" value="C3"/>
+ <property name="dimtble.countrytable_partitioned.c3.dumpperiod" value="HOURLY"/>
+ <property name="cube.table.countrytable_partitioned.weight" value="0.0"/>
+ <property name="dimension.countrydim.timed.dimension" value="dt"/>
+ <property name="dimtable.countrytable_partitioned.part.cols" value="region"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="region" _type="string" comment="region name"/>
+ </part_cols>
+ <table_parameters/>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml b/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
new file mode 100644
index 0000000..902696a
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="cycleDim1" table_name="cycledim1tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="cyledim2id" _type="string" comment="link to cyclic dim 2"/>
+ </columns>
+ <properties>
+ <property name="dimension.cycledim1.timed.dimension" value="dt"/>
+ <property name="dimtble.cycledim1tbl.c1.dumpperiod" value="HOURLY"/>
+ <property name="cube.table.cycledim1tbl.weight" value="0.0"/>
+ <property name="dimtble.cycledim1tbl.storages" value="C1,C2"/>
+ <property name="dimtble.cycledim1tbl.dim.name" value="cycleDim1"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml b/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
new file mode 100644
index 0000000..63a0975
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="cycleDim2" table_name="cycledim2tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="cyledim1id" _type="string" comment="link to cyclic dim 1"/>
+ </columns>
+ <properties>
+ <property name="dimtble.cycledim2tbl.storages" value="C1,C2"/>
+ <property name="dimtble.cycledim2tbl.dim.name" value="cycleDim2"/>
+ <property name="dimtble.cycledim2tbl.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimension.cycledim2.timed.dimension" value="dt"/>
+ <property name="cube.table.cycledim2tbl.weight" value="0.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml b/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
new file mode 100644
index 0000000..c1e16bf
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="dayDim" table_name="daydimtbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="full_date" _type="string" comment="field1"/>
+ </columns>
+ <properties>
+ <property name="dimtble.daydimtbl.dim.name" value="dayDim"/>
+ <property name="dimension.daydim.timed.dimension" value="dt"/>
+ <property name="cube.table.daydimtbl.weight" value="0.0"/>
+ <property name="dimtble.daydimtbl.c3.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.daydimtbl.storages" value="C3,C4"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml b/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
new file mode 100644
index 0000000..c759704
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="hourDim" table_name="hourdimtbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="full_hour" _type="string" comment="field1"/>
+ </columns>
+ <properties>
+ <property name="cube.table.hourdimtbl.weight" value="0.0"/>
+ <property name="dimtble.hourdimtbl.c3.dumpperiod" value="HOURLY"/>
+ <property name="dimension.hourdim.timed.dimension" value="dt"/>
+ <property name="dimtble.hourdimtbl.dim.name" value="hourDim"/>
+ <property name="dimtble.hourdimtbl.storages" value="C3,C4"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml b/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
new file mode 100644
index 0000000..44420ac
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="sports" table_name="sports_tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="id"/>
+ <column name="name" _type="string" comment="name"/>
+ </columns>
+ <properties>
+ <property name="dimtble.sports_tbl.storages" value="C1,C2"/>
+ <property name="dimtble.sports_tbl.dim.name" value="sports"/>
+ <property name="cube.table.sports_tbl.weight" value="0.0"/>
+ <property name="dimtble.sports_tbl.c2.dumpperiod" value="HOURLY"/>
+ <property name="dimension.sports.timed.dimension" value="dt"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/statetable.xml b/lens-cube/src/test/resources/schema/dimtables/statetable.xml
new file mode 100644
index 0000000..2aab131
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/statetable.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="statedim" table_name="statetable" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="capital" _type="string" comment="field2"/>
+ <column name="countryid" _type="string" comment="region name"/>
+ </columns>
+ <properties>
+ <property name="dimension.statedim.timed.dimension" value="dt"/>
+ <property name="cube.table.statetable.weight" value="0.0"/>
+ <property name="dimtble.statetable.storages" value="C1"/>
+ <property name="dimtble.statetable.dim.name" value="statedim"/>
+ <property name="dimtble.statetable.c1.dumpperiod" value="HOURLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml b/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
new file mode 100644
index 0000000..e7c808f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="statedim" table_name="statetable_partitioned" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="capital" _type="string" comment="field2"/>
+ </columns>
+ <properties>
+ <property name="dimtble.statetable_partitioned.c3.dumpperiod" value="HOURLY"/>
+ <property name="dimension.statedim.timed.dimension" value="dt"/>
+ <property name="dimtble.statetable_partitioned.dim.name" value="statedim"/>
+ <property name="dimtble.statetable_partitioned.storages" value="C3"/>
+ <property name="cube.table.statetable_partitioned.weight" value="0.0"/>
+ <property name="dimtable.statetable_partitioned.part.cols" value="countryid"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ <column name="countryid" _type="string" comment="region name"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
new file mode 100644
index 0000000..b320ec2
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="testDim2" table_name="testdim2tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="cityid" _type="string" comment="f-key to cityDim"/>
+ <column name="testdim3id" _type="string" comment="f-key to testdim3"/>
+ </columns>
+ <properties>
+ <property name="cube.table.testdim2tbl.weight" value="0.0"/>
+ <property name="dimtble.testdim2tbl.dim.name" value="testDim2"/>
+ <property name="dimtble.testdim2tbl.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.testdim2tbl.storages" value="C1,C2"/>
+ <property name="dimension.testdim2.timed.dimension" value="dt"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
new file mode 100644
index 0000000..2239997
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="testDim2" table_name="testdim2tbl2" weight="10.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="bigid1" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="cityid" _type="string" comment="f-key to cityDim"/>
+ </columns>
+ <properties>
+ <property name="dimtble.testdim2tbl2.dim.name" value="testDim2"/>
+ <property name="dimtble.testdim2tbl2.storages" value="C3,C1,C2"/>
+ <property name="cube.table.testdim2tbl2.weight" value="10.0"/>
+ <property name="dimension.testdim2.timed.dimension" value="dt"/>
+ <property name="dimtble.testdim2tbl2.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.testdim2tbl2.c3.dumpperiod" value="HOURLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
new file mode 100644
index 0000000..62059ad
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="testDim2" table_name="testdim2tbl3" weight="20.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="bigid1" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="testdim3id" _type="string" comment="f-key to testdim3"/>
+ </columns>
+ <properties>
+ <property name="dimtble.testdim2tbl3.c3.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.testdim2tbl3.c1.dumpperiod" value="HOURLY"/>
+ <property name="cube.table.testdim2tbl3.weight" value="20.0"/>
+ <property name="dimension.testdim2.timed.dimension" value="dt"/>
+ <property name="dimtble.testdim2tbl3.storages" value="C3,C1,C2"/>
+ <property name="dimtble.testdim2tbl3.dim.name" value="testDim2"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
new file mode 100644
index 0000000..7d2af60
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="testDim3" table_name="testdim3tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ <column name="testdim4id" _type="string" comment="f-key to testDim4"/>
+ </columns>
+ <properties>
+ <property name="cube.table.testdim3tbl.weight" value="0.0"/>
+ <property name="dimtble.testdim3tbl.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimension.testdim3.timed.dimension" value="dt"/>
+ <property name="dimtble.testdim3tbl.storages" value="C1,C2"/>
+ <property name="dimtble.testdim3tbl.dim.name" value="testDim3"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
new file mode 100644
index 0000000..2044851
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="testDim4" table_name="testdim4tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ </columns>
+ <properties>
+ <property name="dimtble.testdim4tbl.storages" value="C1,C2"/>
+ <property name="dimtble.testdim4tbl.c1.dumpperiod" value="HOURLY"/>
+ <property name="dimtble.testdim4tbl.dim.name" value="testDim4"/>
+ <property name="cube.table.testdim4tbl.weight" value="0.0"/>
+ <property name="dimension.testdim4.timed.dimension" value="dt"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml b/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
new file mode 100644
index 0000000..6f80c27
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="unreachableDim" table_name="unreachabledimtable" weight="0.0"
+ xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="code"/>
+ <column name="name" _type="string" comment="field1"/>
+ </columns>
+ <properties>
+ <property name="dimension.unreachabledim.timed.dimension" value="dt"/>
+ <property name="cube.table.unreachabledimtable.weight" value="0.0"/>
+ <property name="dimtble.unreachabledimtable.dim.name" value="unreachableDim"/>
+ <property name="dimtble.unreachabledimtable.storages" value="C1"/>
+ <property name="dimtble.unreachabledimtable.c1.dumpperiod" value="HOURLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml b/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
new file mode 100644
index 0000000..e0fa4e3
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="user_interests" table_name="user_interests_tbl" weight="0.0"
+ xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="id"/>
+ <column name="user_id" _type="int" comment="user id"/>
+ <column name="sport_id" _type="int" comment="sport id"/>
+ </columns>
+ <properties>
+ <property name="dimtble.user_interests_tbl.storages" value="C1,C2"/>
+ <property name="dimtble.user_interests_tbl.c2.dumpperiod" value="HOURLY"/>
+ <property name="dimension.user_interests.timed.dimension" value="dt"/>
+ <property name="dimtble.user_interests_tbl.dim.name" value="user_interests"/>
+ <property name="cube.table.user_interests_tbl.weight" value="0.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/usertable.xml b/lens-cube/src/test/resources/schema/dimtables/usertable.xml
new file mode 100644
index 0000000..055a958
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/usertable.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="userdim" table_name="usertable" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="id" _type="int" comment="id"/>
+ <column name="name" _type="string" comment="name"/>
+ <column name="age" _type="string" comment="age"/>
+ <column name="gender" _type="string" comment="gender"/>
+ <column name="user_id_added_in_past" _type="int" comment="user_id_added_in_past"/>
+ <column name="user_id_added_far_future" _type="int" comment="user_id_added_far_future"/>
+ </columns>
+ <properties>
+ <property name="dimtble.usertable.dim.name" value="userdim"/>
+ <property name="dimension.userdim.timed.dimension" value="dt"/>
+ <property name="dimtble.usertable.storages" value="C1,C2"/>
+ <property name="cube.table.usertable.weight" value="0.0"/>
+ <property name="dimtble.usertable.c2.dumpperiod" value="HOURLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods/>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/dimtables/ziptable.xml b/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
new file mode 100644
index 0000000..094031e
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_dimension_table dimension_name="zipdim" table_name="ziptable" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="code" _type="int" comment="code"/>
+ <column name="f1" _type="string" comment="field1"/>
+ <column name="f2" _type="string" comment="field2"/>
+ </columns>
+ <properties>
+ <property name="dimtble.ziptable.c1.dumpperiod" value="HOURLY"/>
+ <property name="cube.table.ziptable.weight" value="0.0"/>
+ <property name="dimtble.ziptable.dim.name" value="zipdim"/>
+ <property name="dimtble.ziptable.storages" value="C1"/>
+ <property name="dimension.zipdim.timed.dimension" value="dt"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/cheapfact.xml b/lens-cube/src/test/resources/schema/facts/cheapfact.xml
new file mode 100644
index 0000000..8a8d371
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/cheapfact.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="cheapfact" cube_name="testCube" weight="0.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="stateid" _type="int" comment="city id"/>
+ <column name="test_time_dim_hour_id" _type="int" comment="time id"/>
+ <column name="ambigdim1" _type="string" comment="used in testColumnAmbiguity"/>
+ </columns>
+ <properties>
+ <property name="cube.table.cheapfact.weight" value="0.0"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.cheapfact.cubename" value="testCube"/>
+ <property name="cube.fact.cheapfact.c99.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.cheapfact.storages" value="C99,C0"/>
+ <property name="cube.fact.cheapfact.c0.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C99</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C0</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.end.times" value="now - 5 years, 2010"/>
+ <property name="cube.storagetable.start.times" value="2000, now - 10 years"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/summary1.xml b/lens-cube/src/test/resources/schema/facts/summary1.xml
new file mode 100644
index 0000000..199b991
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/summary1.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="summary1" cube_name="testCube" weight="10.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="string" comment="dim2"/>
+ <column name="testdim3id" _type="string" comment="dim2"/>
+ <column name="dim2big" _type="string" comment="dim2"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.summary1.cubename" value="testCube"/>
+ <property name="cube.table.summary1.weight" value="10.0"/>
+ <property name="cube.fact.summary1.c2.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.summary1.storages" value="C1,C2"/>
+ <property name="cube.fact.summary1.c1.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.summary1.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,testdim3id"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="transient_lastDdlTime" value="1488970819"/>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="pt" _type="string" comment="p time"/>
+ <column name="it" _type="string" comment="i time"/>
+ <column name="et" _type="string" comment="e time"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="pt,it,et"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>pt</time_part_cols>
+ <time_part_cols>it</time_part_cols>
+ <time_part_cols>et</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/summary2.xml b/lens-cube/src/test/resources/schema/facts/summary2.xml
new file mode 100644
index 0000000..c30ed75
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/summary2.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="summary2" cube_name="testCube" weight="20.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="string" comment="dim2"/>
+ <column name="testdim3id" _type="string" comment="dim2"/>
+ <column name="dim2big" _type="string" comment="dim2"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.summary2.cubename" value="testCube"/>
+ <property name="transient_lastDdlTime" value="1488970827"/>
+ <property name="cube.fact.summary2.c2.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.summary2.storages" value="C1,C2"/>
+ <property name="cube.table.summary2.weight" value="20.0"/>
+ <property name="cube.fact.summary2.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2"/>
+ <property name="cube.fact.summary2.c1.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.summary1.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,testdim3id"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="pt" _type="string" comment="p time"/>
+ <column name="it" _type="string" comment="i time"/>
+ <column name="et" _type="string" comment="e time"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="pt,it,et"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>pt</time_part_cols>
+ <time_part_cols>it</time_part_cols>
+ <time_part_cols>et</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/summary3.xml b/lens-cube/src/test/resources/schema/facts/summary3.xml
new file mode 100644
index 0000000..4f1803f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/summary3.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="summary3" cube_name="testCube" weight="30.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="string" comment="dim2"/>
+ <column name="testdim3id" _type="string" comment="dim2"/>
+ <column name="dim2big" _type="string" comment="dim2"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.summary3.c1.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.summary3.storages" value="C1,C2"/>
+ <property name="cube.fact.summary3.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2,cityid,stateid"/>
+ <property name="cube.fact.summary2.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2"/>
+ <property name="cube.table.summary3.weight" value="30.0"/>
+ <property name="cube.fact.summary3.cubename" value="testCube"/>
+ <property name="cube.fact.summary3.c2.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.summary1.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,testdim3id"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="pt" _type="string" comment="p time"/>
+ <column name="it" _type="string" comment="i time"/>
+ <column name="et" _type="string" comment="e time"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="pt,it,et"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>pt</time_part_cols>
+ <time_part_cols>it</time_part_cols>
+ <time_part_cols>et</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/summary4.xml b/lens-cube/src/test/resources/schema/facts/summary4.xml
new file mode 100644
index 0000000..b1be93c
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/summary4.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="summary4" cube_name="testCube" weight="15.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="string" comment="dim2"/>
+ <column name="testdim3id" _type="string" comment="dim2"/>
+ <column name="dim2big" _type="string" comment="dim2"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.table.summary4.weight" value="15.0"/>
+ <property name="cube.fact.summary4.storages" value="C2"/>
+ <property name="cube.fact.summary4.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2big1,dim2big2,cityid"/>
+ <property name="cube.fact.summary3.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2,cityid,stateid"/>
+ <property name="cube.fact.summary4.cubename" value="testCube"/>
+ <property name="cube.fact.summary2.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,dim2"/>
+ <property name="cube.fact.summary1.valid.columns"
+ value="msr21,msr4,msr15,union_join_ctx_msr3,newmeasure,union_join_ctx_msr2,msr2,msr3,msr22,msr9,msr1,noAggrMsr,union_join_ctx_msr1,,dim1,testdim3id"/>
+ <property name="cube.fact.summary4.c2.updateperiods" value="HOURLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="pt" _type="string" comment="p time"/>
+ <column name="it" _type="string" comment="i time"/>
+ <column name="et" _type="string" comment="e time"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="pt,it,et"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>pt</time_part_cols>
+ <time_part_cols>it</time_part_cols>
+ <time_part_cols>et</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact.xml b/lens-cube/src/test/resources/schema/facts/testfact.xml
new file mode 100644
index 0000000..a4c2c78
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact" cube_name="testCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="msr5" _type="double" comment="msr5"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="cityid1" _type="int" comment="city id"/>
+ <column name="stateid" _type="int" comment="city id"/>
+ <column name="test_time_dim_day_id" _type="int" comment="time id"/>
+ <column name="test_time_dim_day_id2" _type="int" comment="time id"/>
+ <column name="ambigdim1" _type="string" comment="used in testColumnAmbiguity"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.testfact.c5.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact.cubename" value="testCube"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact.c4.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.table.testfact.weight" value="5.0"/>
+ <property name="cube.fact.testfact.c3.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact.c2.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact.storages" value="C3,C4,C5,C0,C1,C2"/>
+ <property name="cube.fact.testfact.c0.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact.c1.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,CONTINUOUS,QUARTERLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.end.times" value="now.day - 10 days"/>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ <property name="cube.storagetable.start.times" value="now.day - 90 days"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C5</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ <property name="cube.storagetable.start.times" value="now.day - 10 days"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C0</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact1_base.xml b/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
new file mode 100644
index 0000000..0f25784
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact1_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="stateid" _type="int" comment="state id"/>
+ <column name="userid" _type="int" comment="user id"/>
+ <column name="xuserid" _type="int" comment="user id"/>
+ <column name="yuserid" _type="int" comment="user id"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="test_time_dim_hour_id" _type="int" comment="time id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact1_base.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.fact.testfact1_base.c3.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact1_base.c2.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact1_base.c1.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.table.testfact1_base.weight" value="5.0"/>
+ <property name="cube.fact.testfact1_base.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact1_base.c4.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
new file mode 100644
index 0000000..d755b02
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact1_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="cityid1" _type="int" comment="city id"/>
+ <column name="cityid2" _type="int" comment="city id"/>
+ <column name="stateid" _type="int" comment="state id"/>
+ <column name="countryid" _type="int" comment="country id"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="int" comment="dim2"/>
+ <column name="concatedcitystate" _type="string" comment="citystate"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.datacompleteness.tag" value="f1"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.table.testfact1_raw_base.weight" value="100.0"/>
+ <property name="cube.fact.testfact1_raw_base.storages" value="C3,C1"/>
+ <property name="cube.fact.testfact1_raw_base.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.testfact1_raw_base.c3.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.testfact1_raw_base.cubename" value="baseCube"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2.xml b/lens-cube/src/test/resources/schema/facts/testfact2.xml
new file mode 100644
index 0000000..d6006c6
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact2.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact2" cube_name="testCube" weight="10.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="cityid2" _type="int" comment="city id"/>
+ <column name="test_time_dim_hour_id" _type="int" comment="time id"/>
+ <column name="test_time_dim_hour_id2" _type="int" comment="time id"/>
+ <column name="cdim2" _type="int" comment="cycledim id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact2.storages" value="C4,C1"/>
+ <property name="cube.fact.testfact2.c4.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.testfact2.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.testfact2.cubename" value="testCube"/>
+ <property name="cube.table.testfact2.weight" value="10.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.partition.timeline.cache.HOURLY.ttd2.storage.class"
+ value="org.apache.lens.cube.metadata.timeline.StoreAllPartitionTimeline"/>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ <property name="cube.storagetable.partition.timeline.cache.HOURLY.ttd.storage.class"
+ value="org.apache.lens.cube.metadata.timeline.StoreAllPartitionTimeline"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_base.xml b/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
new file mode 100644
index 0000000..b3c8076
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact2_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr12" _type="float" comment="second measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="dim2" _type="int" comment="dim2 id"/>
+ <column name="userid" _type="int" comment="user id"/>
+ <column name="xuserid" _type="int" comment="user id"/>
+ <column name="yuserid" _type="int" comment="user id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact2_base.c2.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact2_base.c3.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact2_base.c1.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact2_base.c4.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact2_base.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact2_base.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.table.testfact2_base.weight" value="5.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml b/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
new file mode 100644
index 0000000..5431975
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact2_raw" cube_name="testCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="zipcode" _type="int" comment="zip"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ <column name="cityid1" _type="int" comment="city id"/>
+ <column name="cityid2" _type="int" comment="city id"/>
+ <column name="stateid" _type="int" comment="state id"/>
+ <column name="countryid" _type="int" comment="country id"/>
+ <column name="dim1" _type="string" comment="dim1"/>
+ <column name="dim2" _type="int" comment="dim2"/>
+ <column name="concatedcitystate" _type="string" comment="citystate"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.testfact2_raw.storages" value="C3,C1"/>
+ <property name="cube.fact.datacompleteness.tag" value="f1"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact2_raw.c3.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.testfact2_raw.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.table.testfact2_raw.weight" value="100.0"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.testfact2_raw.cubename" value="testCube"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
new file mode 100644
index 0000000..ad126ff
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact2_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr11" _type="int" comment="first measure"/>
+ <column name="msr12" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="dim13" _type="string" comment="base dim"/>
+ <column name="dim12" _type="string" comment="base dim"/>
+ <column name="dim22" _type="string" comment="base dim"/>
+ <column name="cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.datacompleteness.tag" value="f2"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact2_raw_base.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.table.testfact2_raw_base.weight" value="100.0"/>
+ <property name="transient_lastDdlTime" value="1488970748"/>
+ <property name="cube.fact.testfact2_raw_base.cubename" value="baseCube"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.testfact2_raw_base.storages" value="C1"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact3_base.xml b/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
new file mode 100644
index 0000000..c9c36c4
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact3_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr13" _type="double" comment="third measure"/>
+ <column name="msr14" _type="bigint" comment="fourth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ </columns>
+ <properties>
+ <property name="cube.table.testfact3_base.weight" value="5.0"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact3_base.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact3_base.c2.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact3_base.c3.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact3_base.c4.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact3_base.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.fact.testfact3_base.c1.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
new file mode 100644
index 0000000..d209f54
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact3_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr13" _type="double" comment="third measure"/>
+ <column name="msr14" _type="bigint" comment="fourth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="dim12" _type="string" comment="base dim"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.datacompleteness.tag" value="f2"/>
+ <property name="cube.fact.col.end.time.user_id_deprecated" value="2016-01-01"/>
+ <property name="cube.fact.testfact3_raw_base.storages" value="C1"/>
+ <property name="cube.table.testfact3_raw_base.weight" value="100.0"/>
+ <property name="cube.fact.col.start.time.user_id_added_far_future" value="2099-01-01"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact3_raw_base.cubename" value="baseCube"/>
+ <property name="cube.fact.col.start.time.user_id_added_in_past" value="2016-01-01"/>
+ <property name="cube.fact.testfact3_raw_base.c1.updateperiods" value="HOURLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
new file mode 100644
index 0000000..39c4b4f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact4_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr13" _type="double" comment="third measure"/>
+ <column name="msr14" _type="bigint" comment="fourth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="user_id_added_in_past" _type="int" comment="user id"/>
+ <column name="user_id_added_far_future" _type="int" comment="user id"/>
+ <column name="user_id_deprecated" _type="int" comment="user id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.datacompleteness.tag" value="f2"/>
+ <property name="cube.fact.testfact4_raw_base.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.col.end.time.user_id_deprecated" value="2016-01-01"/>
+ <property name="cube.fact.col.start.time.user_id_added_far_future" value="2099-01-01"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.col.start.time.user_id_added_in_past" value="2016-01-01"/>
+ <property name="cube.fact.testfact4_raw_base.storages" value="C1"/>
+ <property name="cube.fact.testfact4_raw_base.cubename" value="baseCube"/>
+ <property name="cube.table.testfact4_raw_base.weight" value="100.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact5_base.xml b/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
new file mode 100644
index 0000000..8febae4
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact5_base" cube_name="baseCube" weight="150.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="booleancut" _type="boolean" comment="expr dim"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact5_base.c3.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact5_base.c1.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact5_base.c4.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact5_base.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.table.testfact5_base.weight" value="150.0"/>
+ <property name="cube.fact.testfact5_base.c2.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact5_base.cubename" value="baseCube"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
new file mode 100644
index 0000000..72f6138
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact5_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.datacompleteness.tag" value="f2"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact5_raw_base.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact5_raw_base.c1.updateperiods" value="HOURLY"/>
+ <property name="cube.fact.testfact5_raw_base.storages" value="C1"/>
+ <property name="cube.table.testfact5_raw_base.weight" value="100.0"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact6_base.xml b/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
new file mode 100644
index 0000000..42715e9
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact6_base" cube_name="baseCube" weight="150.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr13" _type="double" comment="third measure"/>
+ <column name="msr14" _type="bigint" comment="fourth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="booleancut" _type="boolean" comment="expr dim"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.testfact6_base.c3.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfact6_base.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact6_base.c1.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact6_base.c4.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact6_base.c2.updateperiods" value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact6_base.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.table.testfact6_base.weight" value="150.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml b/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
new file mode 100644
index 0000000..94fb68a
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact_continuous" cube_name="testCube" weight="100.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr11" _type="double" comment="third measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="dim12" _type="string" comment="base dim"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.table.testfact_continuous.weight" value="100.0"/>
+ <property name="cube.fact.testfact_continuous.storages" value="C0"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day-3days}"/>
+ <property name="cube.fact.testfact_continuous.c0.updateperiods" value="CONTINUOUS"/>
+ <property name="cube.fact.testfact_continuous.cubename" value="testCube"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>CONTINUOUS</update_period>
+ </update_periods>
+ <storage_name>C0</storage_name>
+ <table_desc external="false">
+ <part_cols/>
+ <table_parameters>
+ <property name="totalSize" value="0"/>
+ <property name="numFiles" value="0"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml b/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
new file mode 100644
index 0000000..f14395e
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfact_deprecated" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr12" _type="float" comment="second measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="processing_time" _type="timestamp" comment="processing time"/>
+ <column name="dim1" _type="string" comment="base dim"/>
+ <column name="dim11" _type="string" comment="base dim"/>
+ <column name="dim2" _type="int" comment="dim2 id"/>
+ <column name="userid" _type="int" comment="user id"/>
+ <column name="xuserid" _type="int" comment="user id"/>
+ <column name="yuserid" _type="int" comment="user id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.testfact_deprecated.c2.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.testfact_deprecated.cubename" value="baseCube"/>
+ <property name="cube.fact.testfact_deprecated.c3.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day-3days}"/>
+ <property name="cube.fact.testfact_deprecated.c4.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day-2days}"/>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.table.testfact_deprecated.weight" value="5.0"/>
+ <property name="cube.fact.testfact_deprecated.storages" value="C3,C4,C1,C2"/>
+ <property name="cube.fact.testfact_deprecated.c1.updateperiods"
+ value="MONTHLY,HOURLY,YEARLY,QUARTERLY,MINUTELY,DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C3</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C4</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="ttd" _type="string" comment="test date partition"/>
+ <column name="ttd2" _type="string" comment="test date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="ttd,ttd2"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>ttd</time_part_cols>
+ <time_part_cols>ttd2</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>MINUTELY</update_period>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ <update_period>QUARTERLY</update_period>
+ <update_period>YEARLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml b/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
new file mode 100644
index 0000000..8237ba0
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="testfactmonthly" cube_name="testCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="msr21" _type="float" comment="second measure"/>
+ <column name="msr4" _type="bigint" comment="fourth measure"/>
+ <column name="msr15" _type="int" comment="fifteenth measure"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="union_join_ctx_third measure"/>
+ <column name="newmeasure" _type="bigint" comment="measure available from now"/>
+ <column name="union_join_ctx_msr2" _type="int" comment="union_join_ctx_second measure"/>
+ <column name="msr2" _type="float" comment="second measure"/>
+ <column name="msr3" _type="double" comment="third measure"/>
+ <column name="msr22" _type="float" comment="second measure"/>
+ <column name="msr9" _type="bigint" comment="ninth measure"/>
+ <column name="msr1" _type="int" comment="first measure"/>
+ <column name="noaggrmsr" _type="bigint" comment="measure without a default aggregate"/>
+ <column name="union_join_ctx_msr1" _type="int" comment="union_join_ctx_first measure"/>
+ <column name="countryid" _type="int" comment="country id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.testfactmonthly.storages" value="C2"/>
+ <property name="cube.fact.testfactmonthly.cubename" value="testCube"/>
+ <property name="cube.table.testfactmonthly.weight" value="5.0"/>
+ <property name="cube.fact.testfactmonthly.c2.updateperiods" value="MONTHLY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>MONTHLY</update_period>
+ </update_periods>
+ <storage_name>C2</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
new file mode 100644
index 0000000..d07393d
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="union_join_ctx_fact1" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="union_join_ctx_msr1" _type="int" comment="first measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="union_join_ctx_zipcode" _type="int" comment="zip"/>
+ <column name="union_join_ctx_cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.relative.start.time" value="now.year - 90 days"/>
+ <property name="cube.fact.union_join_ctx_fact1.cubename" value="baseCube"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day - 90 days}"/>
+ <property name="cube.fact.union_join_ctx_fact1.storages" value="C1"/>
+ <property name="cube.table.union_join_ctx_fact1.weight" value="5.0"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day - 30 days}"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.union_join_ctx_fact1.c1.updateperiods" value="DAILY"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
new file mode 100644
index 0000000..9145dcc
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="union_join_ctx_fact2" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="union_join_ctx_msr1" _type="int" comment="first measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="union_join_ctx_zipcode" _type="int" comment="zip"/>
+ <column name="union_join_ctx_cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.union_join_ctx_fact2.storages" value="C1"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day - 31 days}"/>
+ <property name="cube.fact.union_join_ctx_fact2.cubename" value="baseCube"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day + 7 days}"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.union_join_ctx_fact2.c1.updateperiods" value="DAILY"/>
+ <property name="cube.table.union_join_ctx_fact2.weight" value="5.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
new file mode 100644
index 0000000..db091b7
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="union_join_ctx_fact3" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="union_join_ctx_msr2" _type="int" comment="second measure"/>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="union_join_ctx_zipcode" _type="int" comment="zip"/>
+ <column name="union_join_ctx_cityid" _type="int" comment="city id"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.union_join_ctx_fact3.cubename" value="baseCube"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day - 90 days}"/>
+ <property name="cube.fact.union_join_ctx_fact3.c1.updateperiods" value="DAILY"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day + 7 days}"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.fact.union_join_ctx_fact3.storages" value="C1"/>
+ <property name="cube.table.union_join_ctx_fact3.weight" value="5.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
new file mode 100644
index 0000000..e1fbad6
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="union_join_ctx_fact5" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="union_join_ctx_zipcode" _type="int" comment="zip"/>
+ <column name="union_join_ctx_cityid" _type="int" comment="city id"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="third measure"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.union_join_ctx_fact5.c1.updateperiods" value="DAILY"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day - 90 days}"/>
+ <property name="cube.fact.union_join_ctx_fact5.cubename" value="baseCube"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day -30 days}"/>
+ <property name="cube.fact.union_join_ctx_fact5.storages" value="C1"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.table.union_join_ctx_fact5.weight" value="5.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
new file mode 100644
index 0000000..0af6a13
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_fact_table name="union_join_ctx_fact6" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
+ <columns>
+ <column name="d_time" _type="timestamp" comment="event time"/>
+ <column name="union_join_ctx_zipcode" _type="int" comment="zip"/>
+ <column name="union_join_ctx_cityid" _type="int" comment="city id"/>
+ <column name="union_join_ctx_msr3" _type="int" comment="third measure"/>
+ </columns>
+ <properties>
+ <property name="cube.fact.union_join_ctx_fact6.c1.updateperiods" value="DAILY"/>
+ <property name="cube.fact.union_join_ctx_fact6.cubename" value="baseCube"/>
+ <property name="cube.fact.absolute.start.time" value="$absolute{now.day -31 days}"/>
+ <property name="cube.fact.union_join_ctx_fact6.storages" value="C1"/>
+ <property name="cube.fact.absolute.end.time" value="$absolute{now.day + 7 days}"/>
+ <property name="cube.fact.is.aggregated" value="false"/>
+ <property name="cube.table.union_join_ctx_fact6.weight" value="5.0"/>
+ </properties>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
+ <storage_name>C1</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/segmentations/seg1.xml b/lens-cube/src/test/resources/schema/segmentations/seg1.xml
new file mode 100644
index 0000000..7ed48a1
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/segmentations/seg1.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<x_segmentation cube_name="testcube" name="seg1" weight="100.0" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+ <properties>
+ <property name="seg1.prop" value="s1"/>
+ <property name="cube.segmentation.relative.start.time" value="now -10days"/>
+ </properties>
+ <segements>
+ <segment cube_name="cube11">
+ <segment_parameters>
+ <property name="lens.metastore.cube.column.mapping" value="foo=bar"/>
+ </segment_parameters>
+ </segment>
+ <segment cube_name="cube22">
+ <segment_parameters>
+ <property name="lens.metastore.cube.column.mapping" value="foo1=bar1"/>
+ </segment_parameters>
+ </segment>
+ <segment cube_name="cube33">
+ <segment_parameters>
+ <property name="lens.metastore.cube.column.mapping" value="foo2=bar2"/>
+ </segment_parameters>
+ </segment>
+ </segements>
+</x_segmentation>
diff --git a/lens-cube/src/test/resources/schema/storages/c0.xml b/lens-cube/src/test/resources/schema/storages/c0.xml
new file mode 100644
index 0000000..de432a1
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c0.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c0" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c0.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c1.xml b/lens-cube/src/test/resources/schema/storages/c1.xml
new file mode 100644
index 0000000..a0f0886
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c1.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c1" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c1.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c2.xml b/lens-cube/src/test/resources/schema/storages/c2.xml
new file mode 100644
index 0000000..eb670af
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c2.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c2" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c2.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c3.xml b/lens-cube/src/test/resources/schema/storages/c3.xml
new file mode 100644
index 0000000..4b78cdb
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c3.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c3" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c3.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c4.xml b/lens-cube/src/test/resources/schema/storages/c4.xml
new file mode 100644
index 0000000..9ed2d52
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c4.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c4" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c4.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c5.xml b/lens-cube/src/test/resources/schema/storages/c5.xml
new file mode 100644
index 0000000..8ebdf3c
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c5.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c5" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c5.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-cube/src/test/resources/schema/storages/c99.xml b/lens-cube/src/test/resources/schema/storages/c99.xml
new file mode 100644
index 0000000..d87db78
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/storages/c99.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<x_storage name="c99" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
+ <properties>
+ <property name="cube.table.c99.weight" value="0.0"/>
+ </properties>
+</x_storage>
\ No newline at end of file
diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
index 24660e1..abaae5b 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/metastore/CubeMetastoreServiceImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.lens.server.metastore;
-import static org.apache.lens.server.metastore.JAXBUtils.*;
+import static org.apache.lens.cube.metadata.JAXBUtils.*;
import java.util.*;
import java.util.Date;
@@ -168,10 +168,7 @@
@Override
public void createCube(LensSessionHandle sessionid, XCube cube) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- CubeMetastoreClient msClient = getClient(sessionid);
- Cube parent = cube instanceof XDerivedCube ? (Cube) msClient.getCube(
- ((XDerivedCube) cube).getParent()) : null;
- msClient.createCube(JAXBUtils.hiveCubeFromXCube(cube, parent));
+ getClient(sessionid).createCube(cube);
log.info("Created cube " + cube.getName());
}
}
@@ -200,7 +197,7 @@
* @param cubeName cube name
*/
public void dropCube(LensSessionHandle sessionid, String cubeName) throws LensException {
- try(SessionContext ignored = new SessionContext(sessionid)) {
+ try (SessionContext ignored = new SessionContext(sessionid)) {
getClient(sessionid).dropCube(cubeName);
}
}
@@ -214,10 +211,7 @@
@Override
public void updateCube(LensSessionHandle sessionid, XCube cube) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- CubeMetastoreClient msClient = getClient(sessionid);
- Cube parent = cube instanceof XDerivedCube ? (Cube) msClient.getCube(
- ((XDerivedCube) cube).getParent()) : null;
- msClient.alterCube(cube.getName(), JAXBUtils.hiveCubeFromXCube(cube, parent));
+ getClient(sessionid).alterCube(cube);
log.info("Cube updated " + cube.getName());
} catch (HiveException e) {
throw new LensException(e);
@@ -233,23 +227,9 @@
@Override
public void createDimensionTable(LensSessionHandle sessionid, XDimensionTable xDimTable) throws LensException {
String dimTblName = xDimTable.getTableName();
- List<FieldSchema> columns = JAXBUtils.fieldSchemaListFromColumns(xDimTable.getColumns());
- Map<String, UpdatePeriod> updatePeriodMap =
- JAXBUtils.dumpPeriodsFromStorageTables(xDimTable.getStorageTables());
-
- Map<String, String> properties = JAXBUtils.mapFromXProperties(xDimTable.getProperties());
- Map<String, StorageTableDesc> storageDesc = JAXBUtils.tableDescPrefixMapFromXStorageTables(
- xDimTable.getStorageTables());
try (SessionContext ignored = new SessionContext(sessionid)){
- log.info("# Columns: " + columns);
- getClient(sessionid).createCubeDimensionTable(xDimTable.getDimensionName(),
- dimTblName,
- columns,
- xDimTable.getWeight(),
- updatePeriodMap,
- properties,
- storageDesc);
+ getClient(sessionid).createCubeDimensionTable(xDimTable);
log.info("Dimension Table created " + xDimTable.getTableName());
}
}
@@ -265,31 +245,14 @@
@Override
public XDimensionTable getDimensionTable(LensSessionHandle sessionid, String dimTblName) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- CubeMetastoreClient msClient = getClient(sessionid);
- CubeDimensionTable dimTable = msClient.getDimensionTable(dimTblName);
- XDimensionTable dt = JAXBUtils.dimTableFromCubeDimTable(dimTable);
- if (dimTable.getStorages() != null && !dimTable.getStorages().isEmpty()) {
- for (String storageName : dimTable.getStorages()) {
- XStorageTableElement tblElement = JAXBUtils.getXStorageTableFromHiveTable(
- msClient.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(dimTblName, storageName)));
- tblElement.setStorageName(storageName);
- UpdatePeriod p = dimTable.getSnapshotDumpPeriods().get(storageName);
- if (p != null) {
- tblElement.getUpdatePeriods().getUpdatePeriod().add(XUpdatePeriod.valueOf(p.name()));
- }
- dt.getStorageTables().getStorageTable().add(tblElement);
- }
- }
- return dt;
+ return getClient(sessionid).getXDimensionTable(dimTblName);
}
}
@Override
public void updateDimensionTable(LensSessionHandle sessionid, XDimensionTable dimensionTable) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).alterCubeDimensionTable(dimensionTable.getTableName(),
- JAXBUtils.cubeDimTableFromDimTable(dimensionTable),
- JAXBUtils.tableDescPrefixMapFromXStorageTables(dimensionTable.getStorageTables()));
+ getClient(sessionid).alterCubeDimensionTable(dimensionTable);
log.info("Updated dimension table " + dimensionTable.getTableName());
} catch (HiveException exc) {
throw new LensException(exc);
@@ -395,43 +358,7 @@
@Override
public XFactTable getFactTable(LensSessionHandle sessionid, String fact) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- CubeMetastoreClient msClient = getClient(sessionid);
- CubeFactTable cft = msClient.getFactTable(fact);
- XFactTable factTable = JAXBUtils.factTableFromCubeFactTable(cft);
- Map<String, Map<UpdatePeriod, String>> storageMap = cft.getStoragePrefixUpdatePeriodMap();
- for (String storageName : cft.getStorages()) {
- Set<UpdatePeriod> updatePeriods = cft.getUpdatePeriods().get(storageName);
- // This map tells if there are different tables for different update period.
- Map<UpdatePeriod, String> updatePeriodToTableMap = storageMap.get(storageName);
- Set<String> tableNames = new HashSet<>();
- for (UpdatePeriod updatePeriod : updatePeriods) {
- tableNames.add(updatePeriodToTableMap.get(updatePeriod));
- }
- if (tableNames.size() <= 1) {
- XStorageTableElement tblElement = JAXBUtils.getXStorageTableFromHiveTable(
- msClient.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(fact, storageName)));
- tblElement.setStorageName(storageName);
- for (UpdatePeriod p : updatePeriods) {
- tblElement.getUpdatePeriods().getUpdatePeriod().add(XUpdatePeriod.valueOf(p.name()));
- }
- factTable.getStorageTables().getStorageTable().add(tblElement);
- } else {
- // Multiple storage tables.
- XStorageTableElement tblElement = new XStorageTableElement();
- tblElement.setStorageName(storageName);
- XUpdatePeriods xUpdatePeriods = new XUpdatePeriods();
- tblElement.setUpdatePeriods(xUpdatePeriods);
- for (Map.Entry entry : updatePeriodToTableMap.entrySet()) {
- XUpdatePeriodTableDescriptor updatePeriodTableDescriptor = new XUpdatePeriodTableDescriptor();
- updatePeriodTableDescriptor.setTableDesc(getStorageTableDescFromHiveTable(
- msClient.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(fact, (String) entry.getValue()))));
- updatePeriodTableDescriptor.setUpdatePeriod(XUpdatePeriod.valueOf(((UpdatePeriod)entry.getKey()).name()));
- xUpdatePeriods.getUpdatePeriodTableDescriptor().add(updatePeriodTableDescriptor);
- }
- factTable.getStorageTables().getStorageTable().add(tblElement);
- }
- }
- return factTable;
+ return getClient(sessionid).getXFactTable(fact);
}
}
@@ -448,54 +375,34 @@
@Override
public void createFactTable(LensSessionHandle sessionid, XFactTable fact) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).createCubeFactTable(fact.getCubeName(),
- fact.getName(),
- JAXBUtils.fieldSchemaListFromColumns(fact.getColumns()),
- JAXBUtils.getFactUpdatePeriodsFromStorageTables(fact.getStorageTables()),
- fact.getWeight(),
- addFactColStartTimePropertyToFactProperties(fact),
- JAXBUtils.tableDescPrefixMapFromXStorageTables(fact.getStorageTables()),
- JAXBUtils.storageTablePrefixMapOfStorage(fact.getStorageTables()));
+ getClient(sessionid).createCubeFactTable(fact);
log.info("Created fact table " + fact.getName());
}
}
- public Map<String, String> addFactColStartTimePropertyToFactProperties(XFactTable fact) {
- Map<String, String> props = new HashMap<String, String>();
- props.putAll(JAXBUtils.mapFromXProperties(fact.getProperties()));
- props.putAll(JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns()));
- return props;
- }
-
- @Override
- public void createSegmentation(LensSessionHandle sessionid, XSegmentation cubeSeg) throws LensException {
- try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).createSegmentation(
- cubeSeg.getCubeName(),
- cubeSeg.getName(),
- JAXBUtils.segmentsFromXSegments(cubeSeg.getSegements()),
- cubeSeg.getWeight(),
- JAXBUtils.mapFromXProperties(cubeSeg.getProperties()));
- log.info("Created segmentation " + cubeSeg.getName());
- }
- }
-
@Override
public void updateFactTable(LensSessionHandle sessionid, XFactTable fact) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).alterCubeFactTable(fact.getName(), JAXBUtils.cubeFactFromFactTable(fact),
- JAXBUtils.tableDescPrefixMapFromXStorageTables(fact.getStorageTables()),
- JAXBUtils.columnStartAndEndTimeFromXColumns(fact.getColumns()));
+ getClient(sessionid).alterCubeFactTable(fact);
log.info("Updated fact table " + fact.getName());
} catch (HiveException e) {
throw new LensException(e);
}
}
+
+ @Override
+ public void createSegmentation(LensSessionHandle sessionid, XSegmentation cubeSeg) throws LensException {
+ try (SessionContext ignored = new SessionContext(sessionid)){
+ getClient(sessionid).createSegmentation(cubeSeg);
+ log.info("Created segmentation " + cubeSeg.getName());
+ }
+ }
+
@Override
public void updateSegmentation(LensSessionHandle sessionid, XSegmentation cubeSeg) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).alterSegmentation(cubeSeg.getName(), segmentationFromXSegmentation(cubeSeg));
+ getClient(sessionid).alterSegmentation(cubeSeg);
log.info("Updated segmentation " + cubeSeg.getName());
} catch (HiveException e) {
throw new LensException(e);
@@ -906,7 +813,7 @@
public void createStorage(LensSessionHandle sessionid, XStorage storage)
throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).createStorage(JAXBUtils.storageFromXStorage(storage));
+ getClient(sessionid).createStorage(storage);
log.info("Created storage " + storage.getName());
}
@@ -925,8 +832,7 @@
public void alterStorage(LensSessionHandle sessionid, String storageName,
XStorage storage) throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).alterStorage(storageName,
- JAXBUtils.storageFromXStorage(storage));
+ getClient(sessionid).alterStorage(storage);
log.info("Altered storage " + storageName);
} catch (HiveException e) {
throw new LensException(e);
@@ -1015,7 +921,7 @@
public void createDimension(LensSessionHandle sessionid, XDimension dimension)
throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).createDimension(JAXBUtils.dimensionFromXDimension(dimension));
+ getClient(sessionid).createDimension(dimension);
log.info("Created dimension " + dimension.getName());
}
}
@@ -1041,8 +947,7 @@
public void updateDimension(LensSessionHandle sessionid, String dimName, XDimension dimension)
throws LensException {
try (SessionContext ignored = new SessionContext(sessionid)){
- getClient(sessionid).alterDimension(dimName,
- JAXBUtils.dimensionFromXDimension(dimension));
+ getClient(sessionid).alterDimension(dimension);
log.info("Altered dimension " + dimName);
} catch (HiveException e) {
throw new LensException(e);