You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by pr...@apache.org on 2015/02/02 12:14:54 UTC
[4/5] incubator-lens git commit: LENS-236: Cube.xsd cleanup
(amareshwari via prongs)
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim-local-part.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim-local-part.xml b/lens-cli/src/test/resources/dim-local-part.xml
deleted file mode 100644
index e93552a..0000000
--- a/lens-cli/src/test/resources/dim-local-part.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_partition
- cube_table_name="dim_table"
- location="/tmp/dim_table"
- update_period="hourly"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <time_partition_spec>
- <part_spec_element key="dt" value="2014-03-27T12:00:00"/>
- </time_partition_spec>
-</x_partition>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim-local-storage-element.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim-local-storage-element.xml b/lens-cli/src/test/resources/dim-local-storage-element.xml
index 4688383..5a19cfa 100644
--- a/lens-cli/src/test/resources/dim-local-storage-element.xml
+++ b/lens-cli/src/test/resources/dim-local-storage-element.xml
@@ -1,40 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_table_element xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_storage_table_element xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<storage_name>dim_local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/local">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
+ <table_desc external="true" field_delimiter="," table_location="/tmp/examples/local">
+ <part_cols>
+ <column comment="Time column" name="dt" type="STRING" />
</part_cols>
<time_part_cols>dt</time_part_cols>
</table_desc>
- <update_periods>hourly</update_periods>
- <update_periods>daily</update_periods>
+ <update_periods>
+ <update_period>DAILY</update_period>
+ </update_periods>
</x_storage_table_element>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim1-local-part.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim1-local-part.xml b/lens-cli/src/test/resources/dim1-local-part.xml
index 4c541ee..a57f6a7 100644
--- a/lens-cli/src/test/resources/dim1-local-part.xml
+++ b/lens-cli/src/test/resources/dim1-local-part.xml
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_partition
- cube_table_name="dim_table2"
- location="/tmp/dim_table2"
- update_period="hourly"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_partition fact_or_dimension_table_name="dim_table2" location="/tmp/dim_table2" update_period="DAILY"
+ xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<time_partition_spec>
- <part_spec_element key="dt" value="2014-03-27T12:00:00"/>
+ <part_spec_element key="dt" value="2014-03-27T12:00:00" />
</time_partition_spec>
</x_partition>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim2-storage-spec.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim2-storage-spec.xml b/lens-cli/src/test/resources/dim2-storage-spec.xml
deleted file mode 100644
index cad6e11..0000000
--- a/lens-cli/src/test/resources/dim2-storage-spec.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_storage_tables xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <storage_tables>
- <update_periods>hourly,daily</update_periods>
- <storage_name>local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/dim2">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
- </part_cols>
- <time_part_cols>dt</time_part_cols>
- </table_desc>
- </storage_tables>
-</x_storage_tables>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim_table.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim_table.xml b/lens-cli/src/test/resources/dim_table.xml
index 3005049..932c975 100644
--- a/lens-cli/src/test/resources/dim_table.xml
+++ b/lens-cli/src/test/resources/dim_table.xml
@@ -1,40 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<dimension_table dim_name="test_dim" table_name="dim_table" weight="0.0" xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_dimension_table dimension_name="test_dim" table_name="dim_table" weight="0.0" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<columns>
- <columns comment="ID" name="id" type="int"/>
- <columns comment="name" name="name" type="string"/>
- <columns comment="more details" name="detail" type="string"/>
- <columns comment="d2 ID" name="d2id" type="int"/>
+ <column comment="ID" name="id" type="INT" />
+ <column comment="name" name="name" type="STRING" />
+ <column comment="more details" name="detail" type="STRING" />
+ <column comment="d2 ID" name="d2id" type="INT" />
</columns>
-
- <storage_dump_periods>
- <update_period_element storage_name="local">
- <update_periods>hourly</update_periods>
- </update_period_element>
- </storage_dump_periods>
<properties>
- <properties name="dim1.prop" value="d1"/>
+ <property name="dim1.prop" value="d1" />
</properties>
-</dimension_table>
+ <storage_tables>
+ <storage_table>
+ <storage_name>local</storage_name>
+ <table_desc external="true" field_delimiter="," table_location="/tmp/examples/local">
+ <part_cols>
+ <column comment="Time column" name="dt" type="STRING" />
+ </part_cols>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ </update_periods>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim_table2.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim_table2.xml b/lens-cli/src/test/resources/dim_table2.xml
index 617fa75..3631065 100644
--- a/lens-cli/src/test/resources/dim_table2.xml
+++ b/lens-cli/src/test/resources/dim_table2.xml
@@ -1,38 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<dimension_table dim_name="test_dim2" table_name="dim_table2" weight="0.0" xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_dimension_table dimension_name="test_dim2" table_name="dim_table2" weight="0.0" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<columns>
- <columns comment="ID" name="id" type="int"/>
- <columns comment="name" name="name" type="string"/>
- <columns comment="more details for dim2" name="detail2" type="string"/>
+ <column comment="ID" name="id" type="INT" />
+ <column comment="name" name="name" type="STRING" />
+ <column comment="more details for dim2" name="detail2" type="STRING" />
</columns>
- <storage_dump_periods>
- <update_period_element storage_name="dim_local">
- <update_periods>hourly</update_periods>
- </update_period_element>
- </storage_dump_periods>
+
<properties>
- <properties name="dim2.prop" value="d2"/>
+ <property name="dim2.prop" value="d2" />
</properties>
-</dimension_table>
+ <storage_tables>
+ <storage_table>
+ <update_periods>HOURLY</update_periods>
+ <storage_name>dim_local</storage_name>
+ <table_desc external="true" field_delimiter="," table_location="/tmp/examples/dim1">
+ <part_cols>
+ <column comment="Time column" name="dt" type="STRING" />
+ </part_cols>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_dimension_table>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/dim_table_storage.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/dim_table_storage.xml b/lens-cli/src/test/resources/dim_table_storage.xml
deleted file mode 100644
index 568f0a3..0000000
--- a/lens-cli/src/test/resources/dim_table_storage.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_storage_tables xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <storage_tables>
- <update_periods>hourly</update_periods>
- <storage_name>local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/dim1">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
- </part_cols>
- <time_part_cols>dt</time_part_cols>
- </table_desc>
- </storage_tables>
-</x_storage_tables>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/fact-local-storage-element.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/fact-local-storage-element.xml b/lens-cli/src/test/resources/fact-local-storage-element.xml
index 7561f38..8ec3b42 100644
--- a/lens-cli/src/test/resources/fact-local-storage-element.xml
+++ b/lens-cli/src/test/resources/fact-local-storage-element.xml
@@ -1,40 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_table_element xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_storage_table_element xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<storage_name>fact_local</storage_name>
-
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/local">
- <table_parameters/>
- <serde_parameters/>
+ <table_desc external="true" field_delimiter="," table_location="/tmp/examples/local">
<part_cols>
- <columns comment="Time column" name="dt" type="string"/>
+ <column comment="Time column" name="dt" type="STRING" />
</part_cols>
<time_part_cols>dt</time_part_cols>
</table_desc>
- <update_periods>hourly</update_periods>
- <update_periods>daily</update_periods>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ </update_periods>
</x_storage_table_element>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/fact1-local-part.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/fact1-local-part.xml b/lens-cli/src/test/resources/fact1-local-part.xml
index 43ddc62..46e76c3 100644
--- a/lens-cli/src/test/resources/fact1-local-part.xml
+++ b/lens-cli/src/test/resources/fact1-local-part.xml
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_partition
- cube_table_name="fact1"
- location="/tmp/fact1"
- update_period="hourly"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_partition fact_or_dimension_table_name="fact1" location="/tmp/fact1" update_period="HOURLY"
+ xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<time_partition_spec>
- <part_spec_element key="dt" value="2014-03-27T12:00:00"/>
+ <part_spec_element key="dt" value="2014-03-27T12:00:00" />
</time_partition_spec>
</x_partition>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/fact1-storage-spec.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/fact1-storage-spec.xml b/lens-cli/src/test/resources/fact1-storage-spec.xml
deleted file mode 100644
index 1e969e4..0000000
--- a/lens-cli/src/test/resources/fact1-storage-spec.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_storage_tables xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <storage_tables>
- <update_periods>hourly,daily</update_periods>
- <storage_name>fact_local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/fact1_local">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
- </part_cols>
- <time_part_cols>dt</time_part_cols>
- </table_desc>
- </storage_tables>
-</x_storage_tables>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/fact1.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/fact1.xml b/lens-cli/src/test/resources/fact1.xml
index c471826..f46fa5c 100644
--- a/lens-cli/src/test/resources/fact1.xml
+++ b/lens-cli/src/test/resources/fact1.xml
@@ -1,42 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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.
-->
-<fact_table cube_name="sample_cube" name="fact1" weight="100.0"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_fact_table cube_name="sample_cube" name="fact1" weight="100.0" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<columns>
- <columns comment="" name="dim1" type="int"/>
- <columns comment="" name="measure1" type="bigint"/>
- <columns comment="" name="measure2" type="int"/>
- <columns comment="" name="measure3" type="float"/>
+ <column comment="" name="dim1" type="INT" />
+ <column comment="" name="measure1" type="BIGINT" />
+ <column comment="" name="measure2" type="INT" />
+ <column comment="" name="measure3" type="FLOAT" />
</columns>
- <storage_update_periods>
- <update_period_element storage_name="fact_local">
- <update_periods>hourly</update_periods>
- <update_periods>daily</update_periods>
- <update_periods>monthly</update_periods>
- </update_period_element>
- </storage_update_periods>
<properties>
- <properties name="fact1.prop" value="f1"/>
- <properties name="cube.fact.is.aggregated" value="true"/>
+ <property name="fact1.prop" value="f1" />
+ <property name="cube.fact.is.aggregated" value="true" />
</properties>
-</fact_table>
+ <storage_tables>
+ <storage_table>
+ <update_periods>
+ <update_period>HOURLY</update_period>
+ <update_period>DAILY</update_period>
+ <update_period>MONTHLY</update_period>
+ </update_periods>
+ <storage_name>fact_local</storage_name>
+ <table_desc external="true" field_delimiter="," table_location="/tmp/examples/fact1_local">
+ <part_cols>
+ <column comment="Time column" name="dt" type="STRING" />
+ </part_cols>
+ <time_part_cols>dt</time_part_cols>
+ </table_desc>
+ </storage_table>
+ </storage_tables>
+</x_fact_table>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/lens-client-site.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/lens-client-site.xml b/lens-cli/src/test/resources/lens-client-site.xml
index df46c4e..2f13700 100644
--- a/lens-cli/src/test/resources/lens-client-site.xml
+++ b/lens-cli/src/test/resources/lens-client-site.xml
@@ -1,22 +1,22 @@
<?xml version="1.0"?>
<!--
- 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
+ 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
+ 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.
+ 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.
-->
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/local-storage.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/local-storage.xml b/lens-cli/src/test/resources/local-storage.xml
index 32ed32b..6551375 100644
--- a/lens-cli/src/test/resources/local-storage.xml
+++ b/lens-cli/src/test/resources/local-storage.xml
@@ -1,28 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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 classname="org.apache.lens.cube.metadata.HDFSStorage" name="local"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_storage classname="org.apache.lens.cube.metadata.HDFSStorage" name="local" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<properties>
- <properties name="storage.url" value="file:///"/>
+ <property name="storage.url" value="file:///" />
</properties>
</x_storage>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/sample-cube.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/sample-cube.xml b/lens-cli/src/test/resources/sample-cube.xml
index 2ba17fc..4908f85 100644
--- a/lens-cli/src/test/resources/sample-cube.xml
+++ b/lens-cli/src/test/resources/sample-cube.xml
@@ -1,44 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_cube name="sample_cube" xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_base_cube name="sample_cube" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<measures>
- <measures name="measure1" type="bigint"/>
- <measures name="measure2" type="int" default_aggr="SUM"/>
- <measures name="measure3" type="float" default_aggr="MAX" start_time='2013-12-12-00:00'/>
- <measures name="measure4" type="double" default_aggr="MIN"/>
- <measures name="expr_msr5" type="double" expr="measure3 + measure4" />
+ <measure name="measure1" type="BIGINT" />
+ <measure name="measure2" type="INT" default_aggr="SUM" />
+ <measure name="measure3" type="FLOAT" default_aggr="MAX" start_time='2013-12-12-00:00' />
+ <measure name="measure4" type="DOUBLE" default_aggr="MIN" />
</measures>
+ <expressions>
+ <expression name="expr_msr5" type="DOUBLE" expr="measure3 + measure4" />
+ </expressions>
<dim_attributes>
- <dim_attributes name="dim1" type="int"/>
- <dim_attributes name="dim2" type="int" start_time='2013-12-01-00:00'/>
- <dim_attributes name="dim3" type="int">
- <references>
- <table_references dest_table="dim_table" dest_column="id"/>
- </references>
- </dim_attributes>
+ <dim_attribute name="dim1" type="INT" />
+ <dim_attribute name="dim2" type="INT" start_time='2013-12-01-00:00' />
+ <dim_attribute name="dim3" type="INT">
+ <ref_spec>
+ <table_references>
+ <table_reference table="dim_table" column="id" />
+ </table_references>
+ </ref_spec>
+ </dim_attribute>
</dim_attributes>
<properties>
- <properties name="sample_cube.prop" value="sample" />
- <properties name="cube.sample_cube.timed.dimensions.list" value="dt" />
+ <property name="sample_cube.prop" value="sample" />
+ <property name="cube.sample_cube.timed.dimensions.list" value="dt" />
</properties>
-</x_cube>
+</x_base_cube>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cli/src/test/resources/test-dimension.xml
----------------------------------------------------------------------
diff --git a/lens-cli/src/test/resources/test-dimension.xml b/lens-cli/src/test/resources/test-dimension.xml
index 70bcd09..d602569 100644
--- a/lens-cli/src/test/resources/test-dimension.xml
+++ b/lens-cli/src/test/resources/test-dimension.xml
@@ -1,40 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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="test_dim"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_dimension name="test_dim" xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<attributes>
- <dim_attributes name="id" type="int"/>
- <dim_attributes name="name" type="string" />
- <dim_attributes name="detail" type="string" start_time='2013-12-01-00:00'/>
- <dim_attributes name="d2id" type="int" start_time='2013-12-01-00:00'>
- <references>
- <table_references dest_table="test_dim2" dest_column="id"/>
- </references>
- </dim_attributes>
+ <dim_attribute name="id" type="INT" />
+ <dim_attribute name="name" type="STRING" />
+ <dim_attribute name="detail" type="STRING" start_time='2013-12-01-00:00' />
+ <dim_attribute name="d2id" type="INT" start_time='2013-12-01-00:00'>
+ <ref_spec>
+ <table_references>
+ <table_reference table="test_dim2" column="id" />
+ </table_references>
+ </ref_spec>
+ </dim_attribute>
</attributes>
-
+
<properties>
- <properties name="test_dim.prop" value="test" />
- <properties name="dimension.test_dim.timed.dimension" value="dt" />
+ <property name="test_dim.prop" value="test" />
+ <property name="dimension.test_dim.timed.dimension" value="dt" />
</properties>
</x_dimension>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-client/src/main/java/org/apache/lens/client/LensClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensClient.java b/lens-client/src/main/java/org/apache/lens/client/LensClient.java
index 98b22b3..3ba70ff 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensClient.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensClient.java
@@ -29,6 +29,10 @@ import org.apache.lens.api.query.*;
import java.util.HashMap;
import java.util.List;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
public class LensClient {
private static final Log LOG = LogFactory.getLog(LensClient.class);
@@ -273,9 +277,8 @@ public class LensClient {
return this.conn.removeResourceFromConnection("file", path);
}
- public APIResult createFactTable(String factSpec,
- String storageSpecPath) {
- return mc.createFactTable(factSpec, storageSpecPath);
+ public APIResult createFactTable(String factSpec) {
+ return mc.createFactTable(factSpec);
}
public APIResult createCube(String cubeSpec) {
@@ -290,8 +293,8 @@ public class LensClient {
return mc.createDimension(dimSpec);
}
- public APIResult createDimensionTable(String dimSpec, String storageSpec) {
- return mc.createDimensionTable(dimSpec, storageSpec);
+ public APIResult createDimensionTable(String dimSpec) {
+ return mc.createDimensionTable(dimSpec);
}
public List<String> getAllStorages() {
@@ -338,15 +341,15 @@ public class LensClient {
return mc.updateDimension(dimName, dimSpec);
}
- public FactTable getFactTable(String factName) {
+ public XFactTable getFactTable(String factName) {
return mc.getFactTable(factName);
}
- public DimensionTable getDimensionTable(String dimName) {
+ public XDimensionTable getDimensionTable(String dimName) {
return mc.getDimensionTable(dimName);
}
- public NativeTable getNativeTable(String tblName) {
+ public XNativeTable getNativeTable(String tblName) {
return mc.getNativeTable(tblName);
}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
----------------------------------------------------------------------
diff --git a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
index 11f6893..c8dd8eb 100644
--- a/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
+++ b/lens-client/src/main/java/org/apache/lens/client/LensMetadataClient.java
@@ -24,6 +24,7 @@ import org.apache.lens.api.metastore.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lens.api.APIResult;
+import org.apache.lens.api.APIResult.Status;
import org.apache.lens.api.StringList;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
@@ -36,9 +37,16 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
+import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.List;
@@ -50,6 +58,18 @@ public class LensMetadataClient {
private final LensConnectionParams params;
private final ObjectFactory objFact;
+ public static Unmarshaller JAXB_UNMARSHALLER;
+
+ static {
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
+ JAXB_UNMARSHALLER = jaxbContext.createUnmarshaller();
+ } catch (JAXBException e) {
+ throw new RuntimeException("Could not initialize JAXBCOntext");
+ }
+ }
+
+
public LensMetadataClient(LensConnection connection) {
this.connection = connection;
this.params = connection.getLensConnectionParams();
@@ -129,11 +149,11 @@ public class LensMetadataClient {
return nativetables.getElements();
}
- public NativeTable getNativeTable(String tblName) {
+ public XNativeTable getNativeTable(String tblName) {
WebTarget target = getMetastoreWebTarget();
- JAXBElement<NativeTable> htable = target.path("nativetables").path(tblName)
+ JAXBElement<XNativeTable> htable = target.path("nativetables").path(tblName)
.queryParam("sessionid", this.connection.getSessionHandle())
- .request(MediaType.APPLICATION_XML).get(new GenericType<JAXBElement<NativeTable>>() {
+ .request(MediaType.APPLICATION_XML).get(new GenericType<JAXBElement<XNativeTable>>() {
});
return htable.getValue();
}
@@ -163,13 +183,31 @@ public class LensMetadataClient {
return result;
}
+ private Object readFromXML(String filename) throws JAXBException, IOException {
+ if (filename.startsWith("/")) {
+ return ((JAXBElement)JAXB_UNMARSHALLER.unmarshal(new File(filename))).getValue();
+ } else {
+ // load from classpath
+ InputStream file = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
+ if (file == null) {
+ throw new IOException("File not found:" + filename);
+ }
+ return ((JAXBElement)JAXB_UNMARSHALLER.unmarshal(file)).getValue();
+ }
+ }
+
public APIResult createCube(String cubeSpec) {
- WebTarget target = getMetastoreWebTarget();
- APIResult result = target.path("cubes")
- .queryParam("sessionid", this.connection.getSessionHandle())
- .request(MediaType.APPLICATION_XML)
- .post(Entity.xml(getContent(cubeSpec)), APIResult.class);
- return result;
+ XCube cube;
+ try {
+ cube = (XCube)readFromXML(cubeSpec);
+ } catch (JAXBException e) {
+ LOG.info("Unmarshalling error:" , e);
+ return new APIResult(Status.FAILED, "Unmarshalling failed");
+ } catch (IOException e) {
+ LOG.info("File error:" , e);
+ return new APIResult(Status.FAILED, "File not found");
+ }
+ return createCube(cube);
}
public APIResult updateCube(String cubeName, XCube cube) {
@@ -181,13 +219,18 @@ public class LensMetadataClient {
return result;
}
- public APIResult updateCube(String cubeName, String cubespec) {
- WebTarget target = getMetastoreWebTarget();
- APIResult result = target.path("cubes").path(cubeName)
- .queryParam("sessionid", this.connection.getSessionHandle())
- .request(MediaType.APPLICATION_XML)
- .put(Entity.xml(getContent(cubespec)), APIResult.class);
- return result;
+ public APIResult updateCube(String cubeName, String cubeSpec) {
+ XCube cube;
+ try {
+ cube = (XCube)readFromXML(cubeSpec);
+ } catch (JAXBException e) {
+ LOG.info("Unmarshalling error:" , e);
+ return new APIResult(Status.FAILED, "Unmarshalling failed");
+ } catch (IOException e) {
+ LOG.info("File error:" , e);
+ return new APIResult(Status.FAILED, "File not found");
+ }
+ return updateCube(cubeName, cube);
}
public XCube getCube(String cubeName) {
@@ -350,12 +393,12 @@ public class LensMetadataClient {
return result;
}
- public List<FactTable> getAllFactTables(String cubeName) {
+ public List<XFactTable> getAllFactTables(String cubeName) {
WebTarget target = getMetastoreWebTarget();
- List<FactTable> factTables = target.path("cubes").path(cubeName).path("facts")
+ List<XFactTable> factTables = target.path("cubes").path(cubeName).path("facts")
.queryParam("sessionid", this.connection.getSessionHandle())
.request(MediaType.APPLICATION_XML)
- .get(new GenericType<List<FactTable>>() {
+ .get(new GenericType<List<XFactTable>>() {
});
return factTables;
}
@@ -380,27 +423,24 @@ public class LensMetadataClient {
}
- public FactTable getFactTable(String factTableName) {
+ public XFactTable getFactTable(String factTableName) {
WebTarget target = getMetastoreWebTarget();
- JAXBElement<FactTable> table = target.path("facts").path(factTableName)
+ JAXBElement<XFactTable> table = target.path("facts").path(factTableName)
.queryParam("sessionid", this.connection.getSessionHandle())
.request(MediaType.APPLICATION_XML)
- .get(new GenericType<JAXBElement<FactTable>>() {
+ .get(new GenericType<JAXBElement<XFactTable>>() {
});
return table.getValue();
}
- public APIResult createFactTable(FactTable f, XStorageTables tables) {
+ public APIResult createFactTable(XFactTable f) {
WebTarget target = getMetastoreWebTarget();
FormDataMultiPart mp = new FormDataMultiPart();
mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid")
.build(), this.connection.getSessionHandle(), MediaType.APPLICATION_XML_TYPE));
mp.bodyPart(new FormDataBodyPart(
FormDataContentDisposition.name("fact").fileName("fact").build(),
- objFact.createFactTable(f), MediaType.APPLICATION_XML_TYPE));
- mp.bodyPart(new FormDataBodyPart(
- FormDataContentDisposition.name("storageTables").fileName("storagetables").build(),
- objFact.createXStorageTables(tables), MediaType.APPLICATION_XML_TYPE));
+ objFact.createXFactTable(f), MediaType.APPLICATION_XML_TYPE));
APIResult result = target.path("facts")
.request(MediaType.APPLICATION_XML_TYPE)
.post(Entity.entity(mp, MediaType.MULTIPART_FORM_DATA_TYPE),
@@ -408,8 +448,7 @@ public class LensMetadataClient {
return result;
}
- public APIResult createFactTable(String factSpec,
- String storageSpecPath) {
+ public APIResult createFactTable(String factSpec) {
WebTarget target = getMetastoreWebTarget();
FormDataMultiPart mp = new FormDataMultiPart();
mp.bodyPart(new FormDataBodyPart(FormDataContentDisposition.name("sessionid")
@@ -417,9 +456,6 @@ public class LensMetadataClient {
mp.bodyPart(new FormDataBodyPart(
FormDataContentDisposition.name("fact").fileName("fact").build(),
getContent(factSpec), MediaType.APPLICATION_XML_TYPE));
- mp.bodyPart(new FormDataBodyPart(
- FormDataContentDisposition.name("storageTables").fileName("storagetables").build(),
- getContent(storageSpecPath), MediaType.APPLICATION_XML_TYPE));
APIResult result = target.path("facts")
.request(MediaType.APPLICATION_XML_TYPE)
.post(Entity.entity(mp, MediaType.MULTIPART_FORM_DATA_TYPE),
@@ -429,21 +465,31 @@ public class LensMetadataClient {
private String getContent(String path) {
try {
- List<String> content = Files.readLines(new File(path),
+ List<String> content = null;
+ if (path.startsWith("/")) {
+ // path provided is absolute path
+ content = Files.readLines(new File(path), Charset.defaultCharset());
+ } else {
+ // load from classpath
+ URI uri = Thread.currentThread().getContextClassLoader().getResource(path).toURI();
+ content = Files.readLines(new File(uri),
Charset.defaultCharset());
+ }
return Joiner.on("\n").skipNulls().join(content);
} catch (IOException e) {
throw new IllegalStateException(e);
+ } catch (URISyntaxException e) {
+ throw new IllegalStateException(e);
}
}
- public APIResult updateFactTable(String factName, FactTable table) {
+ public APIResult updateFactTable(String factName, XFactTable table) {
WebTarget target = getMetastoreWebTarget();
APIResult result = target.path("facts").path(factName)
.queryParam("sessionid", this.connection.getSessionHandle())
.request(MediaType.APPLICATION_XML_TYPE)
- .put(Entity.xml(objFact.createFactTable(table)), APIResult.class);
+ .put(Entity.xml(objFact.createXFactTable(table)), APIResult.class);
return result;
}
@@ -528,14 +574,14 @@ public class LensMetadataClient {
public List<XPartition> getPartitionsOfFactTable(String factName, String storage, String filter) {
WebTarget target = getMetastoreWebTarget();
- JAXBElement<PartitionList> elements = target.path("facts").path(factName)
+ JAXBElement<XPartitionList> elements = target.path("facts").path(factName)
.path("storages").path(storage).path("partitions")
.queryParam("sessionid", this.connection.getSessionHandle())
.queryParam("filter", filter)
.request(MediaType.APPLICATION_XML)
- .get(new GenericType<JAXBElement<PartitionList>>() {
+ .get(new GenericType<JAXBElement<XPartitionList>>() {
});
- return elements.getValue().getXPartition();
+ return elements.getValue().getPartition();
}
public List<XPartition> getPartitionsOfFactTable(String factName, String storage) {
@@ -581,8 +627,7 @@ public class LensMetadataClient {
return dimtables.getElements();
}
- public APIResult createDimensionTable(DimensionTable table,
- XStorageTables storageTables) {
+ public APIResult createDimensionTable(XDimensionTable table) {
WebTarget target = getMetastoreWebTarget();
FormDataMultiPart mp = new FormDataMultiPart();
@@ -590,10 +635,7 @@ public class LensMetadataClient {
this.connection.getSessionHandle(), MediaType.APPLICATION_XML_TYPE));
mp.bodyPart(new FormDataBodyPart(
FormDataContentDisposition.name("dimensionTable").fileName("dimtable").build(),
- objFact.createDimensionTable(table), MediaType.APPLICATION_XML_TYPE));
- mp.bodyPart(new FormDataBodyPart(
- FormDataContentDisposition.name("storageTables").fileName("storagetables").build(),
- objFact.createXStorageTables(storageTables), MediaType.APPLICATION_XML_TYPE));
+ objFact.createXDimensionTable(table), MediaType.APPLICATION_XML_TYPE));
APIResult result = target.path("dimtables")
.request(MediaType.APPLICATION_XML)
@@ -601,8 +643,7 @@ public class LensMetadataClient {
return result;
}
- public APIResult createDimensionTable(String table,
- String storageTables) {
+ public APIResult createDimensionTable(String tableXml) {
WebTarget target = getMetastoreWebTarget();
FormDataMultiPart mp = new FormDataMultiPart();
@@ -610,10 +651,7 @@ public class LensMetadataClient {
this.connection.getSessionHandle(), MediaType.APPLICATION_XML_TYPE));
mp.bodyPart(new FormDataBodyPart(
FormDataContentDisposition.name("dimensionTable").fileName("dimtable").build(),
- getContent(table), MediaType.APPLICATION_XML_TYPE));
- mp.bodyPart(new FormDataBodyPart(
- FormDataContentDisposition.name("storageTables").fileName("storagetables").build(),
- getContent(storageTables), MediaType.APPLICATION_XML_TYPE));
+ getContent(tableXml), MediaType.APPLICATION_XML_TYPE));
APIResult result = target.path("dimtables")
.request(MediaType.APPLICATION_XML)
@@ -622,13 +660,13 @@ public class LensMetadataClient {
}
- public APIResult updateDimensionTable(DimensionTable table) {
+ public APIResult updateDimensionTable(XDimensionTable table) {
String dimTableName = table.getTableName();
WebTarget target = getMetastoreWebTarget();
APIResult result = target.path("dimtables").path(dimTableName)
.queryParam("sessionid", this.connection.getSessionHandle())
.request(MediaType.APPLICATION_XML)
- .put(Entity.xml(objFact.createDimensionTable(table)), APIResult.class);
+ .put(Entity.xml(objFact.createXDimensionTable(table)), APIResult.class);
return result;
}
@@ -655,12 +693,12 @@ public class LensMetadataClient {
return dropDimensionTable(table, false);
}
- public DimensionTable getDimensionTable(String table) {
+ public XDimensionTable getDimensionTable(String table) {
WebTarget target = getMetastoreWebTarget();
- JAXBElement<DimensionTable> result = target.path("dimtables").path(table)
+ JAXBElement<XDimensionTable> result = target.path("dimtables").path(table)
.queryParam("sessionid", this.connection.getSessionHandle())
.request(MediaType.APPLICATION_XML)
- .get(new GenericType<JAXBElement<DimensionTable>>() {
+ .get(new GenericType<JAXBElement<XDimensionTable>>() {
});
return result.getValue();
}
@@ -727,14 +765,14 @@ public class LensMetadataClient {
public List<XPartition> getAllPartitionsOfDimensionTable(String dimTblName, String storage,
String filter) {
WebTarget target = getMetastoreWebTarget();
- JAXBElement<PartitionList> partList = target.path("dimtables").path(dimTblName)
+ JAXBElement<XPartitionList> partList = target.path("dimtables").path(dimTblName)
.path("storages").path(storage).path("partitions")
.queryParam("sessionid", this.connection.getSessionHandle())
.queryParam("filter", filter)
.request(MediaType.APPLICATION_XML)
- .get(new GenericType<JAXBElement<PartitionList>>() {
+ .get(new GenericType<JAXBElement<XPartitionList>>() {
});
- return partList.getValue().getXPartition();
+ return partList.getValue().getPartition();
}
public List<XPartition> getAllPartitionsOfDimensionTable(String dimTblName, String storage) {
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/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 42f5e0a..7c5879a 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
@@ -1434,11 +1434,11 @@ public class CubeMetastoreClient {
CubeFactTable fact = getFactTable(factName);
if (cascade) {
for (String storage : fact.getStorages()) {
- dropStorageFromFact(factName, storage);
+ dropStorageFromFact(factName, storage, false);
}
}
- updateFactCache(factName);
dropHiveTable(factName);
+ allFactTables.remove(factName.toLowerCase());
} else {
throw new HiveException(factName + " is not a CubeFactTable");
}
@@ -1460,6 +1460,17 @@ public class CubeMetastoreClient {
updateFactCache(factName);
}
+ // updateFact will be false when fact is fully dropped
+ private void dropStorageFromFact(String factName, String storage, boolean updateFact) throws HiveException {
+ CubeFactTable cft = getFactTable(factName);
+ dropHiveTable(MetastoreUtil.getFactStorageTableName(factName, storage));
+ if (updateFact) {
+ cft.dropStorage(storage);
+ alterCubeTable(factName, getTable(factName), cft);
+ updateFactCache(factName);
+ }
+ }
+
/**
* Drop a storage from dimension
*
@@ -1468,11 +1479,18 @@ public class CubeMetastoreClient {
* @throws HiveException
*/
public void dropStorageFromDim(String dimTblName, String storage) throws HiveException {
+ dropStorageFromDim(dimTblName, storage, true);
+ }
+
+ // updateDimTbl will be false when dropping dimTbl
+ private void dropStorageFromDim(String dimTblName, String storage, boolean updateDimTbl) throws HiveException {
CubeDimensionTable cdt = getDimensionTable(dimTblName);
- cdt.dropStorage(storage);
dropHiveTable(MetastoreUtil.getDimStorageTableName(dimTblName, storage));
- alterCubeTable(dimTblName, getTable(dimTblName), cdt);
- updateDimCache(dimTblName);
+ if (updateDimTbl) {
+ cdt.dropStorage(storage);
+ alterCubeTable(dimTblName, getTable(dimTblName), cdt);
+ updateDimCache(dimTblName);
+ }
}
/**
@@ -1487,10 +1505,10 @@ public class CubeMetastoreClient {
public void dropDimensionTable(String dimTblName, boolean cascade) throws HiveException {
if (isDimensionTable(dimTblName)) {
CubeDimensionTable dim = getDimensionTable(dimTblName);
- Set<String> dimStorages = new HashSet<String>();
- dimStorages.addAll(dim.getStorages());
- for (String storage : dimStorages) {
- dropStorageFromDim(dimTblName, storage);
+ if (cascade) {
+ for (String storage : dim.getStorages()) {
+ dropStorageFromDim(dimTblName, storage, false);
+ }
}
dropHiveTable(dimTblName);
allDimTables.remove(dimTblName.toLowerCase());
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-cube/src/main/java/org/apache/lens/cube/metadata/JoinChain.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/metadata/JoinChain.java b/lens-cube/src/main/java/org/apache/lens/cube/metadata/JoinChain.java
index 59c3727..527f21c 100644
--- a/lens-cube/src/main/java/org/apache/lens/cube/metadata/JoinChain.java
+++ b/lens-cube/src/main/java/org/apache/lens/cube/metadata/JoinChain.java
@@ -152,9 +152,9 @@ public class JoinChain implements Named {
@EqualsAndHashCode(exclude={"relationShip"})
@ToString
- private static class Edge {
- final TableReference from;
- final TableReference to;
+ public static class Edge {
+ @Getter private final TableReference from;
+ @Getter private final TableReference to;
transient TableRelationship relationShip = null;
Edge(TableReference from, TableReference to) {
this.from = from;
@@ -201,7 +201,7 @@ public class JoinChain implements Named {
@EqualsAndHashCode(exclude={"refs"})
@ToString
public static class Path {
- final List<Edge> links = new ArrayList<Edge>();
+ @Getter final List<Edge> links = new ArrayList<Edge>();
transient List<TableReference> refs = null;
private void addLink(Edge edge) {
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java b/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
index 06a5e04..3dbfb52 100644
--- a/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
+++ b/lens-examples/src/main/java/org/apache/lens/examples/SampleMetastore.java
@@ -29,11 +29,9 @@ import javax.xml.bind.Unmarshaller;
import org.apache.lens.api.APIResult;
import org.apache.lens.api.metastore.*;
import org.apache.lens.client.LensClientSingletonWrapper;
-import org.apache.lens.client.LensConnection;
import org.apache.lens.client.LensMetadataClient;
public class SampleMetastore {
- private LensConnection connection;
private LensMetadataClient metaClient;
public static Unmarshaller jaxbUnmarshaller;
private APIResult result;
@@ -66,55 +64,39 @@ public class SampleMetastore {
}
public void createCube() throws JAXBException, IOException {
- XCube cube = (XCube)readFromXML("sample-cube.xml");
- if (cube != null) {
- result = metaClient.createCube(cube);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating cube from:sample-cube.xml failed");
- retCode = 1;
- }
+ result = metaClient.createCube("sample-cube.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating cube from:sample-cube.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
}
public void createDimensions() throws JAXBException, IOException {
- XDimension dim1 = (XDimension)readFromXML("sample-dimension.xml");
- if (dim1 != null) {
- result = metaClient.createDimension(dim1);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dimension from:sample-dimension.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimension("sample-dimension.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dimension from:sample-dimension.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- XDimension dim2 = (XDimension)readFromXML("sample-dimension2.xml");
- if (dim2 != null) {
- result = metaClient.createDimension(dim2);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dimension from:sample-dimension2.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimension("sample-dimension2.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dimension from:sample-dimension2.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- XDimension dbDim = (XDimension)readFromXML("sample-db-only-dimension.xml");
- if (dbDim != null) {
- result = metaClient.createDimension(dbDim);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dimension from:sample-db-only-dimension.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimension("sample-db-only-dimension.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dimension from:sample-db-only-dimension.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
-
}
private void createStorage(String fileName)
throws JAXBException, IOException {
- XStorage local = (XStorage)readFromXML(fileName);
- if (local != null) {
- result = metaClient.createNewStorage(local);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating storage from:" + fileName + " failed");
- retCode = 1;
- }
+ result = metaClient.createNewStorage(fileName);
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating storage from:" + fileName + " failed, reason:" + result.getMessage());
+ retCode = 1;
}
}
public void createStorages() throws JAXBException, IOException {
@@ -132,73 +114,45 @@ public class SampleMetastore {
}
private void createDimensionTables() throws JAXBException, IOException {
- DimensionTable dim = (DimensionTable)readFromXML("dim_table.xml");
- XStorageTables storageTables = (XStorageTables)readFromXML("dim1-storage-tables.xml");
- if (dim != null && storageTables != null) {
- result = metaClient.createDimensionTable(dim, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dim table from: dim_table.xml and dim1-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimensionTable("dim_table.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dim table from: dim_table.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- dim = (DimensionTable)readFromXML("dim_table2.xml");
- storageTables = (XStorageTables)readFromXML("dim2-storage-tables.xml");
- if (dim != null && storageTables != null) {
- result = metaClient.createDimensionTable(dim, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dim table from: dim_table2.xml and dim2-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimensionTable("dim_table2.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dim table from: dim_table2.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- dim = (DimensionTable)readFromXML("dim_table3.xml");
- storageTables = (XStorageTables)readFromXML("dim3-storage-tables.xml");
- if (dim != null && storageTables != null) {
- result = metaClient.createDimensionTable(dim, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dim table from: dim_table3.xml and dim3-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimensionTable("dim_table3.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dim table from: dim_table3.xmlfailed, reason:" + result.getMessage());
+ retCode = 1;
}
- dim = (DimensionTable)readFromXML("dim_table4.xml");
- storageTables = (XStorageTables)readFromXML("dim4-storage-tables.xml");
- if (dim != null && storageTables != null) {
- result = metaClient.createDimensionTable(dim, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating dim table from: dim_table4.xml and dim4-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createDimensionTable("dim_table4.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating dim table from: dim_table4.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
}
private void createFacts() throws JAXBException, IOException {
- FactTable fact = (FactTable)readFromXML("fact1.xml");
- XStorageTables storageTables = (XStorageTables)readFromXML("fact1-storage-tables.xml");
- if (fact != null && storageTables != null) {
- result = metaClient.createFactTable(fact, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating fact table from: fact1.xml and fact1-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createFactTable("fact1.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating fact table from: fact1.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- fact = (FactTable)readFromXML("fact2.xml");
- storageTables = (XStorageTables)readFromXML("fact2-storage-tables.xml");
- if (fact != null && storageTables != null) {
- result = metaClient.createFactTable(fact, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating fact table from: fact2.xml and fact2-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createFactTable("fact2.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating fact table from: fact2.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
- fact = (FactTable)readFromXML("rawfact.xml");
- storageTables = (XStorageTables)readFromXML("rawfact-storage-tables.xml");
- if (fact != null && storageTables != null) {
- result = metaClient.createFactTable(fact, storageTables);
- if (result.getStatus().equals(APIResult.Status.FAILED)) {
- System.out.println("Creating fact table from: rawfact.xml and rawfact-storage-tables.xml failed");
- retCode = 1;
- }
+ result = metaClient.createFactTable("rawfact.xml");
+ if (result.getStatus().equals(APIResult.Status.FAILED)) {
+ System.out.println("Creating fact table from: rawfact.xml failed, reason:" + result.getMessage());
+ retCode = 1;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/resources/db-storage.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/db-storage.xml b/lens-examples/src/main/resources/db-storage.xml
index cfa54b2..2d10569 100644
--- a/lens-examples/src/main/resources/db-storage.xml
+++ b/lens-examples/src/main/resources/db-storage.xml
@@ -1,28 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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 classname="org.apache.lens.storage.db.DBStorage" name="mydb"
- xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_storage classname="org.apache.lens.storage.db.DBStorage" name="mydb" xmlns="uri:lens:cube:0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<properties>
- <properties name="lens.storage.db.url" value="file:///tmp/db-storage.db"/>
+ <property name="lens.storage.db.url" value="file:///tmp/db-storage.db" />
</properties>
</x_storage>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/resources/dim1-local-part.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/dim1-local-part.xml b/lens-examples/src/main/resources/dim1-local-part.xml
index 961a137..923717d 100644
--- a/lens-examples/src/main/resources/dim1-local-part.xml
+++ b/lens-examples/src/main/resources/dim1-local-part.xml
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_partition
-cube_table_name="dim_table"
-location="examples/data/dim1_local"
-update_period="hourly"
-xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_partition fact_or_dimension_table_name="dim_table" location="examples/data/dim1_local" update_period="HOURLY"
+ xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<time_partition_spec>
- <part_spec_element key="dt" value="2014-03-27T12:00:00"/>
+ <part_spec_element key="dt" value="2014-03-27T12:00:00" />
</time_partition_spec>
</x_partition>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/resources/dim1-storage-tables.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/dim1-storage-tables.xml b/lens-examples/src/main/resources/dim1-storage-tables.xml
deleted file mode 100644
index 98f6d35..0000000
--- a/lens-examples/src/main/resources/dim1-storage-tables.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_storage_tables xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <storage_tables>
- <update_periods>hourly</update_periods>
- <storage_name>local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/dim1">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
- </part_cols>
- <time_part_cols>dt</time_part_cols>
- </table_desc>
- </storage_tables>
-</x_storage_tables>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/resources/dim2-local-part.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/dim2-local-part.xml b/lens-examples/src/main/resources/dim2-local-part.xml
index 31bdd7e..b6f727b 100644
--- a/lens-examples/src/main/resources/dim2-local-part.xml
+++ b/lens-examples/src/main/resources/dim2-local-part.xml
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
+ 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
+ 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.
+ 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_partition
-cube_table_name="dim_table2"
-location="examples/data/dim2_local"
-update_period="hourly"
-xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
+<x_partition fact_or_dimension_table_name="dim_table2" location="examples/data/dim2_local" update_period="HOURLY"
+ xmlns="uri:lens:cube:0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
<time_partition_spec>
- <part_spec_element key="dt" value="2014-03-27T12:00:00"/>
+ <part_spec_element key="dt" value="2014-03-27T12:00:00" />
</time_partition_spec>
</x_partition>
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/a4f18620/lens-examples/src/main/resources/dim2-storage-tables.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/dim2-storage-tables.xml b/lens-examples/src/main/resources/dim2-storage-tables.xml
deleted file mode 100644
index acf84d0..0000000
--- a/lens-examples/src/main/resources/dim2-storage-tables.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<x_storage_tables xmlns="uri:lens:cube:0.1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd ">
- <storage_tables>
- <update_periods>hourly,daily</update_periods>
- <storage_name>local</storage_name>
- <table_desc
- external="true"
- field_delimiter=","
- table_location="/tmp/examples/dim2">
- <table_parameters/>
- <serde_parameters/>
- <part_cols>
- <columns comment="Time column" name="dt" type="string"/>
- </part_cols>
- <time_part_cols>dt</time_part_cols>
- </table_desc>
- </storage_tables>
-</x_storage_tables>