http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
----------------------------------------------------------------------
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..2edf419
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
@@ -0,0 +1,663 @@
+<?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="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="string" name="cityname1" display_string="city name1" 
description="city name1">
+      <chain_ref_column chain_name="cubecity1" 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 &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="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, &quot;:&quot;, 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, &quot;:&quot;, 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) &gt; 100 then 
&quot;high&quot; else &quot;low&quot; 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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
----------------------------------------------------------------------
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..cf36cc7
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
@@ -0,0 +1,42 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
----------------------------------------------------------------------
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..337e7f4
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
@@ -0,0 +1,63 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
----------------------------------------------------------------------
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..ce9a511
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
@@ -0,0 +1,52 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
----------------------------------------------------------------------
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..4245498
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
@@ -0,0 +1,44 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/cubes/derived/union_join_ctx_der1.xml
----------------------------------------------------------------------
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..6237d87
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/cubes/derived/union_join_ctx_der1.xml
@@ -0,0 +1,45 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/citydim.xml
----------------------------------------------------------------------
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..fd57fcd
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/citydim.xml
@@ -0,0 +1,122 @@
+<?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_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, &quot;:&quot;, 
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, &quot;:&quot;, citystate.name, 
&quot;:&quot;, citycountry.name, &quot;:&quot;, cityzip.code)"/>
+      <expr_spec expr="concat(citydim.name, &quot;:&quot;, 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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
----------------------------------------------------------------------
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..bd52a9a
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
@@ -0,0 +1,41 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
----------------------------------------------------------------------
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..7ffb276
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
@@ -0,0 +1,71 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
----------------------------------------------------------------------
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..b721c47
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
@@ -0,0 +1,70 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/daydim.xml
----------------------------------------------------------------------
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..89f2a6b
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/daydim.xml
@@ -0,0 +1,61 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
----------------------------------------------------------------------
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..0a2ea1c
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
@@ -0,0 +1,45 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/sports.xml
----------------------------------------------------------------------
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..3a0623f
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/sports.xml
@@ -0,0 +1,45 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/statedim.xml
----------------------------------------------------------------------
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..5676348
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/statedim.xml
@@ -0,0 +1,73 @@
+<?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_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>

http://git-wip-us.apache.org/repos/asf/lens/blob/ae83caae/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
----------------------------------------------------------------------
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..f40e8e2
--- /dev/null
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
@@ -0,0 +1,223 @@
+<?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_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>

Reply via email to