http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestHQLParser.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestHQLParser.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestHQLParser.java
index 3165d3a..57d28f3 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestHQLParser.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestHQLParser.java
@@ -19,9 +19,17 @@
 
 package org.apache.lens.cube.parse;
 
+import static org.apache.lens.cube.parse.HQLParser.getString;
+import static org.apache.lens.cube.parse.HQLParser.parseExpr;
+import static org.apache.lens.cube.parse.HQLParser.trimHavingAst;
+import static org.apache.lens.cube.parse.HQLParser.trimOrderByAst;
+
 import static org.apache.hadoop.hive.ql.parse.HiveParser.*;
 
+import static com.google.common.collect.Lists.newArrayList;
+
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -334,19 +342,19 @@ public class TestHQLParser {
 
   @Test
   public void testEqualsAST() throws Exception {
-    ASTNode expr1 = HQLParser.parseExpr("T1.a + T2.b - T2.c");
-    ASTNode expr2 = HQLParser.parseExpr("t1.A + t2.B - t2.C");
+    ASTNode expr1 = parseExpr("T1.a + T2.b - T2.c");
+    ASTNode expr2 = parseExpr("t1.A + t2.B - t2.C");
 
     Assert.assertTrue(HQLParser.equalsAST(expr1, expr2));
 
-    ASTNode literalExpr1 = HQLParser.parseExpr("A = 'FooBar'");
-    ASTNode literalExpr2 = HQLParser.parseExpr("a = 'FooBar'");
+    ASTNode literalExpr1 = parseExpr("A = 'FooBar'");
+    ASTNode literalExpr2 = parseExpr("a = 'FooBar'");
     Assert.assertTrue(HQLParser.equalsAST(literalExpr1, literalExpr2));
 
-    ASTNode literalExpr3 = HQLParser.parseExpr("A = 'fOObAR'");
+    ASTNode literalExpr3 = parseExpr("A = 'fOObAR'");
     Assert.assertFalse(HQLParser.equalsAST(literalExpr1, literalExpr3));
 
-    ASTNode literalExpr4 = HQLParser.parseExpr("A <> 'FooBar'");
+    ASTNode literalExpr4 = parseExpr("A <> 'FooBar'");
     Assert.assertFalse(HQLParser.equalsAST(literalExpr1, literalExpr4));
   }
 
@@ -393,7 +401,7 @@ public class TestHQLParser {
 
   @Test(dataProvider = "nAryFlatteningDataProvider")
   public void testNAryOperatorFlattening(String input, String expected) throws 
LensException {
-    ASTNode tree = HQLParser.parseExpr(input);
+    ASTNode tree = parseExpr(input);
     String infixString = HQLParser.getString(tree);
     Assert.assertEquals(infixString, expected);
   }
@@ -415,7 +423,7 @@ public class TestHQLParser {
   @Test(dataProvider = "colsInExpr")
   public void testColsInExpr(String input, String[] expected) throws Exception 
{
     String tableAlias = "cie";
-    ASTNode inputAST = HQLParser.parseExpr(input);
+    ASTNode inputAST = parseExpr(input);
     Set<String> actual = HQLParser.getColsInExpr(tableAlias, inputAST);
     Set<String> expectedSet = new HashSet<>(Arrays.asList(expected));
     Assert.assertEquals(actual, expectedSet, "Received " + actual + " for 
input:" + input);
@@ -446,7 +454,7 @@ public class TestHQLParser {
 
   @Test(dataProvider = "primitiveBool")
   public void testIsPrimitiveBooleanExpr(String input, boolean expected) 
throws Exception {
-    ASTNode inputAST = HQLParser.parseExpr(input);
+    ASTNode inputAST = parseExpr(input);
     boolean actual = HQLParser.isPrimitiveBooleanExpression(inputAST);
     Assert.assertEquals(actual, expected, "Received " + actual + " for input:" 
+ input + ":" + inputAST.dump());
   }
@@ -471,7 +479,7 @@ public class TestHQLParser {
 
   @Test(dataProvider = "primitiveBoolFunc")
   public void testIsPrimitiveBooleanFunction(String input, boolean expected) 
throws Exception {
-    ASTNode inputAST = HQLParser.parseExpr(input);
+    ASTNode inputAST = parseExpr(input);
     boolean actual = HQLParser.isPrimitiveBooleanFunction(inputAST);
     Assert.assertEquals(actual, expected, "Received " + actual + " for input:" 
+ input);
   }
@@ -503,7 +511,7 @@ public class TestHQLParser {
   @Test(dataProvider = "exprDataProvider")
   public void testParseExpr(String expr, HiveConf conf, boolean success) {
     try {
-      HQLParser.parseExpr(expr, conf);
+      parseExpr(expr, conf);
       Assert.assertTrue(success);
     } catch (LensException e) {
       Assert.assertFalse(success);
@@ -511,4 +519,40 @@ public class TestHQLParser {
       
Assert.assertTrue(e.getMessage().contains(LensCubeErrorCode.COULD_NOT_PARSE_EXPRESSION.name()));
     }
   }
+  @DataProvider
+  public Object[][] havingTrimDataProvider() {
+    return new Object[][] {
+      {"((sum((testcube.segmsr1)) > 1) and (sum((testcube.msr2)) > 2))", 
newArrayList("segmsr1"),
+        "(sum((testcube.segmsr1)) > 1)", },
+      {"(sum((testcube.msr2)) > 2)", newArrayList("segmsr1"), null, },
+      {"(sum((testcube.segmsr1)) > 1)", newArrayList("segmsr1"), 
"(sum((testcube.segmsr1)) > 1)", },
+    };
+  }
+
+  @Test(dataProvider = "havingTrimDataProvider")
+  public void testHavingTrim(String expr, Collection<String> columns, String 
expected) throws LensException {
+    ASTNode actualAst = trimHavingAst(parseExpr(expr), columns);
+    ASTNode expectedAst = expected == null ? null : parseExpr(expected);
+    if (!HQLParser.equalsAST(actualAst, expectedAst)) {
+      Assert.assertEquals(getString(actualAst), expected);
+    }
+  }
+  @DataProvider
+  public Object[][] orderByTrimDataProvider() {
+    return new Object[][] {
+      {"testcube.segmsr1 asc", newArrayList("segmsr1"), "testcube.segmsr1 
asc", },
+      {"testcube.segmsr1 desc, testcube.msr2", newArrayList("segmsr1"), 
"testcube.segmsr1 desc", },
+      {"testcube.segmsr1, testcube.msr2 desc", newArrayList("segmsr1"), 
"testcube.segmsr1 asc", },
+      {"testcube.msr2 desc", newArrayList("segmsr1"), "", },
+    };
+  }
+
+  @Test(dataProvider = "orderByTrimDataProvider")
+  public void testOrderByTrim(String expr, Collection<String> columns, String 
expected) throws LensException {
+    String query = "select * from testcube order by " + expr;
+    ASTNode queryAst = HQLParser.parseHQL(query, conf);
+    ASTNode orderByAST = HQLParser.findNodeByPath(queryAst, TOK_INSERT, 
TOK_ORDERBY);
+    ASTNode actualAst = trimOrderByAst(orderByAST, columns);
+    Assert.assertEquals(getString(actualAst), expected);
+  }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestJoinResolver.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestJoinResolver.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestJoinResolver.java
index f5ddf7b..0f10030 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestJoinResolver.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestJoinResolver.java
@@ -63,15 +63,7 @@ public class TestJoinResolver extends TestQueryRewrite {
   }
 
   private String getAutoResolvedFromString(CubeQueryContext query) throws 
LensException {
-    String from = null;
-    if (query.getPickedCandidate() instanceof StorageCandidate) {
-      StorageCandidate sc = (StorageCandidate) query.getPickedCandidate();
-      from =  sc.getFromString();
-      // Dim only query
-    } else if (query.getPickedCandidate() == null) {
-      from = query.getHqlContext().getFrom();
-    }
-    return from;
+    return ((DimHQLContext)query.getQueryWriterContext()).getFrom();
   }
 
   @Test
@@ -677,7 +669,7 @@ public class TestJoinResolver extends TestQueryRewrite {
   public void testUnreachableDim() throws ParseException, LensException, 
HiveException {
     assertLensExceptionInRewrite("select urdimid from testdim2", hconf, 
LensCubeErrorCode.NO_DIM_HAS_COLUMN);
     assertLensExceptionInRewrite("select urdimid from testcube where " + 
TWO_DAYS_RANGE, hconf,
-      LensCubeErrorCode.NO_FACT_HAS_COLUMN);
+      LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE);
     assertLensExceptionInRewrite("select unreachableName from testdim2", hconf,
       LensCubeErrorCode.NO_DIM_HAS_COLUMN);
     assertLensExceptionInRewrite("select unreachableName from testcube where " 
+ TWO_DAYS_RANGE, hconf,
@@ -685,6 +677,6 @@ public class TestJoinResolver extends TestQueryRewrite {
     assertLensExceptionInRewrite("select unreachableDim_chain.name from 
testdim2", hconf,
       LensCubeErrorCode.NO_JOIN_PATH);
     assertLensExceptionInRewrite("select unreachableDim_chain.name from 
testcube where " + TWO_DAYS_RANGE, hconf,
-      LensCubeErrorCode.NO_FACT_HAS_COLUMN);
+      LensCubeErrorCode.NO_JOIN_PATH);
   }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryMetrics.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryMetrics.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryMetrics.java
index 3883bee..2c27b30 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryMetrics.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryMetrics.java
@@ -21,10 +21,13 @@ package org.apache.lens.cube.parse;
 
 import static org.apache.lens.cube.metadata.DateFactory.TWO_DAYS_RANGE;
 
+import java.util.Set;
+
 import org.apache.lens.server.api.LensConfConstants;
 import org.apache.lens.server.api.metrics.LensMetricsRegistry;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -42,31 +45,14 @@ public class TestQueryMetrics extends TestQueryRewrite {
 
     rewriteCtx("select" + " SUM(msr2) from testCube where " + TWO_DAYS_RANGE, 
conf);
     MetricRegistry reg = LensMetricsRegistry.getStaticRegistry();
-
-    Assert.assertEquals(reg.getGauges().keySet(), Sets.newHashSet(
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.ColumnResolver-ITER-0",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.AliasReplacer-ITER-1",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.ExpressionResolver-ITER-2",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.DenormalizationResolver-ITER-3",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.TimerangeResolver-ITER-4",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.CandidateTableResolver-ITER-5",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.AggregateResolver-ITER-6",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.GroupbyResolver-ITER-7",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.FieldValidator-ITER-8",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.JoinResolver-ITER-9",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.ColumnLifetimeChecker-ITER-10",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.StorageTableResolver-ITER-11",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.CandidateTableResolver-ITER-12",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse."
-        + "CandidateCoveringSetsResolver-ITER-13",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.StorageTableResolver-ITER-14",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.MaxCoveringFactResolver-ITER-15",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.StorageTableResolver-ITER-16",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.DenormalizationResolver-ITER-17",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.ExpressionResolver-ITER-18",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.LightestFactResolver-ITER-19",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.LeastPartitionResolver-ITER-20",
-      
"lens.MethodMetricGauge.testCubeRewriteStackName-org.apache.lens.cube.parse.LightestDimensionResolver-ITER-21"
-    ));
+    CubeQueryRewriter cubeQueryRewriter = new CubeQueryRewriter(new 
Configuration(), new HiveConf());
+    Set<String> expected = Sets.newHashSet();
+    int index = 0;
+    for (ContextRewriter contextRewriter : cubeQueryRewriter.getRewriters()) {
+      expected.add("lens.MethodMetricGauge.testCubeRewriteStackName-"
+        + contextRewriter.getClass().getName() + "-ITER-" + index);
+      index++;
+    }
+    Assert.assertEquals(reg.getGauges().keySet(), expected);
   }
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryRewrite.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryRewrite.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryRewrite.java
index 17a8b0f..5c7ba83 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryRewrite.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestQueryRewrite.java
@@ -28,6 +28,7 @@ import org.apache.lens.api.error.ErrorCollection;
 import org.apache.lens.api.error.ErrorCollectionFactory;
 import org.apache.lens.api.error.LensError;
 import org.apache.lens.cube.error.LensCubeErrorCode;
+import org.apache.lens.cube.error.NoCandidateFactAvailableException;
 import org.apache.lens.server.api.*;
 import org.apache.lens.server.api.error.LensException;
 
@@ -84,14 +85,14 @@ public abstract class TestQueryRewrite {
     
SessionState.get().setCurrentDatabase(TestQueryRewrite.class.getSimpleName());
   }
 
-  protected String rewrite(String query, Configuration conf) throws 
LensException, ParseException {
+  protected String rewrite(String query, Configuration conf) throws 
LensException {
     String rewrittenQuery = rewriteCtx(query, conf).toHQL();
     log.info("Rewritten query: {}", rewrittenQuery);
     return rewrittenQuery;
   }
 
   protected CubeQueryContext rewriteCtx(String query, Configuration conf)
-    throws LensException, ParseException {
+    throws LensException {
     log.info("User query: {}", query);
     CubeQueryRewriter driver = new CubeQueryRewriter(conf, hconf);
     return driver.rewrite(query);
@@ -110,8 +111,7 @@ public abstract class TestQueryRewrite {
     }
   }
 
-  protected LensException getLensExceptionInRewrite(String query, 
Configuration conf)
-    throws LensException, ParseException {
+  protected <T extends LensException> T getLensExceptionInRewrite(String 
query, Configuration conf) {
     try {
       String hql = rewrite(query, conf);
       Assert.fail("Should have thrown exception. But rewrote the query : " + 
hql);
@@ -119,9 +119,13 @@ public abstract class TestQueryRewrite {
       return null;
     } catch (LensException e) {
       log.error("Lens exception in Rewrite.", e);
-      return e;
+      return (T) e;
     }
   }
+  protected PruneCauses<Candidate> getBriefAndDetailedError(String query, 
Configuration conf) {
+    NoCandidateFactAvailableException e = getLensExceptionInRewrite(query, 
conf);
+    return e.getBriefAndDetailedError();
+  }
 
   protected void assertLensExceptionInRewrite(String query, Configuration 
conf, LensCubeErrorCode expectedError)
     throws LensException, ParseException {

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestTimeRangeResolver.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestTimeRangeResolver.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestTimeRangeResolver.java
index d3938c1..929fb46 100644
--- 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestTimeRangeResolver.java
+++ 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestTimeRangeResolver.java
@@ -113,13 +113,14 @@ public class TestTimeRangeResolver extends 
TestQueryRewrite {
    * @return
    */
   private static List<CandidateTablePruneCause> 
findPruningMessagesForStorage(String stoargeName,
-    PruneCauses<StorageCandidate> allStoragePruningMsgs) {
-    for (StorageCandidate sc : allStoragePruningMsgs.keySet()) {
-      if (sc.getStorageTable().equals(stoargeName)) {
-        return allStoragePruningMsgs.get(sc);
+    PruneCauses<Candidate> allStoragePruningMsgs) {
+    for (Candidate sc : allStoragePruningMsgs.keySet()) {
+      if (sc instanceof StorageCandidate) {
+        if (((StorageCandidate)sc).getStorageTable().equals(stoargeName)) {
+          return allStoragePruningMsgs.get(sc);
+        }
       }
     }
     return  new ArrayList<CandidateTablePruneCause>();
   }
-
 }

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionQueries.java
----------------------------------------------------------------------
diff --git 
a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionQueries.java 
b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionQueries.java
index bed1e7a..8e65139 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionQueries.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionQueries.java
@@ -32,7 +32,6 @@ import java.util.stream.Collectors;
 
 import org.apache.lens.cube.error.NoCandidateFactAvailableException;
 import org.apache.lens.server.api.LensServerAPITestUtil;
-import org.apache.lens.server.api.error.LensException;
 
 import org.apache.hadoop.conf.Configuration;
 
@@ -361,13 +360,13 @@ public class TestUnionQueries extends TestQueryRewrite {
 
     //If not beginning of month. Expecting this to pass at beginning of every 
month (example April 01 00:00)
     if (!THREE_MONTHS_RANGE_UPTO_DAYS.equals(THREE_MONTHS_RANGE_UPTO_MONTH)) {
-      LensException e = getLensExceptionInRewrite("select count(msr4) from 
testCube where "
+      NoCandidateFactAvailableException e = getLensExceptionInRewrite("select 
count(msr4) from testCube where "
           + THREE_MONTHS_RANGE_UPTO_DAYS, conf);
-      assertTrue(e instanceof NoCandidateFactAvailableException);
-      Set<Map.Entry<StorageCandidate, List<CandidateTablePruneCause>>> causes =
-          ((NoCandidateFactAvailableException) e).getBriefAndDetailedError()
-              .entrySet().stream().filter(x -> x.getKey().getStorageTable()
-              .equalsIgnoreCase("c6_testfact")).collect(Collectors.toSet());
+      Set<Map.Entry<Candidate, List<CandidateTablePruneCause>>> causes =
+        e.getBriefAndDetailedError().entrySet().stream().filter(x ->
+          x.getKey() instanceof StorageCandidate
+            && 
((StorageCandidate)x.getKey()).getStorageTable().equalsIgnoreCase("c6_testfact"))
+          .collect(Collectors.toSet());
       assertEquals(causes.size(), 1);
       List<CandidateTablePruneCause> pruneCauses = 
causes.iterator().next().getValue();
       assertEquals(pruneCauses.size(), 1);

http://git-wip-us.apache.org/repos/asf/lens/blob/b58749e2/lens-cube/src/test/resources/schema/cubes/base/b1c1cube.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/cubes/base/b1c1cube.xml 
b/lens-cube/src/test/resources/schema/cubes/base/b1c1cube.xml
new file mode 100644
index 0000000..6ab528a
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/base/b1c1cube.xml
@@ -0,0 +1,903 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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_base_cube name="b1c1cube" 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.b1c1cube.timed.dimensions.list" 
value="d_time,pt,it,et,test_time_dim,test_time_dim2"/>
+    <property name="cube.allfields.queriable" value="true"/>
+    <property name="cube.table.b1c1cube.weight" value="0.0"/>
+  </properties>
+  <measures>
+    <measure _type="INT" name="segsegmsr1" default_aggr="SUM" 
description="inner segmentation measure 1"
+             display_string="inner segmentation measure 1"/>
+  </measures>
+  <dim_attributes>
+    <dim_attribute _type="string" name="business" display_string="business 
unit"
+                   description="Business unit name for segmentation" />
+    <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="cubecity1" 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&lt;string&gt;" 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&lt;int&gt;" 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="cityid" display_string="City1" 
description="id to city"/>
+    <dim_attribute _type="int" name="cityid1" display_string="City1" 
description="id to city"/>
+    <dim_attribute _type="int" name="cityid2" display_string="City2" 
description="id to city"/>
+    <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="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="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="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&lt;string&gt;" 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&lt;string&gt;" 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="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 &gt; 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, &quot;:&quot;, 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&lt;string&gt;" 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="b1c1cube.testDim3id">
+      <expr_spec expr="b1c1cube.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, &quot;:&quot;, citydim.name)"/>
+    </expression>
+    <expression _type="string" name="singlecoldim1qualifiedexpr" 
display_string="dim1" description="b1c1cube.dim1">
+      <expr_spec expr="b1c1cube.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&lt;string&gt;" 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&lt;string&gt;" 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, &quot;:&quot;, 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) &gt; 100 then 
&quot;high&quot; else &quot;low&quot; end"/>
+    </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&lt;string&gt;" 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="countrydim" name="cubecountry" 
display_string="cube-country"
+                description="country thru cube">
+      <paths>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" column="cityid" maps_to_many="false"/>
+              <to table="citydim" column="id" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" column="zipcode" maps_to_many="false"/>
+              <to table="zipdim" column="code" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" column="testdim3id" maps_to_many="false"/>
+              <to table="testdim3" column="id" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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="b1c1cube" column="dim2" maps_to_many="false"/>
+              <to table="testdim2" column="id" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" column="dim2big1" maps_to_many="false"/>
+              <to table="testdim2" column="bigid1" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" column="dim2big2" maps_to_many="false"/>
+              <to table="testdim2" column="bigid2" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" column="dim2bignew" maps_to_many="false"/>
+              <to table="testdim2" column="bigidnew" maps_to_many="false"/>
+            </edge>
+          </edges>
+        </path>
+        <path>
+          <edges>
+            <edge>
+              <from table="b1c1cube" 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="b1c1cube" 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="b1c1cube" 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>
\ No newline at end of file

Reply via email to