You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by su...@apache.org on 2017/04/12 12:40:48 UTC
[1/4] lens git commit: Addressed final reviews and fixed checkstyle
error
Repository: lens
Updated Branches:
refs/heads/lens-1381 72c20ff83 -> cb5e2a77d
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/statetable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/statetable.xml b/lens-cube/src/test/resources/schema/dimtables/statetable.xml
index 2aab131..58eb948 100644
--- a/lens-cube/src/test/resources/schema/dimtables/statetable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/statetable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="statedim" table_name="statetable" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
@@ -32,5 +52,23 @@
<time_part_cols>dt</time_part_cols>
</table_desc>
</storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C6</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="cube.storagetable.time.partcols" value="dt"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
</storage_tables>
</x_dimension_table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml b/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
index e7c808f..826d8dc 100644
--- a/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/statetable_partitioned.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="statedim" table_name="statetable_partitioned" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
index b320ec2..d04cb5c 100644
--- a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="testDim2" table_name="testdim2tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
index 2239997..efc0969 100644
--- a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl2.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="testDim2" table_name="testdim2tbl2" weight="10.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
index 62059ad..d9b39c7 100644
--- a/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim2tbl3.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="testDim2" table_name="testdim2tbl3" weight="20.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
index 7d2af60..ffd09c0 100644
--- a/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim3tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="testDim3" table_name="testdim3tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml b/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
index 2044851..d81daa7 100644
--- a/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/testdim4tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="testDim4" table_name="testdim4tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml b/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
index 6f80c27..e940cf7 100644
--- a/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/unreachabledimtable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="unreachableDim" table_name="unreachabledimtable" weight="0.0"
xmlns="uri:lens:cube:0.1">
<columns>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml b/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
index e0fa4e3..cec16a5 100644
--- a/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/user_interests_tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="user_interests" table_name="user_interests_tbl" weight="0.0"
xmlns="uri:lens:cube:0.1">
<columns>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/usertable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/usertable.xml b/lens-cube/src/test/resources/schema/dimtables/usertable.xml
index 055a958..de2083d 100644
--- a/lens-cube/src/test/resources/schema/dimtables/usertable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/usertable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="userdim" table_name="usertable" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="id"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/ziptable.xml b/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
index 094031e..7287886 100644
--- a/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/ziptable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="zipdim" table_name="ziptable" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="code" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/cheapfact.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/cheapfact.xml b/lens-cube/src/test/resources/schema/facts/cheapfact.xml
index 8a8d371..2b11c5b 100644
--- a/lens-cube/src/test/resources/schema/facts/cheapfact.xml
+++ b/lens-cube/src/test/resources/schema/facts/cheapfact.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="cheapfact" cube_name="testCube" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/summary1.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/summary1.xml b/lens-cube/src/test/resources/schema/facts/summary1.xml
index 199b991..44756c9 100644
--- a/lens-cube/src/test/resources/schema/facts/summary1.xml
+++ b/lens-cube/src/test/resources/schema/facts/summary1.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="summary1" cube_name="testCube" weight="10.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/summary2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/summary2.xml b/lens-cube/src/test/resources/schema/facts/summary2.xml
index c30ed75..380801f 100644
--- a/lens-cube/src/test/resources/schema/facts/summary2.xml
+++ b/lens-cube/src/test/resources/schema/facts/summary2.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="summary2" cube_name="testCube" weight="20.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/summary3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/summary3.xml b/lens-cube/src/test/resources/schema/facts/summary3.xml
index 4f1803f..77e296c 100644
--- a/lens-cube/src/test/resources/schema/facts/summary3.xml
+++ b/lens-cube/src/test/resources/schema/facts/summary3.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="summary3" cube_name="testCube" weight="30.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/summary4.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/summary4.xml b/lens-cube/src/test/resources/schema/facts/summary4.xml
index b1be93c..e26ef68 100644
--- a/lens-cube/src/test/resources/schema/facts/summary4.xml
+++ b/lens-cube/src/test/resources/schema/facts/summary4.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="summary4" cube_name="testCube" weight="15.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact.xml b/lens-cube/src/test/resources/schema/facts/testfact.xml
index 0bd9c5a..aa9322a 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact" cube_name="testCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact1_base.xml b/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
index 0f25784..81aaddb 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact1_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact1_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
index d755b02..65f1dc3 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact1_raw_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact1_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2.xml b/lens-cube/src/test/resources/schema/facts/testfact2.xml
index d6006c6..41d2045 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact2.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact2.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact2" cube_name="testCube" weight="10.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_base.xml b/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
index b3c8076..f113ff5 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact2_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr12" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml b/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
index 5431975..9c36753 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_raw.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact2_raw" cube_name="testCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
index ad126ff..0bab461 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact2_raw_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact2_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr11" _type="int" comment="first measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact3_base.xml b/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
index c9c36c4..e27664f 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact3_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact3_base" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr13" _type="double" comment="third measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
index d209f54..6becd8e 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact3_raw_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact3_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr13" _type="double" comment="third measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
index 39c4b4f..5d1136b 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact4_raw_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact4_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr13" _type="double" comment="third measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact5_base.xml b/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
index 8febae4..d302c48 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact5_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact5_base" cube_name="baseCube" weight="150.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml b/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
index 72f6138..dbfa906 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact5_raw_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact5_raw_base" cube_name="baseCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr9" _type="bigint" comment="ninth measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact6_base.xml b/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
index 42715e9..b62a1a1 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact6_base.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact6_base" cube_name="baseCube" weight="150.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr13" _type="double" comment="third measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml b/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
index 94fb68a..6723c98 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact_continuous.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact_continuous" cube_name="testCube" weight="100.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr11" _type="double" comment="third measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml b/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
index f14395e..ce3b54a 100644
--- a/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfact_deprecated.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfact_deprecated" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr12" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml b/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
index 8237ba0..6f0f687 100644
--- a/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
+++ b/lens-cube/src/test/resources/schema/facts/testfactmonthly.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="testfactmonthly" cube_name="testCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="msr21" _type="float" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
index d07393d..fcef02d 100644
--- a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact1.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="union_join_ctx_fact1" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="union_join_ctx_msr1" _type="int" comment="first measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
index 9145dcc..c883640 100644
--- a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact2.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="union_join_ctx_fact2" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="union_join_ctx_msr1" _type="int" comment="first measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
index db091b7..27e859e 100644
--- a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact3.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="union_join_ctx_fact3" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="union_join_ctx_msr2" _type="int" comment="second measure"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
index e1fbad6..2887194 100644
--- a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact5.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="union_join_ctx_fact5" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="d_time" _type="timestamp" comment="event time"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
index 0af6a13..22e3ea8 100644
--- a/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
+++ b/lens-cube/src/test/resources/schema/facts/union_join_ctx_fact6.xml
@@ -1,4 +1,24 @@
<?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_fact_table name="union_join_ctx_fact6" cube_name="baseCube" weight="5.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="d_time" _type="timestamp" comment="event time"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c0.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c0.xml b/lens-cube/src/test/resources/schema/storages/c0.xml
index de432a1..d27f7d3 100644
--- a/lens-cube/src/test/resources/schema/storages/c0.xml
+++ b/lens-cube/src/test/resources/schema/storages/c0.xml
@@ -1,4 +1,24 @@
<?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_storage name="c0" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c0.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c1.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c1.xml b/lens-cube/src/test/resources/schema/storages/c1.xml
index a0f0886..3233e4b 100644
--- a/lens-cube/src/test/resources/schema/storages/c1.xml
+++ b/lens-cube/src/test/resources/schema/storages/c1.xml
@@ -1,4 +1,24 @@
<?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_storage name="c1" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c1.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c2.xml b/lens-cube/src/test/resources/schema/storages/c2.xml
index eb670af..0078ed0 100644
--- a/lens-cube/src/test/resources/schema/storages/c2.xml
+++ b/lens-cube/src/test/resources/schema/storages/c2.xml
@@ -1,4 +1,24 @@
<?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_storage name="c2" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c2.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c3.xml b/lens-cube/src/test/resources/schema/storages/c3.xml
index 4b78cdb..5af2074 100644
--- a/lens-cube/src/test/resources/schema/storages/c3.xml
+++ b/lens-cube/src/test/resources/schema/storages/c3.xml
@@ -1,4 +1,24 @@
<?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_storage name="c3" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c3.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c4.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c4.xml b/lens-cube/src/test/resources/schema/storages/c4.xml
index 9ed2d52..037ab86 100644
--- a/lens-cube/src/test/resources/schema/storages/c4.xml
+++ b/lens-cube/src/test/resources/schema/storages/c4.xml
@@ -1,4 +1,24 @@
<?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_storage name="c4" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c4.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c5.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c5.xml b/lens-cube/src/test/resources/schema/storages/c5.xml
index 8ebdf3c..65e7b4a 100644
--- a/lens-cube/src/test/resources/schema/storages/c5.xml
+++ b/lens-cube/src/test/resources/schema/storages/c5.xml
@@ -1,4 +1,24 @@
<?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_storage name="c5" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c5.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/storages/c99.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/storages/c99.xml b/lens-cube/src/test/resources/schema/storages/c99.xml
index d87db78..2e9355f 100644
--- a/lens-cube/src/test/resources/schema/storages/c99.xml
+++ b/lens-cube/src/test/resources/schema/storages/c99.xml
@@ -1,4 +1,24 @@
<?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_storage name="c99" classname="org.apache.lens.cube.metadata.HDFSStorage" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.table.c99.weight" value="0.0"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java
----------------------------------------------------------------------
diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java
index 2cbf90c..75153f6 100644
--- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java
+++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java
@@ -200,7 +200,7 @@ public class ColumnarSQLRewriter implements QueryRewriter {
* @throws SemanticException the semantic exception
*/
public void analyzeInternal(Configuration conf, HiveConf hconf) throws SemanticException {
- CubeSemanticAnalyzer c1 = new CubeSemanticAnalyzer(hconf);
+ CubeSemanticAnalyzer c1 = new CubeSemanticAnalyzer(conf, hconf);
QB qb = new QB(null, null, false);
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DruidSQLRewriter.java
----------------------------------------------------------------------
diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DruidSQLRewriter.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DruidSQLRewriter.java
index 21c3718..2351fb3 100644
--- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DruidSQLRewriter.java
+++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DruidSQLRewriter.java
@@ -65,7 +65,7 @@ public class DruidSQLRewriter extends ColumnarSQLRewriter {
* @throws SemanticException the semantic exception
*/
public void analyzeInternal(Configuration conf, HiveConf hconf) throws SemanticException {
- CubeSemanticAnalyzer c1 = new CubeSemanticAnalyzer(hconf);
+ CubeSemanticAnalyzer c1 = new CubeSemanticAnalyzer(conf, hconf);
QB qb = new QB(null, null, false);
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java
index 9d823da..9ba1eb1 100644
--- a/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java
+++ b/lens-server/src/main/java/org/apache/lens/server/metastore/MetastoreResource.java
@@ -1,4 +1,4 @@
-/**
+ /**
* 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
[3/4] lens git commit: Addressed final reviews and fixed checkstyle
error
Posted by su...@apache.org.
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java
index ba8a5e4..93dbfc3 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBaseCubeQueries.java
@@ -37,7 +37,6 @@ import org.apache.lens.cube.error.LensCubeErrorCode;
import org.apache.lens.cube.error.NoCandidateFactAvailableException;
import org.apache.lens.cube.metadata.TimeRange;
import org.apache.lens.cube.metadata.UpdatePeriod;
-import org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode;
import org.apache.lens.server.api.error.LensException;
import org.apache.commons.lang.time.DateUtils;
@@ -68,15 +67,12 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
}
@Test
- public void testNoCandidateFactAvailableExceptionCompareTo() throws Exception {
- //maxCause : UNSUPPORTED_STORAGE
- NoCandidateFactAvailableException ne1 =
- (NoCandidateFactAvailableException)getLensExceptionInRewrite(
+ public void testNoUnionCandidateAndNoJoinCandidateErrorWeight() throws Exception {
+ LensException e1 = getLensExceptionInRewrite(
"select dim1, test_time_dim, msr3, msr13 from basecube where " + TWO_DAYS_RANGE, conf);
- //maxCause : STORAGE_NOT_AVAILABLE_IN_RANGE
- NoCandidateFactAvailableException ne2 = (NoCandidateFactAvailableException)
- getLensExceptionInRewrite("select dim1 from " + cubeName + " where " + LAST_YEAR_RANGE, getConf());
- assertEquals(ne1.compareTo(ne2), -1);
+ LensException e2 = getLensExceptionInRewrite("select dim1 from " + cubeName
+ + " where " + LAST_YEAR_RANGE, getConf());
+ assertEquals(e1.getErrorWeight() - e2.getErrorWeight(), 1);
}
@Test
@@ -92,53 +88,9 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
e = getLensExceptionInRewrite("select dim1, test_time_dim, msr3, msr13 from basecube where "
+ TWO_DAYS_RANGE, conf);
assertEquals(e.getErrorCode(),
- LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo().getErrorCode());
- NoCandidateFactAvailableException ne = (NoCandidateFactAvailableException) e;
- //ne.briefAndDetailedError.getBriefCause()
- //ne.getJsonMessage().brief
- assertTrue(CandidateTablePruneCode.UNSUPPORTED_STORAGE.errorFormat.equals(ne.getJsonMessage().getBrief()));
-// PruneCauses.BriefAndDetailedError pruneCauses = ne.getJsonMessage();
-// String regexp = String.format(CandidateTablePruneCode.UNSUPPORTED_STORAGE.errorFormat,
-// "Column Sets: (.*?)", "queriable together");
-// Matcher matcher = Pattern.compile(regexp).matcher(pruneCauses.getBrief());
-// assertTrue(matcher.matches(), pruneCauses.getBrief());
-// assertEquals(matcher.groupCount(), 1);
-// String columnSetsStr = matcher.group(1);
-// assertNotEquals(columnSetsStr.indexOf("test_time_dim"), -1, columnSetsStr);
-// assertNotEquals(columnSetsStr.indexOf("msr3, msr13"), -1);
-//
-// /**
-// * Verifying the BriefAndDetailedError:
-// * 1. Check for missing columns(COLUMN_NOT_FOUND)
-// * and check the respective tables for each COLUMN_NOT_FOUND
-// * 2. check for ELEMENT_IN_SET_PRUNED
-// *
-// */
-// boolean columnNotFound = false;
-// List<String> testTimeDimFactTables = Arrays.asList("c1_testfact3_raw_base",
-// "c1_testfact5_base", "c1_testfact6_base", "c1_testfact1_raw_base",
-// "c1_testfact4_raw_base", "c1_testfact3_base");
-// List<String> factTablesForMeasures = Arrays.asList(
-// "c2_testfact2_base","c2_testfact_deprecated","c1_union_join_ctx_fact1","c1_union_join_ctx_fact2",
-// "c1_union_join_ctx_fact3","c1_union_join_ctx_fact5","c1_testfact2_base",
-// "c1_union_join_ctx_fact6","c1_testfact2_raw_base","c1_testfact5_raw_base",
-// "c3_testfact_deprecated","c1_testfact_deprecated","c4_testfact_deprecated",
-// "c3_testfact2_base","c4_testfact2_base");
-// for (Map.Entry<String, List<CandidateTablePruneCause>> entry : pruneCauses.getDetails().entrySet()) {
-// if (entry.getValue().contains(CandidateTablePruneCause.columnNotFound(
-// CandidateTablePruneCode.COLUMN_NOT_FOUND, "test_time_dim"))) {
-// columnNotFound = true;
-// compareStrings(testTimeDimFactTables, entry);
-// }
-// if (entry.getValue().contains(CandidateTablePruneCause.columnNotFound(
-// CandidateTablePruneCode.COLUMN_NOT_FOUND, "msr3", "msr13"))) {
-// columnNotFound = true;
-// compareStrings(factTablesForMeasures, entry);
-// }
-// }
-// Assert.assertTrue(columnNotFound);
- // assertEquals(pruneCauses.getDetails().get("testfact1_base"),
- // Arrays.asList(new CandidateTablePruneCause(CandidateTablePruneCode.ELEMENT_IN_SET_PRUNED)));
+ LensCubeErrorCode.NO_JOIN_CANDIDATE_AVAILABLE.getLensErrorInfo().getErrorCode());
+ assertTrue(e.getMessage().contains("[msr3, msr13]"));
+
}
private void compareStrings(List<String> factTablesList, Map.Entry<String, List<CandidateTablePruneCause>> entry) {
@@ -195,16 +147,16 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
Set<String> storageCandidates = new HashSet<String>();
Set<StorageCandidate> scSet = CandidateUtil.getStorageCandidates(ctx.getCandidates());
for (StorageCandidate sc : scSet) {
- storageCandidates.add(sc.getName());
+ storageCandidates.add(sc.getStorageTable());
}
Assert.assertTrue(storageCandidates.contains("c1_testfact1_base"));
Assert.assertTrue(storageCandidates.contains("c1_testfact2_base"));
String hqlQuery = ctx.toHQL();
String expected1 =
- getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, sum((basecube.msr12)) as `alias1` FROM ", null,
+ getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, sum((basecube.msr12)) as `alias1` FROM ", null,
null, getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT sum((basecube.msr2)) as `alias0`, sum(0.0) as `alias1` FROM ", null,
+ getExpectedQuery(cubeName, "SELECT sum((basecube.msr2)) as `alias0`, 0.0 as `alias1` FROM ", null,
null, getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -221,21 +173,21 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
Set<String> storageCandidates = new HashSet<String>();
Set<StorageCandidate> scSet = CandidateUtil.getStorageCandidates(ctx.getCandidates());
for (StorageCandidate sc : scSet) {
- storageCandidates.add(sc.getName());
+ storageCandidates.add(sc.getStorageTable());
}
Assert.assertEquals(storageCandidates.size(), 3);
Assert.assertTrue(storageCandidates.contains("c1_testfact1_base"));
Assert.assertTrue(storageCandidates.contains("c1_testfact2_base"));
Assert.assertTrue(storageCandidates.contains("c1_testfact3_base"));
String hqlQuery = ctx.toHQL();
- String expected1 = getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, count(0.0) as `alias1`, "
+ String expected1 = getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.msr12)) as `alias2` FROM ", null, null,
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
- String expected2 = getExpectedQuery(cubeName, "SELECT sum((basecube.msr2)) as `alias0`, count(0.0) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null,
+ String expected2 = getExpectedQuery(cubeName, "SELECT sum((basecube.msr2)) as `alias0`, 0.0 as `alias1`, "
+ + "0.0 as `alias2` FROM ", null,
null, getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
- String expected3 = getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, count((basecube.msr14)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null, null,
+ String expected3 = getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, count((basecube.msr14)) as `alias1`, "
+ + "0.0 as `alias2` FROM ", null, null,
getWhereForDailyAndHourly2days(cubeName, "C1_testFact3_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -251,9 +203,9 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String hqlQuery = rewrite("select dim1, roundedmsr2, msr12 from basecube" + " where " + TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr2)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
- String expected2 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, "
+ String expected2 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.msr12)) as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
compareContains(expected1, hqlQuery);
@@ -271,11 +223,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
Configuration tConf = new Configuration(conf);
tConf.setBoolean(CubeQueryConfUtil.LIGHTEST_FACT_FIRST, true);
String hqlQuery = rewrite("select dim1, roundedmsr2, msr12 from basecube" + " where " + TWO_DAYS_RANGE, tConf);
- String expected1 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, "
+ String expected1 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.msr12)) as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr2)) "
- + "as `alias1`, sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "as `alias1`, 0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -292,11 +244,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
tConf.setBoolean(CubeQueryConfUtil.LIGHTEST_FACT_FIRST, true);
String hqlQuery = rewrite("select dim1, roundedmsr2, flooredmsr12 from basecube" + " where "
+ TWO_DAYS_RANGE, tConf);
- String expected1 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, "
+ String expected1 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.msr12)) as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr2)) "
- + "as `alias1`, sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "as `alias1`, 0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -313,10 +265,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String hqlQuery = rewrite("select dim1, msr12, roundedmsr2 from basecube" + " where " + TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr12)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", null,
+ "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", null,
" group by basecube.dim1", getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -335,17 +287,17 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, " SELECT (basecube.dim1) as `alias0`, (basecube.d_time) as `alias1`, "
- + "sum((basecube.msr12)) as `alias2`, sum(0.0) as `alias3`, max(0.0) as `alias4`, max(0.0) as `alias5` FROM ",
+ + "sum((basecube.msr12)) as `alias2`, 0.0 as `alias3`, 0.0 as `alias4`, 0.0 as `alias5` FROM ",
null, " group by basecube.dim1, (basecube.d_time)",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(
cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.d_time) as `alias1`, sum(0.0) as `alias2`, "
- + "sum((basecube.msr2)) as `alias3`, max(0.0) as `alias4`, max((basecube.msr3)) as `alias5` FROM ", null,
+ "SELECT (basecube.dim1) as `alias0`, (basecube.d_time) as `alias1`, 0.0 as `alias2`, "
+ + "sum((basecube.msr2)) as `alias3`, 0.0 as `alias4`, max((basecube.msr3)) as `alias5` FROM ", null,
" group by basecube.dim1, (basecube.d_time)", getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
String expected3 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, (basecube.d_time) as `alias1`, sum(0.0) "
- + "as `alias2`, sum(0.0) as `alias3`, max((basecube.msr13)) as `alias4`, max(0.0) as `alias5` FROM ", null,
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, (basecube.d_time) as `alias1`, 0.0 "
+ + "as `alias2`, 0.0 as `alias3`, max((basecube.msr13)) as `alias4`, 0.0 as `alias5` FROM ", null,
" group by basecube.dim1, (basecube.d_time)", getWhereForDailyAndHourly2days(cubeName, "c1_testfact3_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -364,10 +316,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
// query two dim attributes
String hqlQuery = rewrite("select dim1, dim11, msr12, roundedmsr2 from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, "
- + "sum((basecube.msr12)) as `alias2`, sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1",
+ + "sum((basecube.msr12)) as `alias2`, 0.0 as `alias3` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, "
- + "sum(0.0) as `alias2`, sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1",
+ + "0.0 as `alias2`, sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -406,10 +358,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
rewrite("select dim1 d1, msr12 `my msr12`, roundedmsr2 m2 from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr12)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) "
+ "as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
@@ -428,10 +380,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr12)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) "
+ "as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
@@ -450,10 +402,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr12)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) "
+ "as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
@@ -473,10 +425,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum((basecube.msr12)) as `alias1`, "
- + "sum(0.0) as `alias2` FROM", null, " group by basecube.dim1",
+ + "0.0 as `alias2` FROM", null, " group by basecube.dim1",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) "
+ "as `alias2` FROM", null,
" group by basecube.dim1", getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
@@ -494,12 +446,12 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
rewrite("select reverse(dim1), ltrim(dim1), msr12, roundedmsr2 from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT reverse((basecube.dim1)) as `alias0`, ltrim((basecube.dim1)) as `alias1`, "
- + "sum((basecube.msr12)) as `alias2`, sum(0.0) as `alias3` FROM ", null,
+ + "sum((basecube.msr12)) as `alias2`, 0.0 as `alias3` FROM ", null,
" group by reverse(basecube.dim1), ltrim(basecube.dim1)",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 =
getExpectedQuery(cubeName, "SELECT reverse((basecube.dim1)) as `alias0`, ltrim((basecube.dim1)) as `alias1`, "
- + "sum(0.0) as `alias2`, sum((basecube.msr2)) as `alias3` FROM ", null,
+ + "0.0 as `alias2`, sum((basecube.msr2)) as `alias3` FROM ", null,
" group by reverse(basecube.dim1), ltrim(basecube.dim1)",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
@@ -519,11 +471,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT reverse((basecube.dim1)) as `alias0`, max((basecube.msr13)) as `alias1`, "
- + "count((basecube.msr14)) as `alias2`, sum(0.0) as `alias3` FROM", null,
+ + "count((basecube.msr14)) as `alias2`, 0.0 as `alias3` FROM", null,
" group by reverse(basecube.dim1)", getWhereForDailyAndHourly2days(cubeName, "C1_testFact3_BASE"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT reverse((basecube.dim1)) as `alias0`, max(0.0) as `alias1`, "
- + "count(0.0) as `alias2`, sum((basecube.msr2)) as `alias3` FROM", null,
+ getExpectedQuery(cubeName, "SELECT reverse((basecube.dim1)) as `alias0`, 0.0 as `alias1`, "
+ + "0.0 as `alias2`, sum((basecube.msr2)) as `alias3` FROM", null,
" group by reverse(basecube.dim1)", getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -541,10 +493,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String hqlQuery = rewrite("select dim1, avg(msr12), avg(msr2) from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, avg((basecube.msr12)) as `alias1`,"
- + " avg(0.0) as `alias2` FROM ", null, " group by basecube.dim1",
+ + " 0.0 as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, avg(0.0) as `alias1`, avg((basecube.msr2)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, avg((basecube.msr2)) "
+ "as `alias2` FROM ", null, " group by basecube.dim1",
getWhereForHourly2days(cubeName, "C1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
@@ -560,13 +512,13 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
// query with join
String hqlQuery = rewrite("select dim2chain.name, msr12, roundedmsr2 from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 = getExpectedQuery(cubeName,
- "SELECT (dim2chain.name) as `alias0`, sum((basecube.msr12)) as `alias1`, sum(0.0) as `alias2` FROM ",
+ "SELECT (dim2chain.name) as `alias0`, sum((basecube.msr12)) as `alias1`, 0.0 as `alias2` FROM ",
" JOIN " + getDbName()
+ "c1_testdim2tbl dim2chain ON basecube.dim2 = "
+ " dim2chain.id and (dim2chain.dt = 'latest') ", null,
" group by dim2chain.name", null, getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
String expected2 = getExpectedQuery(cubeName,
- "SELECT (dim2chain.name) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", " JOIN "
+ "SELECT (dim2chain.name) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", " JOIN "
+ getDbName()
+ "c1_testdim2tbl dim2chain ON basecube.dim2 = "
+ " dim2chain.id and (dim2chain.dt = 'latest') ", null,
@@ -585,12 +537,12 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
// query with denorm variable
String hqlQuery = rewrite("select dim2, msr13, roundedmsr2 from basecube where " + TWO_DAYS_RANGE, conf);
String expected1 = getExpectedQuery(cubeName, "SELECT (dim2chain.id) as `alias0`, max((basecube.msr13)) "
- + "as `alias1`, sum(0.0) as `alias2` FROM ", " JOIN " + getDbName()
+ + "as `alias1`, 0.0 as `alias2` FROM ", " JOIN " + getDbName()
+ "c1_testdim2tbl dim2chain ON basecube.dim12 = "
+ " dim2chain.id and (dim2chain.dt = 'latest') ", null, " group by dim2chain.id", null,
getWhereForHourly2days(cubeName, "C1_testFact3_RAW_BASE"));
String expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim2) as `alias0`, max(0.0) as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", null,
+ "SELECT (basecube.dim2) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) as `alias2` FROM ", null,
" group by basecube.dim2", getWhereForHourly2days(cubeName, "C1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -607,12 +559,12 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String hqlQuery = rewrite("select dim2, msr13, roundedmsr2 from basecube where dim2 == 10 and " + TWO_DAYS_RANGE,
conf);
String expected1 = getExpectedQuery(cubeName, "SELECT (dim2chain.id) as `alias0`, max((basecube.msr13)) "
- + "as `alias1`, sum(0.0) as `alias2` FROM ", " JOIN " + getDbName()
+ + "as `alias1`, 0.0 as `alias2` FROM ", " JOIN " + getDbName()
+ "c1_testdim2tbl dim2chain ON basecube.dim12 = "
+ " dim2chain.id and (dim2chain.dt = 'latest') ", "dim2chain.id == 10", " group by dim2chain.id", null,
getWhereForHourly2days(cubeName, "C1_testFact3_RAW_BASE"));
String expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim2) as `alias0`, max(0.0) as `alias1`, sum((basecube.msr2)) as `alias2` FROM ",
+ "SELECT (basecube.dim2) as `alias0`, 0.0 as `alias1`, sum((basecube.msr2)) as `alias2` FROM ",
"basecube.dim2 == 10", " group by basecube.dim2",
getWhereForHourly2days(cubeName, "C1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
@@ -634,14 +586,14 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (((basecube.dim1) != 'x') and ((dim2chain.id) != 10)) as `alias0`, "
- + "sum(0.0) as `alias1`, avg(((basecube.msr13) + (basecube.msr14))) as `alias2` FROM ", " JOIN "
+ + "0.0 as `alias1`, avg(((basecube.msr13) + (basecube.msr14))) as `alias2` FROM ", " JOIN "
+ getDbName() + "c1_testdim2tbl dim2chain ON basecube.dim12 = "
+ " dim2chain.id and (dim2chain.dt = 'latest') ", null,
" group by basecube.dim1 != 'x' AND dim2chain.id != 10", null,
getWhereForHourly2days(cubeName, "C1_testfact3_raw_base"));
String expected2 =
getExpectedQuery(cubeName, "SELECT (((basecube.dim1) != 'x') and ((basecube.dim2) != 10)) as `alias0`, "
- + "sum((basecube.msr2)) as `alias1`, avg(0.0) as `alias2` FROM", null,
+ + "sum((basecube.msr2)) as `alias1`, 0.0 as `alias2` FROM", null,
" group by basecube.dim1 != 'x' AND basecube.dim2 != 10",
getWhereForHourly2days(cubeName, "C1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
@@ -664,14 +616,14 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ TWO_DAYS_RANGE, conf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (((basecube.dim1) != 'x') and ((dim2chain.id) != 10)) as `alias0`, "
- + "sum(0.0) as `alias1`, avg(((basecube.msr13) + (basecube.msr14))) as `alias2` FROM ", " JOIN " + getDbName()
+ + "0.0 as `alias1`, avg(((basecube.msr13) + (basecube.msr14))) as `alias2` FROM ", " JOIN " + getDbName()
+ "c1_testdim2tbl dim2chain ON basecube.dim12 = " + " dim2chain.id and (dim2chain.dt = 'latest') ",
"(basecube.dim1 != 'x' AND dim2chain.id != 10) == true",
" group by basecube.dim1 != 'x' AND dim2chain.id != 10", null,
getWhereForHourly2days(cubeName, "C1_testfact3_raw_base"));
String expected2 =
getExpectedQuery(cubeName, "SELECT (((basecube.dim1) != 'x') and ((basecube.dim2) != 10)) as `alias0`, "
- + "sum((basecube.msr2)) as `alias1`, avg(0.0) as `alias2` FROM ",
+ + "sum((basecube.msr2)) as `alias1`, 0.0 as `alias2` FROM ",
"(basecube.dim1 != 'x' AND basecube.dim2 != 10) == true",
" group by basecube.dim1 != 'x' AND basecube.dim2 != 10",
getWhereForHourly2days(cubeName, "C1_testfact1_raw_base"));
@@ -692,12 +644,12 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
String hqlQuery =
rewrite("select booleancut, round(sum(msr2)/1000), msr13 from basecube where " + TWO_DAYS_RANGE, tconf);
String expected1 =
- getExpectedQuery(cubeName, "SELECT (basecube.booleancut) as `alias0`, sum(0.0) as `alias1`, "
+ getExpectedQuery(cubeName, "SELECT (basecube.booleancut) as `alias0`, 0.0 as `alias1`, "
+ "max((basecube.msr13)) as `alias2` FROM", null, " "
+ "group by basecube.booleancut", getWhereForDailyAndHourly2days(cubeName, "C1_testfact6_base"));
String expected2 =
getExpectedQuery(cubeName, "SELECT (basecube.booleancut) as `alias0`, sum((basecube.msr2)) as `alias1`, "
- + "max(0.0) as `alias2` FROM ", null, " group by basecube.booleancut",
+ + "0.0 as `alias2` FROM ", null, " group by basecube.booleancut",
getWhereForDailyAndHourly2days(cubeName, "C1_testfact5_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -717,10 +669,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ TWO_DAYS_RANGE, tconf);
String expected1 =
getExpectedQuery(cubeName, "SELECT sum(case when ((basecube.dim22) = 'x') then (basecube.msr12) else 0 end) "
- + "as `alias0`, sum(0.0) as `alias1` FROM ", null, null,
+ + "as `alias0`, 0.0 as `alias1` FROM ", null, null,
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, null,
+ getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, null,
getWhereForHourly2days(cubeName, "c1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -737,10 +689,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ TWO_DAYS_RANGE, tconf);
String expected1 =
getExpectedQuery(cubeName, "SELECT sum(case when ((basecube.dim13) = 'x') then (basecube.msr12) else 0 end) "
- + "as `alias0`, sum(0.0) as `alias1` FROM ", null, null,
+ + "as `alias0`, 0.0 as `alias1` FROM ", null, null,
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, null,
+ getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, null,
getWhereForHourly2days(cubeName, "c1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -757,11 +709,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "where " + TWO_DAYS_RANGE, tconf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(case when ((basecube.dim13) = 'x') "
- + "then (basecube.msr12) else 0 end) as `alias1`, sum(0.0) as `alias2` FROM ", null,
+ + "then (basecube.msr12) else 0 end) as `alias1`, 0.0 as `alias2` FROM ", null,
" group by basecube.dim1 ",
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr1)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr1)) "
+ "as `alias2` FROM", null,
" group by basecube.dim1 ", getWhereForHourly2days(cubeName, "c1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
@@ -783,10 +735,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "and sum(msr1) > 500", tconf);
String expected1 =
getExpectedQuery(cubeName, "SELECT sum(case when ((basecube.dim13) = 'x') then (basecube.msr12) else 0 end) "
- + "as `alias0`, sum(0.0) as `alias1` FROM ", null, "",
+ + "as `alias0`, 0.0 as `alias1` FROM ", null, "",
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT sum(0.0) as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, "",
+ getExpectedQuery(cubeName, "SELECT 0.0 as `alias0`, sum((basecube.msr1)) as `alias1` FROM ", null, "",
getWhereForHourly2days(cubeName, "c1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
compareContains(expected2, hqlQuery);
@@ -805,10 +757,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "and sum(msr1) > 500", tconf);
String expected1 =
getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(case when ((basecube.dim13) = 'x') then "
- + "(basecube.msr12) else 0 end) as `alias1`, sum(0.0) as `alias2` FROM", null, " group by basecube.dim1",
+ + "(basecube.msr12) else 0 end) as `alias1`, 0.0 as `alias2` FROM", null, " group by basecube.dim1",
getWhereForHourly2days(cubeName, "C1_testfact2_raw_base"));
String expected2 =
- getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr1)) "
+ getExpectedQuery(cubeName, "SELECT (basecube.dim1) as `alias0`, 0.0 as `alias1`, sum((basecube.msr1)) "
+ "as `alias2` FROM", null, " group by basecube.dim1",
getWhereForHourly2days(cubeName, "c1_testfact1_raw_base"));
compareContains(expected1, hqlQuery);
@@ -903,10 +855,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having roundedmsr2 > 0", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) "
- + "as `alias2`, sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "as `alias2`, 0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -922,10 +874,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12 > 2 and roundedmsr2 > 0", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -941,11 +893,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12+roundedmsr2 <= 1000 and msr12 > 2 and roundedmsr2 > 0", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -961,10 +913,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12+roundedmsr2 <= 1000", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, sum((basecube.msr2)) "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, sum((basecube.msr2)) "
+ "as `alias3` FROM", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -981,10 +933,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having round(msr12+roundedmsr2) <= 1000", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- " SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ " SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -1006,10 +958,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12 > 2 and roundedmsr2 > 0", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
String begin = "select (basecube.alias0) as `dim1`, (basecube.alias1) as `dim11` from";
@@ -1024,10 +976,10 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12 > 2 and roundedmsr2 > 0 and msr2 > 100", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
+ + "0.0 as `alias3` FROM ", null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ", null,
" group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -1043,11 +995,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12+roundedmsr2 <= 1000", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) "
- + "as `alias2`, sum(0.0) as `alias3` FROM ",
+ + "as `alias2`, 0.0 as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -1064,11 +1016,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12 > 2 and roundedmsr2 > 0 and msr12+roundedmsr2 <= 1000", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ",
+ + "0.0 as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
@@ -1086,11 +1038,11 @@ public class TestBaseCubeQueries extends TestQueryRewrite {
+ "having msr12 > 2 or roundedmsr2 > 0 or msr12+roundedmsr2 <= 1000", conf);
expected1 = getExpectedQuery(cubeName,
"SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum((basecube.msr12)) as `alias2`, "
- + "sum(0.0) as `alias3` FROM ",
+ + "0.0 as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact2_BASE"));
expected2 = getExpectedQuery(cubeName,
- "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, sum(0.0) as `alias2`, "
+ "SELECT (basecube.dim1) as `alias0`, (basecube.dim11) as `alias1`, 0.0 as `alias2`, "
+ "sum((basecube.msr2)) as `alias3` FROM ",
null, " group by basecube.dim1, basecube.dim11",
getWhereForDailyAndHourly2days(cubeName, "C1_testFact1_BASE"));
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBetweenTimeRangeWriter.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBetweenTimeRangeWriter.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBetweenTimeRangeWriter.java
index 4331843..5c57781 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBetweenTimeRangeWriter.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBetweenTimeRangeWriter.java
@@ -20,6 +20,7 @@
package org.apache.lens.cube.parse;
import static java.util.Optional.*;
+
import static org.apache.lens.cube.metadata.DateFactory.*;
import static org.apache.lens.cube.metadata.UpdatePeriod.DAILY;
@@ -122,7 +123,7 @@ public class TestBetweenTimeRangeWriter extends TestTimeRangeWriter {
@DataProvider
public Object[][] getBoundTypes() {
- return new Object[][]{{OPEN, OPEN}, {OPEN,CLOSED},{CLOSED,OPEN},{CLOSED,CLOSED}};
+ return new Object[][]{{OPEN, OPEN}, {OPEN, CLOSED}, {CLOSED, OPEN}, {CLOSED, CLOSED}};
}
@Test(dataProvider = "getBoundTypes")
@@ -150,7 +151,8 @@ public class TestBetweenTimeRangeWriter extends TestTimeRangeWriter {
}
- private void validateBetweenBoundTypes(String whereClause, DateFormat format, int testStartOffset, int testEndOffset) {
+ private void validateBetweenBoundTypes(String whereClause, DateFormat format,
+ int testStartOffset, int testEndOffset) {
String expected = getBetweenClause("test", "dt", getDateWithOffset(DAILY, testStartOffset),
getDateWithOffset(DAILY, testEndOffset), ofNullable(format).orElseGet(DAILY::format));
Assert.assertEquals(expected, whereClause);
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBridgeTableQueries.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBridgeTableQueries.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBridgeTableQueries.java
index 2bf1ef8..9fbeb41 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBridgeTableQueries.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestBridgeTableQueries.java
@@ -206,7 +206,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
String query = "select usersports.name, msr2, msr12 from basecube where " + TWO_DAYS_RANGE;
String hqlQuery = rewrite(query, hConf);
String expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) as `alias2` FROM ",
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 as `alias2` FROM ",
" join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -215,7 +215,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " group by user_interests.user_id) usersports" + " on userdim.id = usersports.user_id ", null,
"group by usersports.balias0", null, getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
String expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) as `alias2` FROM ",
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) as `alias2` FROM ",
" join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -238,7 +238,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
query = "select sports, msr2, msr12 from basecube where " + TWO_DAYS_RANGE;
hqlQuery = rewrite(query, hConf);
expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) as `alias2` FROM ",
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 as `alias2` FROM ",
" join " + getDbName() + "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
+ getDbName() + "c1_user_interests_tbl user_interests" + " join " + getDbName()
@@ -246,7 +246,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " group by user_interests.user_id) usersports" + " on userdim.id = usersports.user_id ", null,
"group by usersports.balias0", null, getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -625,7 +625,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " and usersports.name = 'CRICKET'";
String hqlQuery = rewrite(query, hConf);
String expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -635,7 +635,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
" and array_contains(usersports.balias0,'CRICKET') group by usersports.balias0", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
String expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -656,7 +656,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
query = "select sports, msr2, msr12 from basecube where " + TWO_DAYS_RANGE + " and sports = 'CRICKET'";
hqlQuery = rewrite(query, hConf);
expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -666,7 +666,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
"and array_contains(usersports.balias0,'CRICKET') group by usersports.balias0", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as balias0" + " from "
@@ -693,7 +693,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " and usersports.name = 'CRICKET,FOOTBALL'";
String hqlQuery = rewrite(query, conf);
String expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.name) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) as `alias2` FROM ",
+ "SELECT (usersports.name) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 as `alias2` FROM ",
" join " + getDbName() + "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
+ getDbName() + "c1_user_interests_tbl user_interests" + " join " + getDbName()
@@ -702,7 +702,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
" and usersports.name = 'CRICKET,FOOTBALL' group by usersports.name", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
String expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.name) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) as `alias2` FROM ",
+ "SELECT (usersports.name) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) as `alias2` FROM ",
" join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -724,7 +724,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " and sports = 'CRICKET,FOOTBALL'";
hqlQuery = rewrite(query, conf);
expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.name) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT (usersports.name) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -734,7 +734,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
" and usersports.name = 'CRICKET,FOOTBALL' group by usersports.name", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.name) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT (usersports.name) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -878,7 +878,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " and usersports.name in ('CRICKET', 'FOOTBALL')";
String hqlQuery = rewrite(query, hConf);
String expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id, collect_set(substr(usersports.name, 3)) as balias0, "
@@ -890,7 +890,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " group by usersports.balias0", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
String expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) as `alias2` FROM "
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) as `alias2` FROM "
, " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id, collect_set(substr(usersports.name, 3)) as balias0, "
@@ -915,7 +915,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ "('CRICKET', 'FOOTBALL')";
hqlQuery = rewrite(query, hConf);
expected1 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT (usersports.balias0) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id, collect_set(substr((usersports.name), 3)) as balias0, "
@@ -927,7 +927,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " group by usersports.balias0", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
expected2 = getExpectedQuery("basecube",
- "SELECT (usersports.balias0) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT (usersports.balias0) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id, collect_set(substr((usersports.name), 3)) as balias0,"
@@ -957,7 +957,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ " and usersports.name = 'CRICKET,FOOTBALL'";
String hqlQuery = rewrite(query, conf);
String expected1 = getExpectedQuery("basecube",
- "SELECT substr((usersports.name), 3) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT substr((usersports.name), 3) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -967,7 +967,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
" and usersports.name = 'CRICKET,FOOTBALL' group by substr(usersports.name, 3)", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
String expected2 = getExpectedQuery("basecube",
- "SELECT substr((usersports.name), 3) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT substr((usersports.name), 3) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -990,7 +990,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
+ "'CRICKET,FOOTBALL'";
hqlQuery = rewrite(query, conf);
expected1 = getExpectedQuery("basecube",
- "SELECT substr((usersports.name), 3) as `alias0`, sum((basecube.msr2)) as `alias1`, sum(0.0) "
+ "SELECT substr((usersports.name), 3) as `alias0`, sum((basecube.msr2)) as `alias1`, 0.0 "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
@@ -1000,7 +1000,7 @@ public class TestBridgeTableQueries extends TestQueryRewrite {
" and usersports.name = 'CRICKET,FOOTBALL' group by substr(usersports.name, 3)", null,
getWhereForDailyAndHourly2days("basecube", "c1_testfact1_base"));
expected2 = getExpectedQuery("basecube",
- "SELECT substr((usersports.name), 3) as `alias0`, sum(0.0) as `alias1`, sum((basecube.msr12)) "
+ "SELECT substr((usersports.name), 3) as `alias0`, 0.0 as `alias1`, sum((basecube.msr12)) "
+ "as `alias2` FROM ", " join " + getDbName()
+ "c1_usertable userdim ON basecube.userid = userdim.id "
+ " join (select user_interests.user_id as user_id,collect_set(usersports.name) as name" + " from "
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java
index 6c9afdd..bab1080 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java
@@ -30,7 +30,6 @@ import static org.testng.Assert.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
-import java.util.stream.Stream;
import org.apache.lens.cube.error.LensCubeErrorCode;
import org.apache.lens.cube.error.NoCandidateDimAvailableException;
@@ -52,7 +51,6 @@ import org.apache.hadoop.hive.ql.processors.CommandProcessorResponse;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
@@ -79,8 +77,8 @@ public class TestCubeRewriter extends TestQueryRewrite {
@Test
public void testQueryWithNow() throws Exception {
- LensException e = getLensExceptionInRewrite( // rewrites with original time_range_in
- "select SUM(msr2) from testCube where " + getTimeRangeString("NOW - 2DAYS", "NOW"), getConf());
+ LensException e = getLensExceptionInRewrite(
+ "select SUM(msr2) from testCube where " + getTimeRangeString("NOW - 2DAYS", "NOW"), getConf());
assertEquals(e.getErrorCode(), LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo().getErrorCode());
}
@@ -1059,7 +1057,7 @@ public class TestCubeRewriter extends TestQueryRewrite {
pr2.addPruningMsg(new CubeDimensionTable(new Table("test", "citydim")),
CandidateTablePruneCause.expressionNotEvaluable("testexp1", "testexp2"));
NoCandidateDimAvailableException ne2 = new NoCandidateDimAvailableException(pr2);
- assertEquals(ne1.compareTo(ne2), -12);
+ assertEquals(ne1.compareTo(ne2), -7);
}
@Test
@@ -1089,6 +1087,7 @@ public class TestCubeRewriter extends TestQueryRewrite {
new HashMap<String, CandidateTablePruneCause.CandidateTablePruneCode>() {
{
put("c1_statetable", CandidateTablePruneCause.CandidateTablePruneCode.NO_PARTITIONS);
+ put("c6_statetable", CandidateTablePruneCause.CandidateTablePruneCode.UNSUPPORTED_STORAGE);
}
}))
);
@@ -1391,7 +1390,7 @@ public class TestCubeRewriter extends TestQueryRewrite {
Date nextToNextDay = DateUtils.addDays(nextDay, 1);
HashSet<String> storageTables = Sets.newHashSet();
for (StorageCandidate sc : CandidateUtil.getStorageCandidates(candidate)) {
- storageTables.add(sc.getName());
+ storageTables.add(sc.getStorageTable());
}
TreeSet<FactPartition> expectedPartsQueried = Sets.newTreeSet();
for (TimePartition p : Iterables.concat(
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java
index 7874a66..d97c0e6 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestDenormalizationResolver.java
@@ -19,13 +19,13 @@
package org.apache.lens.cube.parse;
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Sets.newHashSet;
-
import static org.apache.lens.cube.metadata.DateFactory.*;
import static org.apache.lens.cube.parse.CandidateTablePruneCause.columnNotFound;
import static org.apache.lens.cube.parse.CubeTestSetup.*;
+import static com.google.common.collect.Lists.newArrayList;
+import static com.google.common.collect.Sets.newHashSet;
+
import java.util.*;
import org.apache.lens.cube.error.NoCandidateFactAvailableException;
@@ -194,7 +194,7 @@ public class TestDenormalizationResolver extends TestQueryRewrite {
"select dim2big2, max(msr3)," + " msr2 from testCube" + " where " + TWO_DAYS_RANGE, tconf);
NoCandidateFactAvailableException ne = (NoCandidateFactAvailableException) e;
PruneCauses.BriefAndDetailedError error = ne.getJsonMessage();
- Assert.assertEquals(error.getBrief(), CandidateTablePruneCode.UNSUPPORTED_STORAGE.errorFormat);
+ Assert.assertEquals(error.getBrief(), CandidateTablePruneCode.INVALID_DENORM_TABLE.errorFormat);
Map<HashSet<String>, List<CandidateTablePruneCause>> enhanced = error.enhanced();
Map<Set<String>, List<CandidateTablePruneCause>> expected = Maps.newHashMap();
@@ -343,7 +343,7 @@ public class TestDenormalizationResolver extends TestQueryRewrite {
CubeQueryContext cubeql = rewriteCtx("select citydim.zipcode, citydim.statename from" + " citydim", tConf);
Set<String> candidateDims = new HashSet<>();
for (CandidateDim cdim : cubeql.getCandidateDims().get(cubeql.getMetastoreClient().getDimension("citydim"))) {
- candidateDims.add(cdim.getName());
+ candidateDims.add(cdim.getStorageTable());
}
// city_table2 contains stateid, but not zipcode - it should have been removed.
Assert.assertFalse(candidateDims.contains("city_table2"));
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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 d4ffefe..d3938c1 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
@@ -19,23 +19,14 @@
package org.apache.lens.cube.parse;
-import static com.google.common.collect.Sets.newHashSet;
import static org.apache.lens.cube.metadata.DateFactory.*;
-import static org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.COLUMN_NOT_FOUND;
-import static org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.PART_COL_DOES_NOT_EXIST;
-import static
- org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.STORAGE_NOT_AVAILABLE_IN_RANGE;
import static org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.TIME_RANGE_NOT_ANSWERABLE;
import static org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.UNSUPPORTED_STORAGE;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
import java.util.*;
-import java.util.stream.Collectors;
-import org.apache.lens.cube.error.NoCandidateFactAvailableException;
-import org.apache.lens.cube.metadata.TimeRange;
import org.apache.lens.server.api.LensConfConstants;
import org.apache.lens.server.api.error.LensException;
@@ -47,7 +38,6 @@ import org.joda.time.DateTime;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import com.google.common.collect.Sets;
public class TestTimeRangeResolver extends TestQueryRewrite {
@@ -72,16 +62,9 @@ public class TestTimeRangeResolver extends TestQueryRewrite {
@Test
public void testFactValidity() throws ParseException, LensException, HiveException, ClassNotFoundException {
- LensException e =
- getLensExceptionInRewrite("select msr2 from " + cubeName + " where " + LAST_YEAR_RANGE,
- getConf());
- NoCandidateFactAvailableException ne = (NoCandidateFactAvailableException) e;
- PruneCauses.BriefAndDetailedError causes = ne.getJsonMessage();
- assertTrue(causes.getBrief().contains("No storages available for all of these time ranges: "
- + "[dt [2016-01-01-00:00:00,000 to 2017-01-01-00:00:00,000)]"), causes.getBrief());
- assertEquals(causes.getDetails().values().stream().flatMap(Collection::stream)
- .map(CandidateTablePruneCause::getCause).collect(Collectors.toSet()), newHashSet(COLUMN_NOT_FOUND,
- PART_COL_DOES_NOT_EXIST, UNSUPPORTED_STORAGE, STORAGE_NOT_AVAILABLE_IN_RANGE));
+ String query = "select msr2 from " + cubeName + " where " + LAST_YEAR_RANGE;
+ LensException e = getLensExceptionInRewrite(query, getConf());
+ assertEquals(e.getErrorInfo().getErrorName(), "NO_UNION_CANDIDATE_AVAILABLE");
}
@Test
@@ -118,14 +101,9 @@ public class TestTimeRangeResolver extends TestQueryRewrite {
Configuration conf = getConf();
DateTime dt = new DateTime(1990, 3, 23, 12, 0, 0, 0);
conf.setLong(LensConfConstants.QUERY_CURRENT_TIME_IN_MILLIS, dt.getMillis());
- NoCandidateFactAvailableException e =
- (NoCandidateFactAvailableException)getLensExceptionInRewrite(
- "select msr12 from basecube where time_range_in(d_time, 'now.day-275days','now')", conf);
- TimeRange timeRange = e.getCubeQueryContext().getTimeRanges().get(0);
- // Month starts from zero.
- Calendar from = new GregorianCalendar(1989, 5, 21, 0, 0, 0);
- assertEquals(timeRange.getFromDate(), from.getTime());
- assertEquals(timeRange.getToDate(), dt.toDate());
+ String query = "select msr12 from basecube where time_range_in(d_time, 'now.day-275days','now')";
+ LensException e = getLensExceptionInRewrite(query, conf);
+ assertEquals(e.getMessage(), "NO_CANDIDATE_FACT_AVAILABLE[Range not answerable]");
}
/**
@@ -137,7 +115,7 @@ public class TestTimeRangeResolver extends TestQueryRewrite {
private static List<CandidateTablePruneCause> findPruningMessagesForStorage(String stoargeName,
PruneCauses<StorageCandidate> allStoragePruningMsgs) {
for (StorageCandidate sc : allStoragePruningMsgs.keySet()) {
- if (sc.getName().equals(stoargeName)) {
+ if (sc.getStorageTable().equals(stoargeName)) {
return allStoragePruningMsgs.get(sc);
}
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionAndJoinCandidates.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionAndJoinCandidates.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionAndJoinCandidates.java
index f5f7f3e..0119f2e 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionAndJoinCandidates.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestUnionAndJoinCandidates.java
@@ -25,8 +25,6 @@ import static org.apache.lens.cube.parse.TestCubeRewriter.compareContains;
import static org.testng.Assert.*;
-import jodd.util.StringUtil;
-import org.apache.hadoop.util.StringUtils;
import org.apache.lens.server.api.LensServerAPITestUtil;
import org.apache.lens.server.api.error.LensException;
@@ -36,6 +34,8 @@ import org.apache.hadoop.hive.ql.parse.ParseException;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
+import jodd.util.StringUtil;
+
public class TestUnionAndJoinCandidates extends TestQueryRewrite {
private Configuration conf;
@@ -76,7 +76,7 @@ public class TestUnionAndJoinCandidates extends TestQueryRewrite {
assertEquals(StringUtil.count(rewrittenQuery, "sum((basecube.union_join_ctx_msr1))"), 2);
}
- @Test
+ @Test
public void testFinalCandidateRewrittenQuery() throws ParseException, LensException {
try {
// Query with non projected measure in having clause.
@@ -85,12 +85,12 @@ public class TestUnionAndJoinCandidates extends TestQueryRewrite {
String whereCond = " union_join_ctx_zipcode = 'a' and union_join_ctx_cityid = 'b' and "
+ "(" + TWO_MONTHS_RANGE_UPTO_DAYS + ")";
String rewrittenQuery = rewrite("select " + colsSelected + " from basecube where " + whereCond + having, conf);
- String expectedInnerSelect1 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, sum(0.0) as `alias1`, "
+ String expectedInnerSelect1 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.union_join_ctx_msr1)) as `alias2` FROM TestQueryRewrite.c1_union_join_ctx_fact1 basecube ";
- String expectedInnerSelect2 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, sum(0.0) as `alias1`, "
+ String expectedInnerSelect2 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, 0.0 as `alias1`, "
+ "sum((basecube.union_join_ctx_msr1)) as `alias2` FROM TestQueryRewrite.c1_union_join_ctx_fact2 basecube ";
String expectedInnerSelect3 = " SELECT (basecube.union_join_ctx_cityid) as `alias0`, "
- + "sum((basecube.union_join_ctx_msr2)) as `alias1`, sum(0.0) as `alias2` "
+ + "sum((basecube.union_join_ctx_msr2)) as `alias1`, 0.0 as `alias2` "
+ "FROM TestQueryRewrite.c1_union_join_ctx_fact3 basecube ";
String outerHaving = "HAVING (sum((basecube.alias2)) > 100)";
compareContains(expectedInnerSelect1, rewrittenQuery);
@@ -111,14 +111,14 @@ public class TestUnionAndJoinCandidates extends TestQueryRewrite {
expectedInnerSelect1 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, (cubecityjoinunionctx.name) "
+ "as `alias1`, case when (basecube.union_join_ctx_cityid) is null then 0 else "
+ "(basecube.union_join_ctx_cityid) end as `alias2`, sum((basecube.union_join_ctx_msr1)) as `alias3`, "
- + "sum(0.0) as `alias4` FROM TestQueryRewrite.c1_union_join_ctx_fact1 basecube";
+ + "0.0 as `alias4` FROM TestQueryRewrite.c1_union_join_ctx_fact1 basecube";
expectedInnerSelect2 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, (cubecityjoinunionctx.name) "
+ "as `alias1`, case when (basecube.union_join_ctx_cityid) is null then 0 else "
+ "(basecube.union_join_ctx_cityid) end as `alias2`, sum((basecube.union_join_ctx_msr1)) as `alias3`, "
- + "sum(0.0) as `alias4` FROM TestQueryRewrite.c1_union_join_ctx_fact2";
+ + "0.0 as `alias4` FROM TestQueryRewrite.c1_union_join_ctx_fact2";
expectedInnerSelect3 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, (cubecityjoinunionctx.name) "
+ "as `alias1`, case when (basecube.union_join_ctx_cityid) is null then 0 else "
- + "(basecube.union_join_ctx_cityid) end as `alias2`, sum(0.0) as `alias3`, "
+ + "(basecube.union_join_ctx_cityid) end as `alias2`, 0.0 as `alias3`, "
+ "sum((basecube.union_join_ctx_msr2)) as `alias4` FROM TestQueryRewrite.c1_union_join_ctx_fact3";
String outerGroupBy = "GROUP BY (basecube.alias0), (basecube.alias1), (basecube.alias2)";
compareContains(outerSelect, rewrittenQuery);
@@ -142,12 +142,12 @@ public class TestUnionAndJoinCandidates extends TestQueryRewrite {
+ "as `(sum(union_join_ctx_msr1) + 10)` FROM ";
expectedInnerSelect1 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, "
+ "(cubecityjoinunionctx.name) as `alias1`, sum((basecube.union_join_ctx_msr1)) as `alias2`, "
- + "sum(0.0) as `alias3`, sum(0.0) as `alias4` FROM";
+ + "0.0 as `alias3`, 0.0 as `alias4` FROM";
expectedInnerSelect2 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, "
+ "(cubecityjoinunionctx.name) as `alias1`, sum((basecube.union_join_ctx_msr1)) as `alias2`, "
- + "sum(0.0) as `alias3`, sum(0.0) as `alias4` FROM";
+ + "0.0 as `alias3`, 0.0 as `alias4` FROM";
expectedInnerSelect3 = "SELECT (basecube.union_join_ctx_cityid) as `alias0`, (cubecityjoinunionctx.name) "
- + "as `alias1`, sum(0.0) as `alias2`, sum((basecube.union_join_ctx_msr2)) as `alias3`, "
+ + "as `alias1`, 0.0 as `alias2`, sum((basecube.union_join_ctx_msr2)) as `alias3`, "
+ "sum(case when ((basecube.union_join_ctx_msr2) > 0) then (basecube.union_join_ctx_msr2) else 0 end) "
+ "as `alias4` FROM";
String innerGroupBy = "GROUP BY (basecube.union_join_ctx_cityid), (cubecityjoinunionctx.name)";
[4/4] lens git commit: Addressed final reviews and fixed checkstyle
error
Posted by su...@apache.org.
Addressed final reviews and fixed checkstyle error
Project: http://git-wip-us.apache.org/repos/asf/lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/cb5e2a77
Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/cb5e2a77
Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/cb5e2a77
Branch: refs/heads/lens-1381
Commit: cb5e2a77dfd09c6736c9b295f68addba6bf27e6e
Parents: 72c20ff
Author: sushilmohanty <su...@apache.org>
Authored: Wed Apr 12 18:10:36 2017 +0530
Committer: sushilmohanty <su...@apache.org>
Committed: Wed Apr 12 18:10:36 2017 +0530
----------------------------------------------------------------------
lens-api/src/main/resources/lens-errors.conf | 13 +
.../lens/cube/error/LensCubeErrorCode.java | 2 +
.../NoCandidateFactAvailableException.java | 13 +-
.../lens/cube/metadata/CubeMetastoreClient.java | 5 +-
.../org/apache/lens/cube/metadata/DateUtil.java | 3 +-
.../lens/cube/metadata/FactPartition.java | 7 +
.../lens/cube/metadata/MetastoreUtil.java | 2 +-
.../apache/lens/cube/metadata/TimeRange.java | 4 +
.../cube/parse/AbridgedTimeRangeWriter.java | 3 -
.../parse/CandidateCoveringSetsResolver.java | 67 ++-
.../apache/lens/cube/parse/CandidateDim.java | 6 +-
.../apache/lens/cube/parse/CandidateTable.java | 2 +-
.../cube/parse/CandidateTablePruneCause.java | 41 +-
.../apache/lens/cube/parse/CandidateUtil.java | 15 +-
.../lens/cube/parse/CubeQueryContext.java | 83 ++--
.../lens/cube/parse/CubeQueryRewriter.java | 3 +-
.../lens/cube/parse/CubeSemanticAnalyzer.java | 3 +-
.../cube/parse/DenormalizationResolver.java | 22 +-
.../lens/cube/parse/ExpressionResolver.java | 3 +-
.../apache/lens/cube/parse/JoinCandidate.java | 2 +-
.../cube/parse/MaxCoveringFactResolver.java | 1 -
.../org/apache/lens/cube/parse/PruneCauses.java | 3 +-
.../lens/cube/parse/StorageCandidate.java | 36 +-
.../lens/cube/parse/StorageTableResolver.java | 20 +-
.../apache/lens/cube/parse/UnionCandidate.java | 24 +-
.../lens/cube/parse/UnionQueryWriter.java | 22 +-
.../apache/lens/driver/cube/RewriterPlan.java | 6 +-
.../apache/lens/cube/parse/CubeTestSetup.java | 25 +-
.../lens/cube/parse/TestAggregateResolver.java | 42 +-
.../lens/cube/parse/TestBaseCubeQueries.java | 226 ++++-----
.../cube/parse/TestBetweenTimeRangeWriter.java | 6 +-
.../lens/cube/parse/TestBridgeTableQueries.java | 40 +-
.../lens/cube/parse/TestCubeRewriter.java | 11 +-
.../cube/parse/TestDenormalizationResolver.java | 10 +-
.../lens/cube/parse/TestTimeRangeResolver.java | 36 +-
.../cube/parse/TestUnionAndJoinCandidates.java | 24 +-
.../lens/cube/parse/TestUnionQueries.java | 464 +++++++------------
.../resources/schema/cubes/base/basecube.xml | 20 +
.../resources/schema/cubes/base/testcube.xml | 23 +
.../resources/schema/cubes/derived/der1.xml | 20 +
.../resources/schema/cubes/derived/der2.xml | 20 +
.../resources/schema/cubes/derived/der3.xml | 20 +
.../schema/cubes/derived/derivedcube.xml | 20 +
.../cubes/derived/union_join_ctx_der1.xml | 20 +
.../resources/schema/dimensions/citydim.xml | 20 +
.../resources/schema/dimensions/countrydim.xml | 20 +
.../resources/schema/dimensions/cycledim1.xml | 20 +
.../resources/schema/dimensions/cycledim2.xml | 20 +
.../test/resources/schema/dimensions/daydim.xml | 20 +
.../resources/schema/dimensions/hourdim.xml | 20 +
.../test/resources/schema/dimensions/sports.xml | 20 +
.../resources/schema/dimensions/statedim.xml | 20 +
.../resources/schema/dimensions/testdim2.xml | 20 +
.../resources/schema/dimensions/testdim3.xml | 20 +
.../resources/schema/dimensions/testdim4.xml | 20 +
.../schema/dimensions/unreachabledim.xml | 20 +
.../schema/dimensions/user_interests.xml | 20 +
.../resources/schema/dimensions/userdim.xml | 20 +
.../test/resources/schema/dimensions/zipdim.xml | 20 +
.../resources/schema/dimtables/citytable.xml | 37 ++
.../resources/schema/dimtables/citytable2.xml | 20 +
.../resources/schema/dimtables/citytable3.xml | 20 +
.../resources/schema/dimtables/citytable4.xml | 20 +
.../resources/schema/dimtables/countrytable.xml | 20 +
.../dimtables/countrytable_partitioned.xml | 20 +
.../resources/schema/dimtables/cycledim1tbl.xml | 20 +
.../resources/schema/dimtables/cycledim2tbl.xml | 20 +
.../resources/schema/dimtables/daydimtbl.xml | 20 +
.../resources/schema/dimtables/hourdimtbl.xml | 20 +
.../resources/schema/dimtables/sports_tbl.xml | 20 +
.../resources/schema/dimtables/statetable.xml | 38 ++
.../schema/dimtables/statetable_partitioned.xml | 20 +
.../resources/schema/dimtables/testdim2tbl.xml | 20 +
.../resources/schema/dimtables/testdim2tbl2.xml | 20 +
.../resources/schema/dimtables/testdim2tbl3.xml | 20 +
.../resources/schema/dimtables/testdim3tbl.xml | 20 +
.../resources/schema/dimtables/testdim4tbl.xml | 20 +
.../schema/dimtables/unreachabledimtable.xml | 20 +
.../schema/dimtables/user_interests_tbl.xml | 20 +
.../resources/schema/dimtables/usertable.xml | 20 +
.../resources/schema/dimtables/ziptable.xml | 20 +
.../test/resources/schema/facts/cheapfact.xml | 20 +
.../test/resources/schema/facts/summary1.xml | 20 +
.../test/resources/schema/facts/summary2.xml | 20 +
.../test/resources/schema/facts/summary3.xml | 20 +
.../test/resources/schema/facts/summary4.xml | 20 +
.../test/resources/schema/facts/testfact.xml | 20 +
.../resources/schema/facts/testfact1_base.xml | 20 +
.../schema/facts/testfact1_raw_base.xml | 20 +
.../test/resources/schema/facts/testfact2.xml | 20 +
.../resources/schema/facts/testfact2_base.xml | 20 +
.../resources/schema/facts/testfact2_raw.xml | 20 +
.../schema/facts/testfact2_raw_base.xml | 20 +
.../resources/schema/facts/testfact3_base.xml | 20 +
.../schema/facts/testfact3_raw_base.xml | 20 +
.../schema/facts/testfact4_raw_base.xml | 20 +
.../resources/schema/facts/testfact5_base.xml | 20 +
.../schema/facts/testfact5_raw_base.xml | 20 +
.../resources/schema/facts/testfact6_base.xml | 20 +
.../schema/facts/testfact_continuous.xml | 20 +
.../schema/facts/testfact_deprecated.xml | 20 +
.../resources/schema/facts/testfactmonthly.xml | 20 +
.../schema/facts/union_join_ctx_fact1.xml | 20 +
.../schema/facts/union_join_ctx_fact2.xml | 20 +
.../schema/facts/union_join_ctx_fact3.xml | 20 +
.../schema/facts/union_join_ctx_fact5.xml | 20 +
.../schema/facts/union_join_ctx_fact6.xml | 20 +
.../src/test/resources/schema/storages/c0.xml | 20 +
.../src/test/resources/schema/storages/c1.xml | 20 +
.../src/test/resources/schema/storages/c2.xml | 20 +
.../src/test/resources/schema/storages/c3.xml | 20 +
.../src/test/resources/schema/storages/c4.xml | 20 +
.../src/test/resources/schema/storages/c5.xml | 20 +
.../src/test/resources/schema/storages/c99.xml | 20 +
.../lens/driver/jdbc/ColumnarSQLRewriter.java | 2 +-
.../lens/driver/jdbc/DruidSQLRewriter.java | 2 +-
.../server/metastore/MetastoreResource.java | 2 +-
117 files changed, 2167 insertions(+), 712 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-api/src/main/resources/lens-errors.conf
----------------------------------------------------------------------
diff --git a/lens-api/src/main/resources/lens-errors.conf b/lens-api/src/main/resources/lens-errors.conf
index 29e24cf..94505ef 100644
--- a/lens-api/src/main/resources/lens-errors.conf
+++ b/lens-api/src/main/resources/lens-errors.conf
@@ -326,6 +326,19 @@ lensCubeErrorsForQuery = [
errorMsg = "Could not find queried table or chain: %s"
}
+ {
+ errorCode = 3034
+ httpStatusCode = ${BAD_REQUEST}
+ errorMsg = "%s does not have any facts that can cover the requested time range : %s and queried measure set : %s"
+ }
+
+ {
+ errorCode = 3035
+ httpStatusCode = ${BAD_REQUEST}
+ errorMsg = "%s does not have any facts that can cover the queried measure set : %s"
+ }
+
+
]
lensCubeErrorsForMetastore = [
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java
index 571b481..d98c4c5 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/error/LensCubeErrorCode.java
@@ -57,6 +57,8 @@ public enum LensCubeErrorCode {
STORAGE_UNION_DISABLED(3031, 1500),
COULD_NOT_PARSE_EXPRESSION(3032, 1500),
QUERIED_TABLE_NOT_FOUND(3033, 0),
+ NO_UNION_CANDIDATE_AVAILABLE(3034, 1501),
+ NO_JOIN_CANDIDATE_AVAILABLE(3035, 1502),
// Error codes greater than 3100 are errors while doing a metastore operation.
ERROR_IN_ENTITY_DEFINITION(3101, 100),
TIMELINE_ABSENT(3102, 100),
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateFactAvailableException.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateFactAvailableException.java b/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateFactAvailableException.java
index 6f08d0f..21dda16 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateFactAvailableException.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateFactAvailableException.java
@@ -28,26 +28,19 @@ import lombok.Getter;
/**
* Note: This class is mainly meant for test cases to assert the detailed reasons (stored in
- * {@link #briefAndDetailedError} and {@link #cubeQueryContext}) leading to "No Candidate was found"
+ * {@link #briefAndDetailedError} leading to "No Candidate was found"
*/
public class NoCandidateFactAvailableException extends LensException {
@Getter
- private final CubeQueryContext cubeQueryContext;
- @Getter
private final PruneCauses<StorageCandidate> briefAndDetailedError;
public NoCandidateFactAvailableException(CubeQueryContext cubeql) {
- this(cubeql.getStoragePruningMsgs().getBriefCause(), cubeql);
- }
-
- public NoCandidateFactAvailableException(String errMsg, CubeQueryContext cubeql) {
- super(LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo(), errMsg);
- this.cubeQueryContext = cubeql;
+ super(LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo(),
+ cubeql.getStoragePruningMsgs().getBriefCause());
this.briefAndDetailedError = cubeql.getStoragePruningMsgs();
}
-
public PruneCauses.BriefAndDetailedError getJsonMessage() {
return briefAndDetailedError.toJsonObject();
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
index b445447..b5c4c89 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/CubeMetastoreClient.java
@@ -422,7 +422,7 @@ public class CubeMetastoreClient {
public TreeMap<UpdatePeriod, CaseInsensitiveStringHashMap<PartitionTimeline>> get(String fact, String storage)
throws HiveException, LensException {
// SUSPEND CHECKSTYLE CHECK DoubleCheckedLockingCheck
- // Unique key for the timeline cache, based on storageName and fact.
+ // Unique key for the timeline cache, based on storage and fact.
String timeLineKey = (Storage.getPrefix(storage)+ fact).toLowerCase();
synchronized (this) {
if (get(timeLineKey) == null) {
@@ -1756,7 +1756,8 @@ public class CubeMetastoreClient {
for (Map.Entry entry : updatePeriodToTableMap.entrySet()) {
XUpdatePeriodTableDescriptor updatePeriodTableDescriptor = new XUpdatePeriodTableDescriptor();
updatePeriodTableDescriptor.setTableDesc(getStorageTableDescFromHiveTable(
- this.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(cft.getName(), (String) entry.getValue()))));
+ this.getHiveTable(MetastoreUtil.getFactOrDimtableStorageTableName(cft.getName(),
+ (String) entry.getValue()))));
updatePeriodTableDescriptor.setUpdatePeriod(XUpdatePeriod.valueOf(((UpdatePeriod)entry.getKey()).name()));
xUpdatePeriods.getUpdatePeriodTableDescriptor().add(updatePeriodTableDescriptor);
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java
index d10d72e..99ad233 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/DateUtil.java
@@ -324,7 +324,8 @@ public final class DateUtil {
}
}
- private static CoveringInfo getMilliSecondCoveringInfo(Date from, Date to, long millisInInterval, UpdatePeriod interval) {
+ private static CoveringInfo getMilliSecondCoveringInfo(Date from, Date to, long millisInInterval,
+ UpdatePeriod interval) {
long diff = to.getTime() - from.getTime();
return new CoveringInfo((int) (diff / millisInInterval),
Stream.of(from, to).allMatch(a->interval.truncate(a).equals(a)));
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/metadata/FactPartition.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/FactPartition.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/FactPartition.java
index b90b569..ed940cc 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/FactPartition.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/FactPartition.java
@@ -64,6 +64,13 @@ public class FactPartition implements Comparable<FactPartition> {
this.storageTables.addAll(storageTables);
}
}
+
+ /**
+ * Partition should not be used a indicative of the class itself.
+ * New Fact partition created includes more final partitions with that creation.
+ * @return
+ */
+
public FactPartition withoutContaining() {
return new FactPartition(this.getPartCol(), this.getPartSpec(), this.getPeriod(), null, this
.getPartFormat(), this.getStorageTables());
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/metadata/MetastoreUtil.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/MetastoreUtil.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/MetastoreUtil.java
index 1e8621d..599027f 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/MetastoreUtil.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/MetastoreUtil.java
@@ -591,7 +591,7 @@ public class MetastoreUtil {
return copy;
}
- public static String getUpdatePeriodStoragePrefixKey(String factTableName , String storageName, String updatePeriod) {
+ public static String getUpdatePeriodStoragePrefixKey(String factTableName, String storageName, String updatePeriod) {
return MetastoreUtil.getFactKeyPrefix(factTableName) + "." + storageName + "." + updatePeriod;
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/metadata/TimeRange.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/TimeRange.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/TimeRange.java
index 242d3ba..8286894 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/TimeRange.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/TimeRange.java
@@ -67,6 +67,10 @@ public class TimeRange {
return timeRange;
}
+ public long milliseconds() {
+ return toDate.getTime() - fromDate.getTime();
+ }
+
public static class TimeRangeBuilder {
private final TimeRange range;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/AbridgedTimeRangeWriter.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/AbridgedTimeRangeWriter.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/AbridgedTimeRangeWriter.java
index 3916a48..10f98a1 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/AbridgedTimeRangeWriter.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/AbridgedTimeRangeWriter.java
@@ -19,12 +19,9 @@
package org.apache.lens.cube.parse;
-import static com.google.common.collect.Sets.newHashSet;
-import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toMap;
import java.util.*;
-import java.util.stream.Collectors;
import org.apache.lens.cube.metadata.FactPartition;
import org.apache.lens.server.api.error.LensException;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateCoveringSetsResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateCoveringSetsResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateCoveringSetsResolver.java
index 0aafda6..b22d972 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateCoveringSetsResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateCoveringSetsResolver.java
@@ -22,7 +22,7 @@ import static org.apache.lens.cube.parse.CandidateUtil.getColumns;
import java.util.*;
-import org.apache.lens.cube.error.NoCandidateFactAvailableException;
+import org.apache.lens.cube.error.LensCubeErrorCode;
import org.apache.lens.cube.metadata.TimeRange;
import org.apache.lens.server.api.error.LensException;
@@ -39,10 +39,9 @@ public class CandidateCoveringSetsResolver implements ContextRewriter {
}
if (cubeql.getCandidates().size() == 0){
- throw new NoCandidateFactAvailableException(cubeql);
+ cubeql.throwNoCandidateFactException();
}
-
List<QueriedPhraseContext> qpcList = cubeql.getQueriedPhrases();
Set<QueriedPhraseContext> queriedMsrs = new HashSet<>();
for (QueriedPhraseContext qpc : qpcList) {
@@ -53,23 +52,19 @@ public class CandidateCoveringSetsResolver implements ContextRewriter {
List<Candidate> timeRangeCoveringSet = resolveTimeRangeCoveringFactSet(cubeql, queriedMsrs, qpcList);
if (timeRangeCoveringSet.isEmpty()) {
- throw new NoCandidateFactAvailableException(cubeql.getCube().getName()
- + " does not have any facts that can cover the requested time range " + cubeql.getTimeRanges().toString()
- + " and queried measure set " + getColumns(queriedMsrs).toString(),
- cubeql);
+ throw new LensException(LensCubeErrorCode.NO_UNION_CANDIDATE_AVAILABLE.getLensErrorInfo(),
+ cubeql.getCube().getName(), cubeql.getTimeRanges().toString(), getColumns(queriedMsrs).toString());
}
log.info("Time covering candidates :{}", timeRangeCoveringSet);
if (queriedMsrs.isEmpty()) {
cubeql.getCandidates().clear();
cubeql.getCandidates().addAll(timeRangeCoveringSet);
- } else {
+ } else if (!timeRangeCoveringSet.isEmpty()) {
List<List<Candidate>> measureCoveringSets = resolveJoinCandidates(timeRangeCoveringSet, queriedMsrs, cubeql);
if (measureCoveringSets.isEmpty()) {
- throw new NoCandidateFactAvailableException(cubeql.getCube().getName()
- + " does not have any facts that can cover the queried measure set "
- + getColumns(queriedMsrs).toString(),
- cubeql);
+ throw new LensException(LensCubeErrorCode.NO_JOIN_CANDIDATE_AVAILABLE.getLensErrorInfo(),
+ cubeql.getCube().getName(), getColumns(queriedMsrs).toString());
}
updateFinalCandidates(measureCoveringSets, cubeql);
}
@@ -123,14 +118,15 @@ public class CandidateCoveringSetsResolver implements ContextRewriter {
private List<Candidate> resolveTimeRangeCoveringFactSet(CubeQueryContext cubeql,
Set<QueriedPhraseContext> queriedMsrs, List<QueriedPhraseContext> qpcList) throws LensException {
- // All Candidates
- List<Candidate> allCandidates = new ArrayList<>(cubeql.getCandidates());
- // Partially valid candidates
- List<Candidate> allCandidatesPartiallyValid = new ArrayList<>();
List<Candidate> candidateSet = new ArrayList<>();
- for (Candidate cand : allCandidates) {
- // Assuming initial list of candidates populated are StorageCandidate
- if (cand instanceof StorageCandidate) {
+ if (!cubeql.getCandidates().isEmpty()) {
+ // All Candidates
+ List<Candidate> allCandidates = new ArrayList<>(cubeql.getCandidates());
+ // Partially valid candidates
+ List<Candidate> allCandidatesPartiallyValid = new ArrayList<>();
+ for (Candidate cand : allCandidates) {
+ // Assuming initial list of candidates populated are StorageCandidate
+ assert (cand instanceof StorageCandidate);
StorageCandidate sc = (StorageCandidate) cand;
if (CandidateUtil.isValidForTimeRanges(sc, cubeql.getTimeRanges())) {
candidateSet.add(CandidateUtil.cloneStorageCandidate(sc));
@@ -138,26 +134,25 @@ public class CandidateCoveringSetsResolver implements ContextRewriter {
allCandidatesPartiallyValid.add(CandidateUtil.cloneStorageCandidate(sc));
} else {
cubeql.addCandidatePruningMsg(sc, CandidateTablePruneCause.storageNotAvailableInRange(
- cubeql.getTimeRanges()));
+ cubeql.getTimeRanges()));
}
- } else {
- throw new LensException("Not a StorageCandidate!!");
+
}
+ // Get all covering fact sets
+ List<UnionCandidate> unionCoveringSet =
+ getCombinations(new ArrayList<>(allCandidatesPartiallyValid), cubeql);
+ // Sort the Collection based on no of elements
+ unionCoveringSet.sort(new CandidateUtil.ChildrenSizeBasedCandidateComparator<UnionCandidate>());
+ // prune non covering sets
+ pruneUnionCandidatesNotCoveringAllRanges(unionCoveringSet, cubeql);
+ // prune candidate set which doesn't contain any common measure i
+ pruneUnionCoveringSetWithoutAnyCommonMeasure(unionCoveringSet, queriedMsrs, cubeql);
+ // prune redundant covering sets
+ pruneRedundantUnionCoveringSets(unionCoveringSet);
+ // pruing done in the previous steps, now create union candidates
+ candidateSet.addAll(unionCoveringSet);
+ updateQueriableMeasures(candidateSet, qpcList, cubeql);
}
- // Get all covering fact sets
- List<UnionCandidate> unionCoveringSet =
- getCombinations(new ArrayList<>(allCandidatesPartiallyValid), cubeql);
- // Sort the Collection based on no of elements
- unionCoveringSet.sort(new CandidateUtil.ChildrenSizeBasedCandidateComparator<UnionCandidate>());
- // prune non covering sets
- pruneUnionCandidatesNotCoveringAllRanges(unionCoveringSet, cubeql);
- // prune candidate set which doesn't contain any common measure i
- pruneUnionCoveringSetWithoutAnyCommonMeasure(unionCoveringSet, queriedMsrs, cubeql);
- // prune redundant covering sets
- pruneRedundantUnionCoveringSets(unionCoveringSet);
- // pruing done in the previous steps, now create union candidates
- candidateSet.addAll(unionCoveringSet);
- updateQueriableMeasures(candidateSet, qpcList, cubeql);
return candidateSet;
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateDim.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateDim.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateDim.java
index 0dde72d..ce734cf 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateDim.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateDim.java
@@ -38,7 +38,7 @@ public class CandidateDim implements CandidateTable {
final CubeDimensionTable dimtable;
@Getter
@Setter
- private String storageName;
+ private String storageTable;
@Getter
@Setter
private String whereClause;
@@ -73,11 +73,11 @@ public class CandidateDim implements CandidateTable {
String database = SessionState.get().getCurrentDatabase();
// Add database name prefix for non default database
if (StringUtils.isNotBlank(database) && !"default".equalsIgnoreCase(database)) {
- storageName = database + "." + storageName;
+ storageTable = database + "." + storageTable;
}
dbResolved = true;
}
- return storageName + " " + alias;
+ return storageTable + " " + alias;
}
@Override
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTable.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTable.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTable.java
index 168dcc6..c909545 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTable.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTable.java
@@ -40,7 +40,7 @@ public interface CandidateTable {
* Get storage table corresponding to this candidate
* @return
*/
- String getStorageName();
+ String getStorageTable();
/**
* Get candidate table
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java
index 1de491c..1c0d356 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java
@@ -18,16 +18,17 @@
*/
package org.apache.lens.cube.parse;
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.common.collect.Lists.partition;
import static java.util.stream.Collectors.toSet;
+
import static org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode.*;
+import static com.google.common.collect.Lists.newArrayList;
+
import java.util.*;
-import java.util.stream.Stream;
import org.apache.lens.cube.metadata.TimeRange;
+
import org.codehaus.jackson.annotate.JsonWriteNullProperties;
import com.google.common.collect.Lists;
@@ -47,7 +48,17 @@ public class CandidateTablePruneCause {
public enum CandidateTablePruneCode {
// other fact set element is removed
ELEMENT_IN_SET_PRUNED("Other candidate from measure covering set is pruned"),
-
+ // least weight not satisfied
+ MORE_WEIGHT("Picked table had more weight than minimum."),
+ // partial data is enabled, another fact has more data.
+ LESS_DATA("Picked table has less data than the maximum"),
+ // cube table has more partitions
+ MORE_PARTITIONS("Picked table has more partitions than minimum"),
+ // storage is not supported by execution engine/driver
+ UNSUPPORTED_STORAGE("Unsupported Storage"),
+ // invalid cube table
+ INVALID("Invalid cube table provided in query"),
+ // expression is not evaluable in the candidate
COLUMN_NOT_FOUND("%s are not %s") {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
if (causes.size() == 1) {
@@ -81,9 +92,6 @@ public class CandidateTablePruneCause {
PART_COL_DOES_NOT_EXIST("Partition column does not exist"),
// Range is not supported by this storage table
TIME_RANGE_NOT_ANSWERABLE("Range not answerable"),
- // storage is not supported by execution engine/driver
- UNSUPPORTED_STORAGE("Unsupported Storage"),
-
STORAGE_NOT_AVAILABLE_IN_RANGE("No storages available for all of these time ranges: %s") {
@Override
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
@@ -94,20 +102,11 @@ public class CandidateTablePruneCause {
}
},
- // least weight not satisfied
- MORE_WEIGHT("Picked table had more weight than minimum."),
- // partial data is enabled, another fact has more data.
- LESS_DATA("Picked table has less data than the maximum"),
- // cube table has more partitions
- MORE_PARTITIONS("Picked table has more partitions than minimum"),
- // invalid cube table
- INVALID("Invalid cube table provided in query"), //TODO move up. This does not make sense here.
- // expression is not evaluable in the candidate
EXPRESSION_NOT_EVALUABLE("%s expressions not evaluable") {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
return new String[]{
causes.stream().map(CandidateTablePruneCause::getMissingExpressions).flatMap(Collection::stream)
- .collect(toSet()).toString()
+ .collect(toSet()).toString(),
};
}
},
@@ -154,7 +153,7 @@ public class CandidateTablePruneCause {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
return new String[]{
causes.stream().map(CandidateTablePruneCause::getJoinColumns).flatMap(Collection::stream)
- .collect(toSet()).toString()
+ .collect(toSet()).toString(),
};
}
},
@@ -164,7 +163,7 @@ public class CandidateTablePruneCause {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
return new String[]{
causes.stream().map(CandidateTablePruneCause::getColumnsMissingDefaultAggregate).flatMap(Collection::stream)
- .collect(toSet()).toString()
+ .collect(toSet()).toString(),
};
}
},
@@ -172,7 +171,7 @@ public class CandidateTablePruneCause {
MISSING_PARTITIONS("Missing partitions for the cube table: %s") {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
return new String[]{
- causes.stream().map(CandidateTablePruneCause::getMissingPartitions).collect(toSet()).toString()
+ causes.stream().map(CandidateTablePruneCause::getMissingPartitions).collect(toSet()).toString(),
};
}
},
@@ -181,7 +180,7 @@ public class CandidateTablePruneCause {
+ " %s. Please try again later or rerun after removing incomplete metrics") {
Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) {
return new String[]{
- causes.stream().map(CandidateTablePruneCause::getIncompletePartitions).collect(toSet()).toString()
+ causes.stream().map(CandidateTablePruneCause::getIncompletePartitions).collect(toSet()).toString(),
};
}
};
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateUtil.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateUtil.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateUtil.java
index 5db1344..b9ff0ef 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateUtil.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateUtil.java
@@ -40,7 +40,12 @@ import com.google.common.collect.TreeRangeSet;
/**
* Placeholder for Util methods that will be required for {@link Candidate}
*/
-public class CandidateUtil {
+public final class CandidateUtil {
+
+ private CandidateUtil() {
+ // Added due to checkstyle error getting below :
+ // (design) HideUtilityClassConstructor: Utility classes should not have a public or default constructor.
+ }
/**
* Returns true if the Candidate is valid for all the timeranges based on its start and end times.
@@ -217,10 +222,12 @@ public class CandidateUtil {
return false;
}
- public static String getTimeRangeWhereClasue(TimeRangeWriter rangeWriter, StorageCandidate sc, TimeRange range) throws LensException {
- String rangeWhere = rangeWriter.getTimeRangeWhereClause(sc.getCubeql(), sc.getCubeql().getAliasForTableName(sc.getCube().getName()),
+ public static String getTimeRangeWhereClasue(TimeRangeWriter rangeWriter,
+ StorageCandidate sc, TimeRange range) throws LensException {
+ String rangeWhere = rangeWriter.getTimeRangeWhereClause(sc.getCubeql(),
+ sc.getCubeql().getAliasForTableName(sc.getCube().getName()),
sc.getRangeToPartitions().get(range));
- if(sc.getRangeToExtraWhereFallBack().containsKey(range)){
+ if (sc.getRangeToExtraWhereFallBack().containsKey(range)) {
rangeWhere = "((" + rangeWhere + ") and (" + sc.getRangeToExtraWhereFallBack().get(range) + "))";
}
return rangeWhere;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryContext.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryContext.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryContext.java
index 193bf44..c63c4c0 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryContext.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryContext.java
@@ -19,27 +19,18 @@
package org.apache.lens.cube.parse;
-import static com.google.common.base.Preconditions.checkArgument;
+
import static java.util.stream.Collectors.toSet;
+
+import static org.apache.lens.cube.parse.CubeQueryConfUtil.*;
+
import static org.apache.hadoop.hive.ql.parse.HiveParser.*;
-import static org.apache.lens.cube.parse.CubeQueryConfUtil.DEFAULT_REPLACE_TIMEDIM_WITH_PART_COL;
-import static org.apache.lens.cube.parse.CubeQueryConfUtil.DEFAULT_REWRITE_DIM_FILTER_TO_FACT_FILTER;
-import static org.apache.lens.cube.parse.CubeQueryConfUtil.NON_EXISTING_PARTITIONS;
-import static org.apache.lens.cube.parse.CubeQueryConfUtil.REPLACE_TIMEDIM_WITH_PART_COL;
-import static org.apache.lens.cube.parse.CubeQueryConfUtil.REWRITE_DIM_FILTER_TO_FACT_FILTER;
+
+import static com.google.common.base.Preconditions.checkArgument;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
import java.util.function.Predicate;
import org.apache.lens.cube.error.LensCubeErrorCode;
@@ -59,15 +50,7 @@ import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.ql.Context;
import org.apache.hadoop.hive.ql.lib.Node;
import org.apache.hadoop.hive.ql.metadata.HiveException;
-import org.apache.hadoop.hive.ql.parse.ASTNode;
-import org.apache.hadoop.hive.ql.parse.HiveParser;
-import org.apache.hadoop.hive.ql.parse.JoinCond;
-import org.apache.hadoop.hive.ql.parse.ParseDriver;
-import org.apache.hadoop.hive.ql.parse.ParseException;
-import org.apache.hadoop.hive.ql.parse.ParseUtils;
-import org.apache.hadoop.hive.ql.parse.QB;
-import org.apache.hadoop.hive.ql.parse.QBJoinTree;
-import org.apache.hadoop.hive.ql.parse.QBParseInfo;
+import org.apache.hadoop.hive.ql.parse.*;
import org.apache.hadoop.util.ReflectionUtils;
import org.codehaus.jackson.map.ObjectMapper;
@@ -75,11 +58,7 @@ import org.codehaus.jackson.map.ObjectMapper;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
+import lombok.*;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@@ -756,7 +735,7 @@ public class CubeQueryContext extends TracksQueriedColumns implements QueryAST,
}
} else { // (joinTree.getBaseSrc()[0] != null){
String alias = joinTree.getBaseSrc()[0].toLowerCase();
- builder.append(getStorageStringWithAlias(candidate , dimsToQuery, alias));
+ builder.append(getStorageStringWithAlias(candidate, dimsToQuery, alias));
joiningTables.add(alias);
}
if (joinTree.getJoinCond() != null) {
@@ -854,23 +833,37 @@ public class CubeQueryContext extends TracksQueriedColumns implements QueryAST,
if (hasCubeInQuery()) {
if (candidates.size() > 0) {
cand = candidates.iterator().next();
- log.info("Available Candidates:{}, picking up Candaidate: {} for querying", candidates, cand);
+ log.info("Available Candidates:{}, picking up Candidate: {} for querying", candidates, cand);
} else {
- if (!storagePruningMsgs.isEmpty()) {
- try(ByteArrayOutputStream out = new ByteArrayOutputStream()) {
- ObjectMapper mapper = new ObjectMapper();
- mapper.writeValue(out, storagePruningMsgs.getJsonObject());
- log.info("No candidate found because: {}", out.toString("UTF-8"));
- } catch (Exception e) {
- throw new LensException("Error writing fact pruning messages", e);
+ throwNoCandidateFactException();
+ }
+ }
+ return cand;
+ }
+
+ void throwNoCandidateFactException() throws LensException {
+ String reason = "";
+ if (!storagePruningMsgs.isEmpty()) {
+ ByteArrayOutputStream out = null;
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ out = new ByteArrayOutputStream();
+ mapper.writeValue(out, storagePruningMsgs.getJsonObject());
+ reason = out.toString("UTF-8");
+ } catch (Exception e) {
+ throw new LensException("Error writing fact pruning messages", e);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ throw new LensException(e);
}
}
- log.error("Query rewrite failed due to NO_CANDIDATE_FACT_AVAILABLE, Cause {}",
- storagePruningMsgs.toJsonObject());
- throw new NoCandidateFactAvailableException(this);
}
}
- return cand;
+ log.error("Query rewrite failed due to NO_CANDIDATE_FACT_AVAILABLE, Cause {}", storagePruningMsgs.toJsonObject());
+ throw new NoCandidateFactAvailableException(this);
}
private HQLContextInterface hqlContext;
@@ -1026,8 +1019,8 @@ public class CubeQueryContext extends TracksQueriedColumns implements QueryAST,
//update dim filter with fact filter, set where string in sc
if (scSet.size() > 0) {
for (StorageCandidate sc : scSet) {
- String qualifiedStorageTable = sc.getStorageName();
- String storageTable = qualifiedStorageTable.substring(qualifiedStorageTable.indexOf(".") + 1); //TODO this looks useless
+ String qualifiedStorageTable = sc.getStorageTable();
+ String storageTable = qualifiedStorageTable.substring(qualifiedStorageTable.indexOf(".") + 1);
String where = getWhere(sc, autoJoinCtx,
sc.getQueryAst().getWhereAST(), getAliasForTableName(sc.getBaseTable().getName()),
shouldReplaceDimFilterWithFactFilter(), storageTable, dimsToQuery);
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryRewriter.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryRewriter.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryRewriter.java
index 300d134..6bee386 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryRewriter.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeQueryRewriter.java
@@ -208,7 +208,7 @@ public class CubeQueryRewriter {
public CubeQueryContext rewrite(ASTNode astnode) throws LensException {
CubeSemanticAnalyzer analyzer;
try {
- analyzer = new CubeSemanticAnalyzer(hconf);
+ analyzer = new CubeSemanticAnalyzer(conf, hconf);
analyzer.analyze(astnode, qlCtx);
} catch (SemanticException e) {
throw new LensException(SYNTAX_ERROR.getLensErrorInfo(), e, e.getMessage());
@@ -244,6 +244,7 @@ public class CubeQueryRewriter {
*/
MethodMetricsContext mgauge = MethodMetricsFactory.createMethodGauge(ctx.getConf(), true,
rewriter.getClass().getCanonicalName() + ITER_STR + i);
+
rewriter.rewriteContext(ctx);
mgauge.markSuccess();
i++;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeSemanticAnalyzer.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeSemanticAnalyzer.java
index 8214f65..e2015c2 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeSemanticAnalyzer.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CubeSemanticAnalyzer.java
@@ -22,6 +22,7 @@ package org.apache.lens.cube.parse;
import java.util.ArrayList;
import java.util.List;
+import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.ql.QueryState;
import org.apache.hadoop.hive.ql.parse.*;
@@ -36,7 +37,7 @@ public class CubeSemanticAnalyzer extends SemanticAnalyzer {
@Getter
private QB cubeQB;
- public CubeSemanticAnalyzer(HiveConf hiveConf) throws SemanticException {
+ public CubeSemanticAnalyzer(Configuration queryConf, HiveConf hiveConf) throws SemanticException {
super(new QueryState(hiveConf));
setupRules();
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/DenormalizationResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/DenormalizationResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/DenormalizationResolver.java
index e5cf916..30fa873 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/DenormalizationResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/DenormalizationResolver.java
@@ -18,10 +18,10 @@
*/
package org.apache.lens.cube.parse;
+import static org.apache.lens.cube.parse.CandidateTablePruneCause.denormColumnNotFound;
+
import static org.apache.hadoop.hive.ql.parse.HiveParser.Identifier;
import static org.apache.hadoop.hive.ql.parse.HiveParser.TOK_TABLE_OR_COL;
-import static org.apache.hadoop.hive.ql.parse.HiveParser_SelectClauseParser.TOK_FUNCTION;
-import static org.apache.lens.cube.parse.CandidateTablePruneCause.denormColumnNotFound;
import java.util.*;
@@ -109,7 +109,8 @@ public class DenormalizationResolver implements ContextRewriter {
// there is no path
// to the source table
log.info("Adding denormalized column for column:{} for table:{}", col, table);
- tableToRefCols.computeIfAbsent(table.getName(), k -> new HashSet<>()).add(refer);
+ String name = (table instanceof CandidateDim) ? table.getName() : table.getStorageTable();
+ tableToRefCols.computeIfAbsent(name, k -> new HashSet<>()).add(refer);
// Add to optional tables
for (ChainRefCol refCol : refer.col.getChainRefColumns()) {
cubeql.addOptionalDimTable(refCol.getChainName(), table, false, refer.col.getName(), true,
@@ -146,7 +147,7 @@ public class DenormalizationResolver implements ContextRewriter {
if (!tableToRefCols.isEmpty()) {
// pick referenced columns for fact
if (sc != null) {
- pickColumnsForTable(cubeql, sc.getName());
+ pickColumnsForTable(cubeql, sc.getStorageTable());
}
// pick referenced columns for dimensions
if (dimsToQuery != null) {
@@ -178,7 +179,7 @@ public class DenormalizationResolver implements ContextRewriter {
if (!tableToRefCols.isEmpty()) {
// pick referenced columns for fact
if (sc != null) {
- pickColumnsForTable(cubeql, sc.getName());
+ pickColumnsForTable(cubeql, sc.getStorageTable());
}
// pick referenced columns for dimensions
if (dimsToQuery != null) {
@@ -203,7 +204,7 @@ public class DenormalizationResolver implements ContextRewriter {
}
// checks if the reference if picked for facts and dimsToQuery passed
private boolean isPickedFor(PickedReference picked, StorageCandidate sc, Map<Dimension, CandidateDim> dimsToQuery) {
- if (sc != null && picked.pickedFor.equalsIgnoreCase(sc.getName())) {
+ if (sc != null && picked.pickedFor.equalsIgnoreCase(sc.getStorageTable())) {
return true;
}
if (dimsToQuery != null) {
@@ -263,10 +264,11 @@ public class DenormalizationResolver implements ContextRewriter {
}
}
- private void replaceReferencedColumns(CubeQueryContext cubeql, StorageCandidate sc, boolean replaceFact) throws LensException {
+ private void replaceReferencedColumns(CubeQueryContext cubeql, StorageCandidate sc, boolean replaceFact)
+ throws LensException {
QueryAST ast = cubeql;
- boolean factRefExists = sc != null && tableToRefCols.get(sc.getName()) != null && !tableToRefCols.get(sc
- .getName()).isEmpty();
+ boolean factRefExists = sc != null && tableToRefCols.get(sc.getStorageTable()) != null
+ && !tableToRefCols.get(sc.getStorageTable()).isEmpty();
if (replaceFact && factRefExists) {
ast = sc.getQueryAst();
}
@@ -395,7 +397,7 @@ public class DenormalizationResolver implements ContextRewriter {
for (Iterator<StorageCandidate> i =
CandidateUtil.getStorageCandidates(cubeql.getCandidates()).iterator(); i.hasNext();) {
StorageCandidate candidate = i.next();
- Set<String> nonReachableFields = denormCtx.getNonReachableReferenceFields(candidate.getName());
+ Set<String> nonReachableFields = denormCtx.getNonReachableReferenceFields(candidate.getStorageTable());
if (!nonReachableFields.isEmpty()) {
log.info("Not considering fact table:{} as columns {} are not available", candidate, nonReachableFields);
cubeql.addCandidatePruningMsg(candidate, denormColumnNotFound(nonReachableFields));
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java
index 97a9ef0..926a4d0 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/ExpressionResolver.java
@@ -378,7 +378,8 @@ class ExpressionResolver implements ContextRewriter {
return ec.isEvaluable(cTable);
}
- Set<Dimension> rewriteExprCtx(CubeQueryContext cubeql, StorageCandidate sc, Map<Dimension, CandidateDim> dimsToQuery,
+ Set<Dimension> rewriteExprCtx(CubeQueryContext cubeql, StorageCandidate sc,
+ Map<Dimension, CandidateDim> dimsToQuery,
QueryAST queryAST) throws LensException {
Set<Dimension> exprDims = new HashSet<Dimension>();
log.info("Picking expressions for candidate {} ", sc);
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/JoinCandidate.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/JoinCandidate.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/JoinCandidate.java
index 6334062..52085ea 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/JoinCandidate.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/JoinCandidate.java
@@ -137,6 +137,6 @@ public class JoinCandidate implements Candidate {
}
private String getToString() {
- return this.toStr = "JOIN[" + childCandidate1.toString() + ", " + childCandidate2.toString() + "]";
+ return "JOIN[" + childCandidate1.toString() + ", " + childCandidate2.toString() + "]";
}
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/MaxCoveringFactResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/MaxCoveringFactResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/MaxCoveringFactResolver.java
index 0a24460..34180d1 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/MaxCoveringFactResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/MaxCoveringFactResolver.java
@@ -95,7 +95,6 @@ class MaxCoveringFactResolver implements ContextRewriter {
}
}
}
- //cubeql.pruneCandidateFactWithCandidateSet(CandidateTablePruneCause.lessData(null));
}
private void resolveByDataCompleteness(CubeQueryContext cubeql) {
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/PruneCauses.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/PruneCauses.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/PruneCauses.java
index 50ccab5..0996db5 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/PruneCauses.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/PruneCauses.java
@@ -18,9 +18,10 @@
*/
package org.apache.lens.cube.parse;
-import static com.google.common.collect.Sets.newHashSet;
import static java.util.stream.Collectors.toMap;
+import static com.google.common.collect.Sets.newHashSet;
+
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
index 628e9aa..d95cf27 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageCandidate.java
@@ -29,7 +29,6 @@ import static org.apache.lens.cube.parse.StorageUtil.processExpressionsForComple
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
-import java.util.stream.Collectors;
import org.apache.lens.cube.metadata.AbstractCubeTable;
import org.apache.lens.cube.metadata.CubeFactTable;
@@ -51,7 +50,6 @@ import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.parse.ASTNode;
import org.apache.hadoop.hive.ql.parse.HiveParser;
import org.apache.hadoop.hive.ql.session.SessionState;
-import org.apache.hadoop.util.ReflectionUtils;
import org.antlr.runtime.CommonToken;
@@ -120,6 +118,8 @@ public class StorageCandidate implements Candidate, CandidateTable {
@Getter
private String storageName;
@Getter
+ private String storageTable;
+ @Getter
@Setter
private QueryAST queryAst;
@Getter
@@ -190,8 +190,9 @@ public class StorageCandidate implements Candidate, CandidateTable {
this.fact = fact;
this.cubeql = cubeql;
this.storageName = storageName;
+ this.storageTable = MetastoreUtil.getFactOrDimtableStorageTableName(fact.getName(), storageName);
this.conf = cubeql.getConf();
- this.name = MetastoreUtil.getFactOrDimtableStorageTableName(fact.getName(), storageName);
+ this.name = fact.getName();
this.processTimePartCol = conf.get(CubeQueryConfUtil.PROCESS_TIME_PART_COL);
String formatStr = conf.get(CubeQueryConfUtil.PART_WHERE_CLAUSE_DATE_FORMAT);
if (formatStr != null) {
@@ -205,8 +206,8 @@ public class StorageCandidate implements Candidate, CandidateTable {
if (storageTblNames.size() > 1) {
isStorageTblsAtUpdatePeriodLevel = true;
} else {
- //if this.name is equal to the storage table name it implies isStorageTblsAtUpdatePeriodLevel is false
- isStorageTblsAtUpdatePeriodLevel = !storageTblNames.iterator().next().equalsIgnoreCase(name);
+ //if this.storageTable is equal to the storage table name it implies isStorageTblsAtUpdatePeriodLevel is false
+ isStorageTblsAtUpdatePeriodLevel = !storageTblNames.iterator().next().equalsIgnoreCase(storageTable);
}
setStorageStartAndEndDate();
}
@@ -417,8 +418,8 @@ public class StorageCandidate implements Candidate, CandidateTable {
private void updatePartitionStorage(FactPartition part) throws LensException {
try {
- if (client.factPartitionExists(fact, part, name)) {
- part.getStorageTables().add(name);
+ if (client.factPartitionExists(fact, part, storageTable)) {
+ part.getStorageTables().add(storageTable);
part.setFound(true);
}
} catch (HiveException e) {
@@ -478,7 +479,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
}
if (!client.partColExists(this.getFact().getName(), storageName, partCol)) {
- log.info("{} does not exist in {}", partCol, name);
+ log.info("{} does not exist in {}", partCol, storageTable);
return false;
}
@@ -488,7 +489,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
TreeSet<UpdatePeriod> remainingIntervals = new TreeSet<>(updatePeriods);
remainingIntervals.remove(maxInterval);
if (!CandidateUtil.isCandidatePartiallyValidForTimeRange(
- maxIntervalStorageTblStartDate, maxIntervalStorageTblEndDate,fromDate, toDate)) {
+ maxIntervalStorageTblStartDate, maxIntervalStorageTblEndDate, fromDate, toDate)) {
//Check the time range in remainingIntervals as maxInterval is not useful
return getPartitions(fromDate, toDate, partCol, partitions, remainingIntervals,
addNonExistingParts, failOnPartialData, missingPartitions);
@@ -498,7 +499,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
? fromDate : maxIntervalStorageTblStartDate, maxInterval);
Date floorToDate = DateUtil.getFloorDate(toDate.before(maxIntervalStorageTblEndDate)
? toDate : maxIntervalStorageTblEndDate, maxInterval);
- if(ceilFromDate.equals(floorToDate) || floorToDate.before(ceilFromDate)) {
+ if (ceilFromDate.equals(floorToDate) || floorToDate.before(ceilFromDate)) {
return getPartitions(fromDate, toDate, partCol, partitions, remainingIntervals,
addNonExistingParts, failOnPartialData, missingPartitions);
}
@@ -623,7 +624,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
Set<FactPartition> rangeParts = getPartitions(timeRange, validUpdatePeriods, true, failOnPartialData, missingParts);
String partCol = timeRange.getPartitionColumn();
boolean partColNotSupported = rangeParts.isEmpty();
- String storageTableName = getName();
+ String storageTableName = getStorageTable();
if (storagePruningMsgs.containsKey(this)) {
List<CandidateTablePruneCause> causes = storagePruningMsgs.get(this);
@@ -813,13 +814,13 @@ public class StorageCandidate implements Candidate, CandidateTable {
StorageCandidate storageCandidateObj = (StorageCandidate) obj;
//Assuming that same instance of cube and fact will be used across StorageCandidate s and hence relying directly
//on == check for these.
- return (this.cube == storageCandidateObj.cube && this.fact == storageCandidateObj.fact && this.name
- .equals(storageCandidateObj.name));
+ return (this.cube == storageCandidateObj.cube && this.fact == storageCandidateObj.fact && this.storageTable
+ .equals(storageCandidateObj.storageTable));
}
@Override
public int hashCode() {
- return this.name.hashCode();
+ return this.storageTable.hashCode();
}
@Override
@@ -879,8 +880,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
private boolean isUpdatePeriodUseful(TimeRange timeRange, UpdatePeriod updatePeriod) {
try {
if (!CandidateUtil.isCandidatePartiallyValidForTimeRange(getStorageTableStartDate(updatePeriod),
- getStorageTableEndDate(updatePeriod), timeRange.getFromDate(), timeRange.getToDate()))
- {
+ getStorageTableEndDate(updatePeriod), timeRange.getFromDate(), timeRange.getToDate())) {
return false;
}
Date storageTblStartDate = getStorageTableStartDate(updatePeriod);
@@ -983,7 +983,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
public String getResolvedName() {
if (resolvedName == null) {
- return name;
+ return storageTable;
}
return resolvedName;
}
@@ -1009,7 +1009,7 @@ public class StorageCandidate implements Candidate, CandidateTable {
updatePeriodSpecificSc = new StorageCandidate(this);
updatePeriodSpecificSc.truncatePartitions(period);
updatePeriodSpecificSc.setResolvedName(client.getStorageTableName(fact.getName(),
- storageName, period));
+ storageName, period));
periodSpecificScList.add(updatePeriodSpecificSc);
}
return periodSpecificScList;
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
index 1a2d9a9..10c3bbe 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/StorageTableResolver.java
@@ -134,8 +134,7 @@ class StorageTableResolver implements ContextRewriter {
}
if (!isTimeRangeAnswerableByThisCandidate) {
candidateIterator.remove();
- }
- else if (failOnPartialData && !isComplete) {
+ } else if (failOnPartialData && !isComplete) {
candidateIterator.remove();
log.info("Not considering candidate:{} as its data is not is not complete", candidate);
Set<StorageCandidate> scSet = CandidateUtil.getStorageCandidates(candidate);
@@ -228,8 +227,8 @@ class StorageTableResolver implements ContextRewriter {
continue;
}
// pick the first storage table
- candidate.setStorageName(storageTables.iterator().next());
- candidate.setWhereClause(whereClauses.get(candidate.getStorageName()));
+ candidate.setStorageTable(storageTables.iterator().next());
+ candidate.setWhereClause(whereClauses.get(candidate.getStorageTable()));
}
}
}
@@ -262,7 +261,7 @@ class StorageTableResolver implements ContextRewriter {
String str = conf.get(CubeQueryConfUtil.getValidStorageTablesKey(sc.getFact().getName()));
List<String> validFactStorageTables =
StringUtils.isBlank(str) ? null : Arrays.asList(StringUtils.split(str.toLowerCase(), ","));
- storageTable = sc.getName();
+ storageTable = sc.getStorageTable();
// Check if storagetable is in the list of valid storages.
if (validFactStorageTables != null && !validFactStorageTables.contains(storageTable)) {
log.info("Skipping storage table {} as it is not valid", storageTable);
@@ -287,12 +286,12 @@ class StorageTableResolver implements ContextRewriter {
if (maxInterval != null && updatePeriod.compareTo(maxInterval) > 0) {
// if user supplied max interval, all intervals larger than that are useless.
log.info("Skipping update period {} for candidate {} since it's more than max interval supplied({})",
- updatePeriod, sc.getName(), maxInterval);
+ updatePeriod, sc.getStorageTable(), maxInterval);
skipUpdatePeriodCauses.put(updatePeriod.toString(), SkipUpdatePeriodCode.UPDATE_PERIOD_BIGGER_THAN_MAX);
} else if (validUpdatePeriods != null && !validUpdatePeriods.contains(updatePeriod.name().toLowerCase())) {
// if user supplied valid update periods, other update periods are useless
log.info("Skipping update period {} for candidate {} for storage {} since it's invalid",
- updatePeriod, sc.getName(), storageTable);
+ updatePeriod, sc.getStorageTable(), storageTable);
skipUpdatePeriodCauses.put(updatePeriod.toString(), SkipUpdatePeriodCode.INVALID);
} else if (!sc.isUpdatePeriodUseful(updatePeriod)) {
// if the storage candidate finds this update useful to keep looking at the time ranges queried
@@ -328,10 +327,7 @@ class StorageTableResolver implements ContextRewriter {
//This is the prune cause
pruningCauseForThisTimeRange =
new CandidateTablePruneCause(CandidateTablePruneCode.TIME_RANGE_NOT_ANSWERABLE);
- }
- //Check partition (or fallback) column existence
- //TODO Shouldn't we check atleast once for the existence of part column
- else if (cubeql.shouldReplaceTimeDimWithPart()) {
+ } else if (cubeql.shouldReplaceTimeDimWithPart()) {
if (!client.partColExists(sc.getFact().getName(), sc.getStorageName(), range.getPartitionColumn())) {
pruningCauseForThisTimeRange = partitionColumnsMissing(range.getPartitionColumn());
TimeRange fallBackRange = StorageUtil.getFallbackRange(range, sc.getFact().getName(), cubeql);
@@ -352,7 +348,7 @@ class StorageTableResolver implements ContextRewriter {
}
}
- if(pruningCauseForThisTimeRange != null) {
+ if (pruningCauseForThisTimeRange != null) {
allPruningCauses.add(pruningCauseForThisTimeRange);
}
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionCandidate.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionCandidate.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionCandidate.java
index 62ebf71..7f07dbc 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionCandidate.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionCandidate.java
@@ -24,6 +24,8 @@ import org.apache.lens.cube.metadata.FactPartition;
import org.apache.lens.cube.metadata.TimeRange;
import org.apache.lens.server.api.error.LensException;
+import com.google.common.collect.Maps;
+
/**
* Represents a union of two candidates
*/
@@ -41,7 +43,7 @@ public class UnionCandidate implements Candidate {
*/
private List<Candidate> childCandidates;
private QueryAST queryAst;
-
+ private Map<TimeRange, Map<Candidate, TimeRange>> splitTimeRangeMap = Maps.newHashMap();
public UnionCandidate(List<Candidate> childCandidates, CubeQueryContext cubeql) {
this.childCandidates = childCandidates;
//this.alias = alias;
@@ -56,7 +58,7 @@ public class UnionCandidate implements Candidate {
@Override
public boolean isTimeRangeCoverable(TimeRange timeRange) throws LensException {
- Map<Candidate, TimeRange> candidateRange = splitTimeRangeForChildren(timeRange);
+ Map<Candidate, TimeRange> candidateRange = getTimeRangeSplit(timeRange);
for (Map.Entry<Candidate, TimeRange> entry : candidateRange.entrySet()) {
if (!entry.getKey().isTimeRangeCoverable(entry.getValue())) {
return false;
@@ -106,8 +108,10 @@ public class UnionCandidate implements Candidate {
@Override
public double getCost() {
double cost = 0.0;
- for (Candidate cand : childCandidates) {
- cost += cand.getCost();
+ for (TimeRange timeRange : cubeql.getTimeRanges()) {
+ for (Map.Entry<Candidate, TimeRange> entry : getTimeRangeSplit(timeRange).entrySet()) {
+ cost += entry.getKey().getCost() * entry.getValue().milliseconds() / timeRange.milliseconds();
+ }
}
return cost;
}
@@ -137,7 +141,7 @@ public class UnionCandidate implements Candidate {
@Override
public boolean evaluateCompleteness(TimeRange timeRange, TimeRange parentTimeRange, boolean failOnPartialData)
throws LensException {
- Map<Candidate, TimeRange> candidateRange = splitTimeRangeForChildren(timeRange);
+ Map<Candidate, TimeRange> candidateRange = getTimeRangeSplit(timeRange);
boolean ret = true;
for (Map.Entry<Candidate, TimeRange> entry : candidateRange.entrySet()) {
ret &= entry.getKey().evaluateCompleteness(entry.getValue(), parentTimeRange, failOnPartialData);
@@ -192,12 +196,7 @@ public class UnionCandidate implements Candidate {
* @return
*/
private Map<Candidate, TimeRange> splitTimeRangeForChildren(TimeRange timeRange) {
- Collections.sort(childCandidates, new Comparator<Candidate>() {
- @Override
- public int compare(Candidate o1, Candidate o2) {
- return o1.getCost() < o2.getCost() ? -1 : o1.getCost() == o2.getCost() ? 0 : 1;
- }
- });
+ childCandidates.sort(Comparator.comparing(Candidate::getCost));
Map<Candidate, TimeRange> childrenTimeRangeMap = new HashMap<>();
// Sorted list based on the weights.
Set<TimeRange> ranges = new HashSet<>();
@@ -212,6 +211,9 @@ public class UnionCandidate implements Candidate {
}
return childrenTimeRangeMap;
}
+ private Map<Candidate, TimeRange> getTimeRangeSplit(TimeRange range) {
+ return splitTimeRangeMap.computeIfAbsent(range, this::splitTimeRangeForChildren);
+ }
/**
* Resolves the time range for this candidate based on overlap.
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionQueryWriter.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionQueryWriter.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionQueryWriter.java
index f2325f1..3ee817f 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionQueryWriter.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/UnionQueryWriter.java
@@ -498,7 +498,8 @@ public class UnionQueryWriter {
ASTNode child = (ASTNode) selectAST.getChild(i);
ASTNode outerSelect = new ASTNode(child);
ASTNode selectExprAST = (ASTNode) child.getChild(0);
- ASTNode outerAST = getOuterAST(selectExprAST, innerSelectAST, aliasDecider, sc, true, cubeql.getBaseCube().getDimAttributeNames());
+ ASTNode outerAST = getOuterAST(selectExprAST, innerSelectAST, aliasDecider, sc, true,
+ cubeql.getBaseCube().getDimAttributeNames());
outerSelect.addChild(outerAST);
// has an alias? add it
if (child.getChildCount() > 1) {
@@ -533,7 +534,8 @@ public class UnionQueryWriter {
5. If given ast is memorized as mentioned in the above cases, return the mapping.
*/
private ASTNode getOuterAST(ASTNode astNode, ASTNode innerSelectAST,
- AliasDecider aliasDecider, StorageCandidate sc, boolean isSelectAst, Set<String> dimensionSet) throws LensException {
+ AliasDecider aliasDecider, StorageCandidate sc, boolean isSelectAst, Set<String> dimensionSet)
+ throws LensException {
if (astNode == null) {
return null;
}
@@ -701,6 +703,7 @@ public class UnionQueryWriter {
StringBuilder from = new StringBuilder();
List<String> hqlQueries = new ArrayList<>();
for (StorageCandidate sc : storageCandidates) {
+ removeAggreagateFromDefaultColumns(sc.getQueryAst().getSelectAST());
Set<Dimension> queriedDims = factDimMap.get(sc);
hqlQueries.add(sc.toHQL(queriedDims));
}
@@ -709,4 +712,19 @@ public class UnionQueryWriter {
.append(" ) as " + cubeql.getBaseCube()).toString();
}
+ private void removeAggreagateFromDefaultColumns(ASTNode node) throws LensException {
+ for (int i = 0; i < node.getChildCount(); i++) {
+ ASTNode selectExpr = (ASTNode) node.getChild(i);
+ if (selectExpr.getChildCount() == 2) {
+ ASTNode column = (ASTNode) selectExpr.getChild(0);
+ if (HQLParser.isAggregateAST(column)
+ && column.getChildCount() == 2) {
+ if (HQLParser.getString((ASTNode) column.getChild(1)).equals("0.0")) {
+ selectExpr.getParent().setChild(i, getSelectExpr(null, (ASTNode) selectExpr.getChild(1), true));
+ }
+ }
+ }
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/main/java/org/apache/lens/driver/cube/RewriterPlan.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/driver/cube/RewriterPlan.java b/lens-cube/src/main/java/org/apache/lens/driver/cube/RewriterPlan.java
index f4049f5..caf8770 100644
--- a/lens-cube/src/main/java/org/apache/lens/driver/cube/RewriterPlan.java
+++ b/lens-cube/src/main/java/org/apache/lens/driver/cube/RewriterPlan.java
@@ -49,7 +49,7 @@ public final class RewriterPlan extends DriverQueryPlan {
for (CubeQueryContext ctx : cubeQueries) {
if (ctx.getPickedDimTables() != null && !ctx.getPickedDimTables().isEmpty()) {
for (CandidateDim dim : ctx.getPickedDimTables()) {
- addTablesQueried(dim.getStorageName());
+ addTablesQueried(dim.getStorageTable());
if (partitions.get(dim.getName()) == null || partitions.get(dim.getName()).isEmpty()) {
// puts storage table to latest part
partitions.put(dim.getName(), dim.getParticipatingPartitions());
@@ -59,10 +59,10 @@ public final class RewriterPlan extends DriverQueryPlan {
if (ctx.getPickedCandidate() != null) {
for (StorageCandidate sc : CandidateUtil.getStorageCandidates(ctx.getPickedCandidate())) {
addTablesQueried(sc.getAliasForTable(""));
- Set<FactPartition> factParts = (Set<FactPartition>) partitions.get(sc.getName());
+ Set<FactPartition> factParts = (Set<FactPartition>) partitions.get(sc.getStorageTable());
if (factParts == null) {
factParts = new HashSet<FactPartition>();
- partitions.put(sc.getName(), factParts);
+ partitions.put(sc.getStorageTable(), factParts);
}
factParts.addAll((Set<FactPartition>) sc.getParticipatingPartitions());
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
index 62d7386..033264c 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/CubeTestSetup.java
@@ -141,7 +141,7 @@ public class CubeTestSetup {
innerWhere, innerPostWhere, null, provider.providePartitionsForStorage(storage)));
sep = " UNION ALL ";
}
- return sb.append(") ").append(cubeName).append(" ").append(outerWhere == null ? "" : outerWhere)
+ return sb.append(") ").append(" as ").append(cubeName).append(" ").append(outerWhere == null ? "" : outerWhere)
.append(" ").append(outerPostWhere == null ? "" : outerPostWhere).toString();
}
public static String getExpectedUnionQuery(String cubeName, List<String> storages, StoragePartitionProvider provider,
@@ -333,9 +333,9 @@ public class CubeTestSetup {
return updatePeriodToWhereMap;
}
- // storageTables[0] is hourly
- // storageTables[1] is daily
- // storageTables[2] is monthly
+ // storageName[0] is hourly
+ // storageName[1] is daily
+ // storageName[2] is monthly
public static Map<String, String> getWhereForMonthlyDailyAndHourly2months(String... storageTables) {
Map<String, String> storageTableToWhereClause = new LinkedHashMap<String, String>();
List<String> hourlyparts = new ArrayList<String>();
@@ -778,28 +778,33 @@ public class CubeTestSetup {
private void dump(CubeMetastoreClient client) throws LensException, IOException {
// for (CubeInterface cubeInterface : client.getAllCubes()) {
-// String path = getClass().getResource("/schema/cubes/" + ((cubeInterface instanceof Cube) ? "base" : "derived")).getPath() + "/" + cubeInterface.getName() + ".xml";
+// String path = getClass().getResource("/schema/cubes/" + ((cubeInterface instanceof Cube) ? "base"
+// : "derived")).getPath() + "/" + cubeInterface.getName() + ".xml";
// try(BufferedWriter bw = new BufferedWriter(new FileWriter(path))) {
// bw.write(ToXMLString.toString(JAXBUtils.xCubeFromHiveCube(cubeInterface)));
// }
// }
for (CubeFactTable cubeFactTable : client.getAllFacts()) {
- try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/facts").getPath()+"/"+cubeFactTable.getName()+".xml"))) {
+ try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass()
+ .getResource("/schema/facts").getPath()+"/"+cubeFactTable.getName()+".xml"))) {
bw.write(ToXMLString.toString(client.getXFactTable(cubeFactTable)));
}
}
// for (Dimension dim : client.getAllDimensions()) {
-// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/dimensions").getPath()+"/"+dim.getName()+".xml"))) {
+// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass()
+// .getResource("/schema/dimensions").getPath()+"/"+dim.getName()+".xml"))) {
// bw.write(ToXMLString.toString(JAXBUtils.xdimensionFromDimension(dim)));
// }
// }
for (CubeDimensionTable dim : client.getAllDimensionTables()) {
- try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/dimtables").getPath()+"/"+dim.getName()+".xml"))) {
+ try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass()
+ .getResource("/schema/dimtables").getPath()+"/"+dim.getName()+".xml"))) {
bw.write(ToXMLString.toString(client.getXDimensionTable(dim)));
}
}
// for (Storage storage : client.getAllStorages()) {
-// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass().getResource("/schema/storages").getPath()+"/"+storage.getName()+".xml"))) {
+// try(BufferedWriter bw = new BufferedWriter(new FileWriter(getClass()
+// .getResource("/schema/storages").getPath()+"/"+storage.getName()+".xml"))) {
// bw.write(ToXMLString.toString(JAXBUtils.xstorageFromStorage(storage)));
// }
// }
@@ -961,4 +966,4 @@ public class CubeTestSetup {
System.out.println("--query- " + query);
HQLParser.printAST(HQLParser.parseHQL(query, new HiveConf()));
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/java/org/apache/lens/cube/parse/TestAggregateResolver.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestAggregateResolver.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestAggregateResolver.java
index 1e5d05f..3e08740 100644
--- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestAggregateResolver.java
+++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestAggregateResolver.java
@@ -223,7 +223,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
Candidate candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(),
+ ((StorageCandidate) candidate).getStorageTable().toLowerCase());
String expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, testCube.msr2 as `msr2` from ", null, null,
getWhereForHourly2days("c1_testfact2_raw"));
@@ -286,7 +287,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
Candidate candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
String expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, avg(testCube.msr2) as `avg(testCube.msr2)` "
+ "from ", null, "group by testcube.cityid", getWhereForHourly2days("c1_testfact2_raw"));
@@ -298,7 +300,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr2) as `sum(testCube.msr2)` "
@@ -310,7 +313,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, testCube.msr2 as `msr2` from ",
@@ -322,7 +326,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr2) as `sum(testCube.msr2)` "
@@ -334,7 +339,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr2) as `sum(testCube.msr2)` "
@@ -346,7 +352,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr2) as `sum(testCube.msr2)` "
@@ -359,7 +366,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr2) as `sum(testCube.msr2)` "
@@ -372,7 +380,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT distinct testcube.cityid as `cityid`, round(testCube.msr2) "
@@ -384,7 +393,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, count(distinct testCube.msr2) "
@@ -398,7 +408,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, round(testCube.msr1) as `round(testCube.msr1)` "
@@ -410,7 +421,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT distinct testcube.cityid as `cityid`, round(testCube.msr1) "
@@ -422,7 +434,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, count(distinct testCube.msr1) "
@@ -435,7 +448,8 @@ public class TestAggregateResolver extends TestQueryRewrite {
Assert.assertEquals(1, cubeql.getCandidates().size());
candidate = cubeql.getCandidates().iterator().next();
Assert.assertTrue(candidate instanceof StorageCandidate);
- Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate).getName().toLowerCase());
+ Assert.assertEquals("c1_testFact2_raw".toLowerCase(), ((StorageCandidate) candidate)
+ .getStorageTable().toLowerCase());
hQL = cubeql.toHQL();
expectedQL =
getExpectedQuery(cubeName, "SELECT testcube.cityid as `cityid`, sum(testCube.msr1) as `sum(testCube.msr1)` "
[2/4] lens git commit: Addressed final reviews and fixed checkstyle
error
Posted by su...@apache.org.
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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 9168d10..bed1e7a 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
@@ -30,14 +30,11 @@ import static org.testng.Assert.*;
import java.util.*;
import java.util.stream.Collectors;
-import org.apache.lens.cube.error.LensCubeErrorCode;
-import org.apache.lens.cube.error.NoCandidateDimAvailableException;
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;
-import org.apache.hadoop.hive.ql.parse.ParseException;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -53,12 +50,12 @@ public class TestUnionQueries extends TestQueryRewrite {
@BeforeTest
public void setupDriver() throws Exception {
testConf = LensServerAPITestUtil.getConfiguration(
- DRIVER_SUPPORTED_STORAGES, "C0,C1,C2",
- DISABLE_AUTO_JOINS, false,
- ENABLE_SELECT_TO_GROUPBY, true,
- ENABLE_GROUP_BY_TO_SELECT, true,
- DISABLE_AGGREGATE_RESOLVER, false,
- ENABLE_STORAGES_UNION, true);
+ DRIVER_SUPPORTED_STORAGES, "C0,C1,C2",
+ DISABLE_AUTO_JOINS, false,
+ ENABLE_SELECT_TO_GROUPBY, true,
+ ENABLE_GROUP_BY_TO_SELECT, true,
+ DISABLE_AGGREGATE_RESOLVER, false,
+ ENABLE_STORAGES_UNION, true);
}
@Override
@@ -66,334 +63,228 @@ public class TestUnionQueries extends TestQueryRewrite {
return new Configuration(testConf);
}
- //TODOD union: @Test
+ @Test
public void testUnionQueries() throws Exception {
- Configuration conf = getConf();
- conf.set(getValidStorageTablesKey("testfact"), "C1_testFact,C2_testFact");
- conf.set(getValidUpdatePeriodsKey("testfact", "C1"), "DAILY,HOURLY");
- conf.set(getValidUpdatePeriodsKey("testfact2", "C1"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C2"), "MONTHLY,DAILY");
- conf.setBoolean(CubeQueryConfUtil.ENABLE_STORAGES_UNION, false);
- ArrayList<String> storages = Lists.newArrayList("c1_testfact", "c2_testfact");
+ Configuration conf = LensServerAPITestUtil.getConfigurationWithParams(getConf(),
+ CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
+ getValidFactTablesKey("basecube"), "testfact",
+ FAIL_QUERY_ON_PARTIAL_DATA, false);
+ ArrayList<String> storages = Lists.newArrayList("daily_c6_testfact", "monthly_c6_testfact");
try {
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(HOURLY, DAILY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(MONTHLY));
-
// Union query
String hqlQuery;
String expected;
StoragePartitionProvider provider = new StoragePartitionProvider() {
@Override
public Map<String, String> providePartitionsForStorage(String storage) {
- return getWhereForMonthlyDailyAndHourly2monthsUnionQuery(storage);
+ if (storage.contains("daily_c6_testfact")) {
+ return getWhereForDays(storage, ONE_MONTH_BACK_TRUNCATED, getTruncatedDateWithOffset(MONTHLY, 0));
+ } else if (storage.contains("monthly_c6_testfact")) {
+ return getWhereForMonthly(storage, THREE_MONTHS_BACK_TRUNCATED, ONE_MONTH_BACK_TRUNCATED);
+ }
+ return null;
}
};
- try {
- rewrite("select cityid as `City ID`, msr8, msr7 as `Third measure` "
- + "from testCube where " + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
- // fail("Union feature is disabled, should have failed");
- } catch (LensException e) {
- assertEquals(e.getErrorCode(), LensCubeErrorCode.STORAGE_UNION_DISABLED.getLensErrorInfo().getErrorCode());
- }
- conf.setBoolean(CubeQueryConfUtil.ENABLE_STORAGES_UNION, true);
-
- hqlQuery = rewrite("select ascii(cityname) as `City Name`, msr8, msr7 as `Third measure` "
- + "from testCube where ascii(cityname) = 'c' and cityname = 'a' and zipcode = 'b' and "
- + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
+ hqlQuery = rewrite("select cityname1 as `City Name`, msr8, msr7 as `Third measure` "
+ + "from testCube where cityname1 = 'a' and zipcode = 'b' and "
+ + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City Name`, sum(testcube.alias1) + max(testcube.alias2), "
- + "case when sum(testcube.alias1) = 0 then 0 else sum(testcube.alias3)/sum(testcube.alias1) end "
- + "as `Third Measure`",
- null, "group by testcube.alias0",
- "select ascii(cubecity.name) as `alias0`, sum(testcube.msr2) as `alias1`, "
- + "max(testcube.msr3) as `alias2`, "
- + "sum(case when testcube.cityid = 'x' then testcube.msr21 else testcube.msr22 end) as `alias3`", " join "
- + getDbName() + "c1_citytable cubecity on testcube.cityid = cubecity.id and (cubecity.dt = 'latest')",
- "ascii(cubecity.name) = 'c' and cubecity.name = 'a' and testcube.zipcode = 'b'",
- "group by ascii(cubecity.name))");
- compareQueries(hqlQuery, expected);
- hqlQuery = rewrite("select asciicity as `City Name`, msr8, msr7 as `Third measure` "
- + "from testCube where asciicity = 'c' and cityname = 'a' and zipcode = 'b' and "
- + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
+ "SELECT (testcube.alias0) as `City Name`, (sum((testcube.alias1)) + max((testcube.alias2))) "
+ + "as `msr8`, case when (sum((testcube.alias1)) = 0) then 0 else (sum((testcube.alias4)) / "
+ + "sum((testcube.alias1))) end as `Third measure` ",
+ null, "group by testcube.alias0",
+ "SELECT (cubecity1.name) as `alias0`, sum((testcube.msr2)) as `alias1`, max((testcube.msr3)) "
+ + "as `alias2`, sum(case when ((testcube.cityid) = 'x') then (testcube.msr21) "
+ + "else (testcube.msr22) end) as `alias4` ", " join "
+ + getDbName() + "c6_citytable cubecity1 on testcube.cityid1 = cubecity1.id "
+ + "and (cubecity1.dt = 'latest') ",
+ "((cubecity1.name) = 'a') and ((testcube.zipcode) = 'b')",
+ "group by (cubecity1.name)");
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select ascii(cityid) as `City ID`, msr8, msr7 as `Third measure` "
- + "from testCube where ascii(cityid) = 'c' and cityid = 'a' and zipcode = 'b' and "
- + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
+ + "from testCube where ascii(cityid) = 'c' and cityid = 'a' and zipcode = 'b' and "
+ + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`, sum(testcube.alias1) + max(testcube.alias2), "
- + "case when sum(testcube.alias1) = 0 then 0 else sum(testcube.alias3)/sum(testcube.alias1) end "
- + "as `Third Measure`",
- null, "group by testcube.alias0",
- "select ascii(testcube.cityid) as `alias0`, sum(testcube.msr2) as `alias1`, "
- + "max(testcube.msr3) as `alias2`, "
- + "sum(case when testcube.cityid = 'x' then testcube.msr21 else testcube.msr22 end) as `alias3`",
- "ascii(testcube.cityid) = 'c' and testcube.cityid = 'a' and testcube.zipcode = 'b'",
- "group by ascii(testcube.cityid)");
+ "SELECT (testcube.alias0) as `City ID`, (sum((testcube.alias1)) + max((testcube.alias2))) as `msr8`, "
+ + "case when (sum((testcube.alias1)) = 0) then 0 else (sum((testcube.alias4)) / sum((testcube.alias1))) "
+ + "end as `Third measure`",
+ null, "group by testcube.alias0",
+ "SELECT ascii((testcube.cityid)) as `alias0`, sum((testcube.msr2)) as `alias1`, max((testcube.msr3)) "
+ + "as `alias2`, sum(case when ((testcube.cityid) = 'x') then (testcube.msr21) "
+ + "else (testcube.msr22) end) as `alias4`",
+ "ascii(testcube.cityid) = 'c' and testcube.cityid = 'a' and testcube.zipcode = 'b'",
+ "group by ascii(testcube.cityid)");
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select cityid as `City ID`, msr8, msr7 as `Third measure` "
- + "from testCube where cityid = 'a' and zipcode = 'b' and " + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
+ + "from testCube where cityid = 'a' and zipcode = 'b' and " + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`, sum(testcube.alias1) + max(testcube.alias2), "
- + "case when sum(testcube.alias1) = 0 then 0 else sum(testcube.alias3)/sum(testcube.alias1) end "
- + "as `Third Measure`",
- null, "group by testcube.alias0",
- "select testcube.cityid as `alias0`, sum(testcube.msr2) as `alias1`, "
- + "max(testcube.msr3) as `alias2`, "
- + "sum(case when testcube.cityid = 'x' then testcube.msr21 else testcube.msr22 end) as `alias3`",
- "testcube.cityid = 'a' and testcube.zipcode = 'b'", "group by testcube.cityid");
+ "SELECT (testcube.alias0) as `City ID`, (sum((testcube.alias1)) + max((testcube.alias2))) as `msr8`, "
+ + "case when (sum((testcube.alias1)) = 0) then 0 else (sum((testcube.alias4)) / sum((testcube.alias1)))"
+ + " end as `Third measure`",
+ null, "group by testcube.alias0",
+ "SELECT (testcube.cityid) as `alias0`, sum((testcube.msr2)) as `alias1`, max((testcube.msr3)) as `alias2`, "
+ + "sum(case when ((testcube.cityid) = 'x') then (testcube.msr21) else (testcube.msr22) end) as `alias4`",
+ "testcube.cityid = 'a' and testcube.zipcode = 'b'", "group by testcube.cityid");
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select cityid as `City ID`, msr3 as `Third measure` from testCube where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " having msr7 > 10", conf);
+ + THREE_MONTHS_RANGE_UPTO_MONTH + " having msr7 > 10", conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`, max(testcube.alias1) as `Third measure`",
- null, "group by testcube.alias0 having "
- + "(case when sum(testcube.alias2)=0 then 0 else sum(testcube.alias3)/sum(testcube.alias2) end > 10 )",
- "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, "
- + "sum(testcube.msr2) as `alias2`, "
- + "sum(case when testcube.cityid='x' then testcube.msr21 else testcube.msr22 end) as `alias3`",
- null, "group by testcube.cityid");
+ "SELECT testcube.alias0 as `City ID`, max(testcube.alias1) as `Third measure`",
+ null, "group by testcube.alias0 having "
+ + "(case when sum(testcube.alias2)=0 then 0 else sum(testcube.alias3)/sum(testcube.alias2) end > 10 )",
+ "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, "
+ + "sum(testcube.msr2) as `alias2`, "
+ + "sum(case when testcube.cityid='x' then testcube.msr21 else testcube.msr22 end) as `alias3`",
+ null, "group by testcube.cityid");
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select cityid as `City ID`, msr3 as `Third measure` from testCube where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " having msr8 > 10", conf);
+ + THREE_MONTHS_RANGE_UPTO_MONTH + " having msr8 > 10", conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`, max(testcube.alias1) as `Third measure`",
- null, "GROUP BY testcube.alias0 "
- + "HAVING (sum(testcube.alias2) + max(testcube.alias1)) > 10 ",
- "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, "
- + "sum(testcube.msr2)as `alias2`", null, "group by testcube.cityid");
+ "SELECT testcube.alias0 as `City ID`, max(testcube.alias1) as `Third measure`",
+ null, "GROUP BY testcube.alias0 "
+ + "HAVING (sum(testcube.alias2) + max(testcube.alias1)) > 10 ",
+ "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, "
+ + "sum(testcube.msr2)as `alias2`", null, "group by testcube.cityid");
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select msr3 as `Measure 3` from testCube where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " having msr2 > 10 and msr2 < 100", conf);
+ + THREE_MONTHS_RANGE_UPTO_MONTH + " having msr2 > 10 and msr2 < 100", conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT max(testcube.alias0) as `Measure 3` ",
- null, " HAVING sum(testcube.alias1) > 10 and sum(testcube.alias1) < 100",
- "SELECT max(testcube.msr3) as `alias0`, sum(testcube.msr2) as `alias1`", null, null);
+ "SELECT max(testcube.alias0) as `Measure 3` ",
+ null, " HAVING sum(testcube.alias1) > 10 and sum(testcube.alias1) < 100",
+ "SELECT max(testcube.msr3) as `alias0`, sum(testcube.msr2) as `alias1`", null, null);
compareQueries(hqlQuery, expected);
hqlQuery = rewrite("select zipcode, cityid as `City ID`, msr3 as `Measure 3`, msr4, "
- + "SUM(msr2) as `Measure 2` from testCube where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " having msr4 > 10 order by cityid desc limit 5", conf);
+ + "SUM(msr2) as `Measure 2` from testCube where "
+ + THREE_MONTHS_RANGE_UPTO_MONTH + " having msr4 > 10 order by cityid desc limit 5", conf);
expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0, testcube.alias1 as `City ID`, max(testcube.alias2) as `Measure 3`, "
- + "count(testcube.alias3), sum(testcube.alias4) as `Measure 2`",
- null, "group by testcube.alias0, testcube.alias1 "
- + " having count(testcube.alias3) > 10 order by testcube.alias1 desc limit 5",
- "select testcube.zipcode as `alias0`, testcube.cityid as `alias1`, "
- + "max(testcube.msr3) as `alias2`,count(testcube.msr4) as `alias3`, sum(testcube.msr2) as `alias4`",
- null, "group by testcube.zipcode, testcube.cityid ");
- compareQueries(hqlQuery, expected);
-
- conf.setBoolean(CubeQueryConfUtil.ENABLE_GROUP_BY_TO_SELECT, false);
- conf.setBoolean(ENABLE_SELECT_TO_GROUPBY, false);
- hqlQuery = rewrite("select cityid as `City ID`, msr3 as `Measure 3`, "
- + "SUM(msr2) as `Measure 2` from testCube" + " where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " group by zipcode having msr4 > 10 order by cityid desc limit 5", conf);
-
- expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`,max(testcube.alias1) as `Measure 3`,sum(testcube.alias2) as `Measure 2` ",
- null, "group by testcube.alias3 having count(testcube.alias4) > 10 order by testcube.alias0 desc limit 5",
- "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, "
- + "sum(testcube.msr2) as `alias2`, testcube.zipcode as `alias3`, count(testcube .msr4) as `alias4` FROM ",
- null, "GROUP BY testcube.zipcode");
+ "SELECT (testcube.alias0) as `zipcode`, (testcube.alias1) as `City ID`, max((testcube.alias2)) "
+ + "as `Measure 3`, count((testcube.alias3)) as `msr4`, sum((testcube.alias4)) as `Measure 2`",
+ null, "group by testcube.alias0, testcube.alias1 "
+ + " having count(testcube.alias3) > 10 order by testcube.alias1 desc limit 5",
+ "SELECT (testcube.zipcode) as `alias0`, (testcube.cityid) as `alias1`, max((testcube.msr3)) as `alias2`, "
+ + "count((testcube.msr4)) as `alias3`, sum((testcube.msr2)) as `alias4`",
+ null, "group by testcube.zipcode, testcube.cityid ");
compareQueries(hqlQuery, expected);
} finally {
getStorageToUpdatePeriodMap().clear();
}
}
- //TODO: enable this test after lavkesh's changes
- @Test(enabled = false)
+ @Test
public void testDimAttrExpressionQuery() throws Exception {
- Configuration conf = getConf();
- conf.set(getValidStorageTablesKey("testfact"), "C1_testFact,C2_testFact");
- conf.set(getValidUpdatePeriodsKey("testfact", "C1"), "DAILY,HOURLY");
- conf.set(getValidUpdatePeriodsKey("testfact2", "C1"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C2"), "MONTHLY,DAILY");
+ Configuration conf = LensServerAPITestUtil.getConfigurationWithParams(getConf(),
+ CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
+ getValidFactTablesKey("testcube"), "testfact",
+ FAIL_QUERY_ON_PARTIAL_DATA, false);
+ ArrayList<String> storages = Lists.newArrayList("daily_c6_testfact", "monthly_c6_testfact");
+
+ StoragePartitionProvider provider = new StoragePartitionProvider() {
+ @Override
+ public Map<String, String> providePartitionsForStorage(String storage) {
+ if (storage.contains("daily_c6_testfact")) {
+ return getWhereForDays(storage, ONE_MONTH_BACK_TRUNCATED, getTruncatedDateWithOffset(MONTHLY, 0));
+ } else if (storage.contains("monthly_c6_testfact")) {
+ return getWhereForMonthly(storage, THREE_MONTHS_BACK_TRUNCATED, ONE_MONTH_BACK_TRUNCATED);
+ }
+ return null;
+ }
+ };
// exception in following line
String hqlQuery = rewrite("select asciicity as `City Name`, cityAndState as citystate, isIndia as isIndia,"
- + " msr8, msr7 as `Third measure` "
- + "from testCube where asciicity = 'c' and cityname = 'a' and zipcode = 'b' and "
- + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
+ + " msr8, msr7 as `Third measure` "
+ + "from testCube where asciicity = 'c' and cityname = 'a' and zipcode = 'b' and "
+ + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
String joinExpr1 = " join "
- + getDbName() + "c1_statetable cubestate on testcube.stateid = cubestate.id and (cubestate.dt = 'latest') join"
- + getDbName() + "c1_citytable cubecity on testcube.cityid = cubecity.id and (cubecity.dt = 'latest')";
+ + getDbName() + "c6_statetable cubestate on testcube.stateid = cubestate.id and (cubestate.dt = 'latest') join"
+ + getDbName() + "c6_citytable cubecity on testcube.cityid = cubecity.id and (cubecity.dt = 'latest')";
String joinExpr2 = " join "
- + getDbName() + "c1_citytable cubecity on testcube.cityid = cubecity.id and (cubecity.dt = 'latest') join"
- + getDbName() + "c1_statetable cubestate on testcube.stateid = cubestate.id and (cubestate.dt = 'latest')";
+ + getDbName() + "c6_citytable cubecity on testcube.cityid = cubecity.id and (cubecity.dt = 'latest') join"
+ + getDbName() + "c6_statetable cubestate on testcube.stateid = cubestate.id and (cubestate.dt = 'latest')";
String expected1 = getExpectedQueryForDimAttrExpressionQuery(joinExpr1);
- String expected2 = getExpectedQueryForDimAttrExpressionQuery(joinExpr2);// not equals
+ String expected2 = getExpectedQueryForDimAttrExpressionQuery(joinExpr2);
assertTrue(new TestQuery(hqlQuery).equals(new TestQuery(expected1))
- || new TestQuery(hqlQuery).equals(new TestQuery(expected2)),
- "Actual :" + hqlQuery + " Expected1:" + expected1 + " Expected2 : "+ expected2);
+ || new TestQuery(hqlQuery).equals(new TestQuery(expected2)),
+ "Actual :" + hqlQuery + " Expected1:" + expected1 + " Expected2 : "+ expected2);
}
private String getExpectedQueryForDimAttrExpressionQuery(String joinExpr) {
try {
- ArrayList<String> storages = Lists.newArrayList("c1_testfact", "c2_testfact");
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(HOURLY, DAILY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(MONTHLY));
- StoragePartitionProvider provider = CubeTestSetup::getWhereForMonthlyDailyAndHourly2monthsUnionQuery;
- return getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City Name`, testcube.alias1 as citystate, testcube.alias2 as isIndia, "
- + "sum(testcube.alias3) + max(testcube.alias4), "
- + "case when sum(testcube.alias3) = 0 then 0 else sum(testcube.alias5)/sum(testcube.alias3) end "
- + "as `Third Measure`",
- null, " group by testcube.alias0, testcube.alias1, testcube.alias2",
- "select ascii(cubecity.name) as `alias0`, concat(cubecity.name, \":\", cubestate.name) as alias1,"
- + "cubecity.name == 'DELHI' OR cubestate.name == 'KARNATAKA' OR cubestate.name == 'MAHARASHTRA' as alias2,"
- + "sum(testcube.msr2) as `alias3`, max(testcube.msr3) as `alias4`, "
- + "sum(case when testcube.cityid = 'x' then testcube.msr21 else testcube.msr22 end) as `alias5`", joinExpr,
- "ascii(cubecity.name) = 'c' and cubecity.name = 'a' and testcube.zipcode = 'b'",
- " group by ascii(cubecity.name)), concat(cubecity.name, \":\", cubestate.name),"
- + "cubecity.name == 'DELHI' OR cubestate.name == 'KARNATAKA' OR cubestate.name == 'MAHARASHTRA'");
- } finally {
- getStorageToUpdatePeriodMap().clear();
- }
- }
- //TODOD union: @Test
- public void testNonAggregateOverAggregateFunction() throws Exception {
- try {
- Configuration conf = getConf();
- conf.set(getValidStorageTablesKey("testfact"), "C1_testFact,C2_testFact");
- conf.set(getValidUpdatePeriodsKey("testfact", "C1"), "DAILY,HOURLY");
- conf.set(getValidUpdatePeriodsKey("testfact2", "C1"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C2"), "MONTHLY,DAILY");
- ArrayList<String> storages = Lists.newArrayList("c1_testfact", "c2_testfact");
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(HOURLY, DAILY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(MONTHLY));
+ ArrayList<String> storages = Lists.newArrayList("daily_c6_testfact", "monthly_c6_testfact");
+
StoragePartitionProvider provider = new StoragePartitionProvider() {
@Override
public Map<String, String> providePartitionsForStorage(String storage) {
- return getWhereForMonthlyDailyAndHourly2monthsUnionQuery(storage);
+ if (storage.contains("daily_c6_testfact")) {
+ return getWhereForDays(storage, ONE_MONTH_BACK_TRUNCATED, getTruncatedDateWithOffset(MONTHLY, 0));
+ } else if (storage.contains("monthly_c6_testfact")) {
+ return getWhereForMonthly(storage, THREE_MONTHS_BACK_TRUNCATED, ONE_MONTH_BACK_TRUNCATED);
+ }
+ return null;
}
};
- String hqlQuery = rewrite("select cityid as `City ID`, msr3 as `Measure 3`, "
- + "round(SUM(msr2)) as `Measure 2` from testCube" + " where "
- + TWO_MONTHS_RANGE_UPTO_HOURS + " group by zipcode having msr4 > 10 order by cityid desc, stateid asc, zipcode "
- + "asc limit 5",
- conf);
- String expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "SELECT testcube.alias0 as `City ID`,max(testcube.alias1) as `Measure 3`,round(sum(testcube.alias2)) as "
- + "`Measure 2` ", null, "group by testcube.alias3 having count(testcube.alias4) > 10 "
- + "order by testcube.alias0 desc, testcube.alias5 asc, testcube.alias3 asc limit 5",
- "SELECT testcube.cityid as `alias0`, max(testcube.msr3) as `alias1`, sum(testcube.msr2) as `alias2`, "
- + "testcube.zipcode as `alias3`, count(testcube .msr4) as `alias4`, (testcube.stateid) as `alias5` FROM ",
- null, "GROUP BY testcube.zipcode");
- compareQueries(hqlQuery, expected);
+ return getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
+ "SELECT (testcube.alias0) as `City Name`, (testcube.alias1) as `citystate`, (testcube.alias2) as `isIndia`, "
+ + "(sum((testcube.alias3)) + max((testcube.alias4))) as `msr8`, case when (sum((testcube.alias3)) = 0) "
+ + "then 0 else (sum((testcube.alias6)) / sum((testcube.alias3))) end as `Third measure` ",
+ null, " group by testcube.alias0, testcube.alias1, testcube.alias2",
+ "SELECT ascii((cubecity.name)) as `alias0`, concat((cubecity.name), \":\", (cubestate.name)) as `alias1`, "
+ + "(((cubecity.name) == 'DELHI') or ((cubestate.name) == 'KARNATAKA') or ((cubestate.name) "
+ + "== 'MAHARASHTRA')) as `alias2`, sum((testcube.msr2)) as `alias3`, max((testcube.msr3)) as `alias4`, "
+ + "sum(case when ((testcube.cityid) = 'x') then (testcube.msr21) else (testcube.msr22) end) "
+ + "as `alias6` ", joinExpr,
+ "ascii(cubecity.name) = 'c' and cubecity.name = 'a' and testcube.zipcode = 'b'",
+ " GROUP BY ascii((cubecity.name)), concat((cubecity.name), \":\", (cubestate.name)), "
+ + "(((cubecity.name) == 'DELHI') or ((cubestate.name) == 'KARNATAKA') "
+ + "or ((cubestate.name) == 'MAHARASHTRA'))");
} finally {
getStorageToUpdatePeriodMap().clear();
}
}
-
- //TODOD union: @Test
- public void testMultiFactMultiStorage() throws ParseException, LensException {
+ @Test
+ public void testNonAggregateOverAggregateFunction() throws Exception {
try {
Configuration conf = LensServerAPITestUtil.getConfigurationWithParams(getConf(),
- CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C1,C2",
- getValidStorageTablesKey("testfact"), "C1_testFact,C2_testFact",
- getValidUpdatePeriodsKey("testfact", "C1"), "HOURLY",
- getValidUpdatePeriodsKey("testfact", "C2"), "DAILY",
- getValidUpdatePeriodsKey("testfact2_raw", "C1"), "YEARLY",
- getValidUpdatePeriodsKey("testfact2_raw", "C2"), "YEARLY");
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(HOURLY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(DAILY));
- String whereCond = "zipcode = 'a' and cityid = 'b' and (" + TWO_DAYS_RANGE_SPLIT_OVER_UPDATE_PERIODS + ")";
- String hqlQuery = rewrite("select zipcode, count(msr4), sum(msr15) from testCube where " + whereCond, conf);
- System.out.println(hqlQuery);
- String possibleStart1 = "SELECT COALESCE(mq1.zipcode, mq2.zipcode) zipcode, mq1.expr2 `count(msr4)`,"
- + " mq2.expr3 `sum(msr15)` FROM ";
- String possibleStart2 = "SELECT COALESCE(mq1.zipcode, mq2.zipcode) zipcode, mq2.expr2 `count(msr4)`,"
- + " mq1.expr3 `sum(msr15)` FROM ";
-
- assertTrue(hqlQuery.startsWith(possibleStart1) || hqlQuery.startsWith(possibleStart2));
- compareContains(rewrite("select zipcode as `zipcode`, sum(msr15) as `expr3` from testcube where " + whereCond,
- conf), hqlQuery);
- compareContains(rewrite("select zipcode as `zipcode`, count(msr4) as `expr2` from testcube where " + whereCond,
- conf), hqlQuery);
- assertTrue(hqlQuery.endsWith("on mq1.zipcode <=> mq2.zipcode"));
- // No time_range_in should be remaining
- assertFalse(hqlQuery.contains("time_range_in"));
- //TODO: handle having after LENS-813, also handle for order by and limit
- } finally {
- getStorageToUpdatePeriodMap().clear();
- }
- }
-
- //TODOD union: @Test
- public void testCubeWhereQueryWithMultipleTables() throws Exception {
- Configuration conf = getConf();
- conf.setBoolean(CubeQueryConfUtil.ENABLE_STORAGES_UNION, true);
- conf.set(getValidStorageTablesKey("testfact"), "C1_testFact,C2_testFact");
- conf.set(getValidUpdatePeriodsKey("testfact", "C1"), "DAILY");
- conf.set(getValidUpdatePeriodsKey("testfact2", "C1"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C2"), "HOURLY");
-
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(DAILY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(HOURLY));
- StoragePartitionProvider provider = new StoragePartitionProvider() {
- @Override
- public Map<String, String> providePartitionsForStorage(String storage) {
- return getWhereForDailyAndHourly2days(TEST_CUBE_NAME, storage);
- }
- };
- try {
- // Union query
- String hqlQuery = rewrite("select SUM(msr2) from testCube" + " where " + TWO_DAYS_RANGE, conf);
- System.out.println("HQL:" + hqlQuery);
-
- String expected = getExpectedUnionQuery(TEST_CUBE_NAME,
- Lists.newArrayList("c1_testfact", "c2_testfact"), provider,
- "select sum(testcube.alias0) ", null, null,
- "select sum(testcube.msr2) as `alias0` from ", null, null
- );
- compareQueries(hqlQuery, expected);
- } finally {
- getStorageToUpdatePeriodMap().clear();
- }
- }
+ CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
+ getValidFactTablesKey("testcube"), "testfact",
+ FAIL_QUERY_ON_PARTIAL_DATA, false);
+ ArrayList<String> storages = Lists.newArrayList("daily_c6_testfact", "monthly_c6_testfact");
- //TODOD union: @Test
- public void testCubeWhereQueryWithMultipleTablesForMonth() throws Exception {
- Configuration conf = getConf();
- conf.set(DRIVER_SUPPORTED_STORAGES, "C1,C2,C3");
- conf.set(getValidStorageTablesKey("testfact"), "");
- conf.set(getValidUpdatePeriodsKey("testfact", "C1"), "HOURLY");
- conf.set(getValidUpdatePeriodsKey("testfact2", "C1"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact2_raw", "C3"), "YEARLY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C2"), "DAILY");
- conf.set(getValidUpdatePeriodsKey("testfact", "C3"), "MONTHLY");
+ StoragePartitionProvider provider = new StoragePartitionProvider() {
+ @Override
+ public Map<String, String> providePartitionsForStorage(String storage) {
+ if (storage.contains("daily_c6_testfact")) {
+ return getWhereForDays(storage, ONE_MONTH_BACK_TRUNCATED, getTruncatedDateWithOffset(MONTHLY, 0));
+ } else if (storage.contains("monthly_c6_testfact")) {
+ return getWhereForMonthly(storage, THREE_MONTHS_BACK_TRUNCATED, ONE_MONTH_BACK_TRUNCATED);
+ }
+ return null;
+ }
+ };
- getStorageToUpdatePeriodMap().put("c1_testfact", Lists.newArrayList(HOURLY));
- getStorageToUpdatePeriodMap().put("c2_testfact", Lists.newArrayList(DAILY));
- getStorageToUpdatePeriodMap().put("c3_testfact", Lists.newArrayList(MONTHLY));
- StoragePartitionProvider provider = new StoragePartitionProvider() {
- @Override
- public Map<String, String> providePartitionsForStorage(String storage) {
- return getWhereForMonthlyDailyAndHourly2monthsUnionQuery(storage);
- }
- };
- try {
- // Union query
- String hqlQuery = rewrite("select SUM(msr2) from testCube" + " where " + TWO_MONTHS_RANGE_UPTO_HOURS, conf);
- System.out.println("HQL:" + hqlQuery);
- ArrayList<String> storages = Lists.newArrayList("c1_testfact", "c2_testfact", "c3_testfact");
+ String hqlQuery = rewrite("select cityid as `City ID`, msr3 as `Measure 3`, "
+ + "round(SUM(msr2)) as `Measure 2` from testCube" + " where "
+ + THREE_MONTHS_RANGE_UPTO_MONTH + " group by cityid having msr3 > 10 order by cityid desc limit 5", conf);
String expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "select sum(testcube.alias0)", null, null,
- "select sum(testcube.msr2) as `alias0` from ", null, null
- );
+ "SELECT (testcube.alias0) as `City ID`, max((testcube.alias1)) as `Measure 3`, round(sum((testcube.alias2))) "
+ + "as `Measure 2` ", null, "GROUP BY (testcube.alias0) HAVING (max((testcube.alias1)) > 10) "
+ + "ORDER BY testcube.alias0 desc LIMIT 5",
+ "SELECT (testcube.cityid) as `alias0`, max((testcube.msr3)) as `alias1`, "
+ + "sum((testcube.msr2)) as `alias2` FROM ",
+ null, "GROUP BY testcube.cityid");
compareQueries(hqlQuery, expected);
} finally {
getStorageToUpdatePeriodMap().clear();
@@ -429,35 +320,33 @@ public class TestUnionQueries extends TestQueryRewrite {
}
}
- //TODOD union: @Test
+ @Test
public void testSingleFactMultiStorage() throws Exception {
Configuration conf = LensServerAPITestUtil.getConfigurationWithParams(getConf(),
- CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C3,C5",
- getValidFactTablesKey("testcube"), "testfact",
- getValidUpdatePeriodsKey("testfact", "C3"), "DAILY",
- getValidUpdatePeriodsKey("testfact", "C5"), "DAILY",
- FAIL_QUERY_ON_PARTIAL_DATA, false);
+ CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
+ getValidFactTablesKey("testcube"), "testfact",
+ FAIL_QUERY_ON_PARTIAL_DATA, false);
- String hqlQuery = rewrite("select count(msr4) from testCube where " + TWO_MONTHS_RANGE_UPTO_DAYS, conf);
+ String hqlQuery = rewrite("select count(msr4) from testCube where " + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
System.out.println(hqlQuery);
// No time_range_in should be remaining
assertFalse(hqlQuery.contains("time_range_in"));
- ArrayList<String> storages = Lists.newArrayList("c3_testfact", "c5_testfact");
+ ArrayList<String> storages = Lists.newArrayList("daily_c6_testfact", "monthly_c6_testfact");
StoragePartitionProvider provider = new StoragePartitionProvider() {
@Override
public Map<String, String> providePartitionsForStorage(String storage) {
- if (storage.contains("c3")) {
- return getWhereForDays(storage, TWO_MONTHS_BACK, getDateWithOffset(DAILY, -10));
- } else if (storage.contains("c5")) {
- return getWhereForDays(storage, getDateWithOffset(DAILY, -10), NOW);
+ if (storage.contains("daily_c6_testfact")) {
+ return getWhereForDays(storage, ONE_MONTH_BACK_TRUNCATED, getTruncatedDateWithOffset(MONTHLY, 0));
+ } else if (storage.contains("monthly_c6_testfact")) {
+ return getWhereForMonthly(storage, THREE_MONTHS_BACK_TRUNCATED, ONE_MONTH_BACK_TRUNCATED);
}
return null;
}
};
String expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "select count(testcube.alias0)", null, null,
- "select count(testcube.msr4) as `alias0` from ", null, null
+ "SELECT count((testcube.alias0)) as `count(msr4)`", null, null,
+ "select count(testcube.msr4) as `alias0` from ", null, null
);
compareQueries(hqlQuery, expected);
}
@@ -466,19 +355,24 @@ public class TestUnionQueries extends TestQueryRewrite {
@Test
public void testSingleFactSingleStorageWithMultipleTableDescriptions() throws Exception {
Configuration conf = LensServerAPITestUtil.getConfigurationWithParams(getConf(),
- CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
- getValidFactTablesKey("testcube"), "testfact",
- FAIL_QUERY_ON_PARTIAL_DATA, false);
+ CubeQueryConfUtil.DRIVER_SUPPORTED_STORAGES, "C6",
+ getValidFactTablesKey("testcube"), "testfact",
+ FAIL_QUERY_ON_PARTIAL_DATA, false);
//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 " + THREE_MONTHS_RANGE_UPTO_DAYS, conf);
+ LensException 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().getName().equalsIgnoreCase("c6_testfact")).collect(Collectors.toSet());
+ Set<Map.Entry<StorageCandidate, List<CandidateTablePruneCause>>> causes =
+ ((NoCandidateFactAvailableException) e).getBriefAndDetailedError()
+ .entrySet().stream().filter(x -> x.getKey().getStorageTable()
+ .equalsIgnoreCase("c6_testfact")).collect(Collectors.toSet());
assertEquals(causes.size(), 1);
List<CandidateTablePruneCause> pruneCauses = causes.iterator().next().getValue();
assertEquals(pruneCauses.size(), 1);
- assertEquals(pruneCauses.get(0).getCause(), CandidateTablePruneCause.CandidateTablePruneCode.STORAGE_NOT_AVAILABLE_IN_RANGE);
+ assertEquals(pruneCauses.get(0).getCause(), CandidateTablePruneCause.
+ CandidateTablePruneCode.STORAGE_NOT_AVAILABLE_IN_RANGE);
}
String hqlQuery2 = rewrite("select count(msr4) from testCube where " + THREE_MONTHS_RANGE_UPTO_MONTH, conf);
@@ -497,8 +391,8 @@ public class TestUnionQueries extends TestQueryRewrite {
}
};
String expected = getExpectedUnionQuery(TEST_CUBE_NAME, storages, provider,
- "select count(testcube.alias0) AS `count(msr4)`", null, null,
- "select count((testcube.msr4)) AS `alias0` from ", null, null
+ "select count(testcube.alias0) AS `count(msr4)`", null, null,
+ "select count((testcube.msr4)) AS `alias0` from ", null, null
);
compareQueries(hqlQuery2, expected);
}
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/cubes/base/basecube.xml b/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
index b1fea1c..22703ab 100644
--- a/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
+++ b/lens-cube/src/test/resources/schema/cubes/base/basecube.xml
@@ -1,4 +1,24 @@
<?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="basecube" xmlns="uri:lens:cube:0.1">
<properties>
<property name="cube.timedim.partition.et" value="et"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index 0338f55..2edf419 100644
--- a/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
+++ b/lens-cube/src/test/resources/schema/cubes/base/testcube.xml
@@ -1,4 +1,24 @@
<?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"/>
@@ -52,6 +72,9 @@
<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="">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index dadf545..cf36cc7 100644
--- a/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der1.xml
@@ -1,4 +1,24 @@
<?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"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index 0d0c9af..337e7f4 100644
--- a/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der2.xml
@@ -1,4 +1,24 @@
<?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"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index a91d11f..ce9a511 100644
--- a/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
+++ b/lens-cube/src/test/resources/schema/cubes/derived/der3.xml
@@ -1,4 +1,24 @@
<?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"
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index b86fc04..4245498 100644
--- a/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
+++ b/lens-cube/src/test/resources/schema/cubes/derived/derivedcube.xml
@@ -1,4 +1,24 @@
<?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"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index a99f5d2..6237d87 100644
--- 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
@@ -1,4 +1,24 @@
<?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"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index cd884da..fd57fcd 100644
--- a/lens-cube/src/test/resources/schema/dimensions/citydim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/citydim.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index 1e95416..bd52a9a 100644
--- a/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/countrydim.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index a9cc3ae..7ffb276 100644
--- a/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim1.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index b714f50..b721c47 100644
--- a/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/cycledim2.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index 0ba6cee..89f2a6b 100644
--- a/lens-cube/src/test/resources/schema/dimensions/daydim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/daydim.xml
@@ -1,4 +1,24 @@
<?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?">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index c7bf7fb..0a2ea1c 100644
--- a/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/hourdim.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index d237069..3a0623f 100644
--- a/lens-cube/src/test/resources/schema/dimensions/sports.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/sports.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index ab55bdf..5676348 100644
--- a/lens-cube/src/test/resources/schema/dimensions/statedim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/statedim.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/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
index 65ebc3f..f40e8e2 100644
--- a/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim2.xml
@@ -1,4 +1,24 @@
<?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">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/testdim3.xml b/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
index c9003f8..6f7d295 100644
--- a/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim3.xml
@@ -1,4 +1,24 @@
<?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="testdim3" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="int" name="id" description="code">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/testdim4.xml b/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
index a5024da..ca615bb 100644
--- a/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/testdim4.xml
@@ -1,4 +1,24 @@
<?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="testdim4" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="int" name="id" description="code">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml b/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
index 5e4ff70..290448d 100644
--- a/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/unreachabledim.xml
@@ -1,4 +1,24 @@
<?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="unreachabledim" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="int" name="id" description="code">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/user_interests.xml b/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
index caadf91..4a677a3 100644
--- a/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/user_interests.xml
@@ -1,4 +1,24 @@
<?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="user_interests" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="int" name="user_id" description="user id">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/userdim.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/userdim.xml b/lens-cube/src/test/resources/schema/dimensions/userdim.xml
index 0ffbb6f..af5c720 100644
--- a/lens-cube/src/test/resources/schema/dimensions/userdim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/userdim.xml
@@ -1,4 +1,24 @@
<?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="userdim" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="string" name="name" description="name">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimensions/zipdim.xml b/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
index 22755ca..29f3af6 100644
--- a/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
+++ b/lens-cube/src/test/resources/schema/dimensions/zipdim.xml
@@ -1,4 +1,24 @@
<?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="zipdim" xmlns="uri:lens:cube:0.1">
<attributes>
<dim_attribute _type="string" name="f2" description="name">
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/citytable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable.xml b/lens-cube/src/test/resources/schema/dimtables/citytable.xml
index 507369a..41ec206 100644
--- a/lens-cube/src/test/resources/schema/dimtables/citytable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="citydim" table_name="citytable" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
@@ -47,5 +67,22 @@
</serde_parameters>
</table_desc>
</storage_table>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ <storage_name>C6</storage_name>
+ <table_desc external="false">
+ <part_cols>
+ <column name="dt" _type="string" comment="date partition"/>
+ </part_cols>
+ <table_parameters>
+ <property name="lens.metastore.table.storage.cost" value="100"/>
+ </table_parameters>
+ <serde_parameters>
+ <property name="serialization.format" value="1"/>
+ </serde_parameters>
+ </table_desc>
+ </storage_table>
</storage_tables>
</x_dimension_table>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable2.xml b/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
index 7b9ef97..0ea0911 100644
--- a/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable2.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="citydim" table_name="citytable2" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable3.xml b/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
index f599eb2..2b895aa 100644
--- a/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable3.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="citydim" table_name="citytable3" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/citytable4.xml b/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
index 2b70995..43881bf 100644
--- a/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/citytable4.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="citydim" table_name="citytable4" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/countrytable.xml b/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
index a82d7bc..4a7b3f5 100644
--- a/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/countrytable.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="countrydim" table_name="countrytable" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml b/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
index ecf88ac..2c3de87 100644
--- a/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/countrytable_partitioned.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="countrydim" table_name="countrytable_partitioned" weight="0.0"
xmlns="uri:lens:cube:0.1">
<columns>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml b/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
index 902696a..5c1467c 100644
--- a/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/cycledim1tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="cycleDim1" table_name="cycledim1tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml b/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
index 63a0975..aaac96e 100644
--- a/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/cycledim2tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="cycleDim2" table_name="cycledim2tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml b/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
index c1e16bf..39ef456 100644
--- a/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/daydimtbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="dayDim" table_name="daydimtbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml b/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
index c759704..86298d1 100644
--- a/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/hourdimtbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="hourDim" table_name="hourdimtbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="code"/>
http://git-wip-us.apache.org/repos/asf/lens/blob/cb5e2a77/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
----------------------------------------------------------------------
diff --git a/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml b/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
index 44420ac..9dca80a 100644
--- a/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
+++ b/lens-cube/src/test/resources/schema/dimtables/sports_tbl.xml
@@ -1,4 +1,24 @@
<?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_table dimension_name="sports" table_name="sports_tbl" weight="0.0" xmlns="uri:lens:cube:0.1">
<columns>
<column name="id" _type="int" comment="id"/>