Repository: lens Updated Branches: refs/heads/master c4cd6d84e -> cf944c10c
LENS-1405 : Add xsd for virtual fact Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/cf944c10 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/cf944c10 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/cf944c10 Branch: refs/heads/master Commit: cf944c10c7fe68c151e2967612864251a72814ef Parents: c4cd6d8 Author: Rajitha R <rajitha....@gmail.com> Authored: Wed Apr 19 12:11:22 2017 +0530 Committer: Amareshwari Sriramadasu <amareshw...@apache.org> Committed: Wed Apr 19 12:11:22 2017 +0530 ---------------------------------------------------------------------- lens-api/src/main/resources/cube-0.1.xsd | 70 ++++++++++++++++++++ .../src/main/resources/virtualfact1.xml | 27 ++++++++ 2 files changed, 97 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/cf944c10/lens-api/src/main/resources/cube-0.1.xsd ---------------------------------------------------------------------- diff --git a/lens-api/src/main/resources/cube-0.1.xsd b/lens-api/src/main/resources/cube-0.1.xsd index 1d8a624..68ccc13 100644 --- a/lens-api/src/main/resources/cube-0.1.xsd +++ b/lens-api/src/main/resources/cube-0.1.xsd @@ -168,6 +168,76 @@ </xs:complexContent> </xs:complexType> + <xs:element name="x_virtual_fact_table" type="x_virtual_fact_table"/> + <xs:complexType name="x_virtual_fact_table"> + <xs:annotation> + <xs:documentation> + Virtual fact extends fact. It can override the cube of its source fact. It can have different + properties associated with it than its source. + Properties that can be set for a virtual fact are : + - Filters which would be added in query rewriting + </xs:documentation> + </xs:annotation> + <xs:sequence> + <xs:element type="x_properties" name="properties" maxOccurs="1" minOccurs="0"> + <xs:annotation> + <xs:documentation> + Properties that can be set for a virtual fact are + 1. cube.fact.query.where.filter : filter string that needs to be added in WHERE clause. This string would be added as an additional + filter when the query is being constructed in the cube query writing phase. + 2. cube.fact.absolute.start.time: start time of the fact. For queries that ask for time before this, + this fact is not a candidate. Time format can be as you would specify in the time_range_in clause. + i.e. yyyy[-mm[-dd[-hh[:MM[:ss[,SSS]]]]]] + 3. cube.fact.relative.start.time: Here you can specify fact's relative validity relative to current time. + Useful if you want to specify e.g. this fact is valid for today - 90 days. Can be specified as just + a time difference e.g. "-90 days". Or can be specified in relative syntax. + e.g. now.year or now.day - 6 hour etc. + 4. cube.fact.absolute.end.time: If you're deprecating this fact, put the final date till which the data of + the fact will be valid here. Format same as absolute start time. + 5. cube.fact.relative.end.time: You can specify the end date for fact table + relative to current date e.g. fact table is valid for next 90days starting from today. + This can be specified as just a time difference e.g. "+90 days" + + </xs:documentation> + </xs:annotation> + </xs:element> + </xs:sequence> + <xs:attribute type="xs:string" name="source_fact_name" use="required"> + <xs:annotation> + <xs:documentation> + The Source fact name over which the Virtual fact is defined. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="cube_name" use="required"> + <xs:annotation> + <xs:documentation> + The base cube's name to which the Virtual fact is associated. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="name" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation> + The virtual fact table name. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="weight" use="optional" > + <xs:annotation> + <xs:documentation> + The weight of the fact table. LENS will use this attribute to decide the lightest table to query when there + are more than one eligible tables. If not defined, the source fact weight would be picked up. + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:double"> + <xs:minInclusive value="0"></xs:minInclusive> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + <xs:element name="x_derived_cube" type="x_derived_cube"/> <xs:complexType name="x_derived_cube"> <xs:annotation> http://git-wip-us.apache.org/repos/asf/lens/blob/cf944c10/lens-examples/src/main/resources/virtualfact1.xml ---------------------------------------------------------------------- diff --git a/lens-examples/src/main/resources/virtualfact1.xml b/lens-examples/src/main/resources/virtualfact1.xml new file mode 100644 index 0000000..c89a9c5 --- /dev/null +++ b/lens-examples/src/main/resources/virtualfact1.xml @@ -0,0 +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 + + 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_virtual_fact_table source_fact_name="fact1" cube_name="sample_cube" name="virtualfact1" xmlns="uri:lens:cube:0.1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="uri:lens:cube:0.1 cube-0.1.xsd "> + <properties> + <property name="cube.fact.query.where.filter" value=" dim1 = 10 "/> + </properties> +</x_virtual_fact_table>