Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4a2c943
CRUD Changes for Virtual Fact
Apr 20, 2017
0c326b2
Test cases for CRUD Virtual Fact
Apr 27, 2017
93793d1
Removing unused import
Apr 27, 2017
f764fbe
Checkstyle correction
Apr 27, 2017
e8a4a77
checkstyle fix
Apr 27, 2017
2142f78
Changes post comments
May 3, 2017
65f6e2e
Changes post comments
May 3, 2017
5d559b2
checkstyle fixes
May 3, 2017
4e30adf
checkstyle fix
May 3, 2017
4deb9dd
checkstyle fix
May 3, 2017
7710ac3
Test cases fix post refactoring
May 4, 2017
fd0eafa
Test cases fix post refactoring
May 4, 2017
bb3796a
changes for review comments
May 5, 2017
d03af69
changes for review comments
May 5, 2017
4c156d4
Test case fix
May 7, 2017
838802b
Test case fix
May 7, 2017
e5a49a0
checkstyle fix
May 8, 2017
5574835
checkstyle fix
May 8, 2017
35e1582
checkstyle fix
May 8, 2017
a49eec9
checkstyle fix
May 8, 2017
d522a4c
More changes
May 11, 2017
6d48eaf
More changes
May 11, 2017
ff70054
More changes for virtual fact
May 12, 2017
0327a88
More changes for vf
May 12, 2017
1740db3
Fix in storage candidate
May 12, 2017
fd9b9b1
Fix in storage candidate
May 12, 2017
7641913
Changes for vf
May 12, 2017
da45d17
Changes for vf
May 12, 2017
cd387d6
Changes for vf
May 15, 2017
b7d71ce
Changes for vf
May 15, 2017
a4eef32
Changes for vf
May 15, 2017
3fc606b
Changes for vf
May 15, 2017
5b6936e
review changes
May 16, 2017
e0ff6fb
review changes
May 16, 2017
069c40c
review changes
May 16, 2017
46dd86f
review changes
May 16, 2017
936671e
review changes
May 16, 2017
35ddf0f
Merge branch 'master' of https://github.com/apache/lens into my_new_m…
May 16, 2017
1e5954e
review changes
May 17, 2017
6e0fcb6
review changes
May 17, 2017
f01d7a1
review changes
May 17, 2017
239d0ff
review changes
May 17, 2017
eb4c034
review changes
May 17, 2017
1126f83
review changes
May 18, 2017
71000ef
review changes
May 18, 2017
f6595ed
More changes for vf
May 19, 2017
903adf9
More changes for vf
May 19, 2017
d99e9ed
More changes for vf
May 19, 2017
8503d0c
vf changes
May 22, 2017
9bd4442
vf changes
May 22, 2017
5016add
test resource
May 30, 2017
3f7394e
Merge branch 'master' of https://github.com/apache/lens into my_new_m…
May 30, 2017
8ccce80
Merge branch 'develop' of https://github.com/InMobi/grill into my_new…
May 30, 2017
823cb52
sync with master and inmobi develop
May 30, 2017
ab603a6
sync with master and inmobi develop
May 30, 2017
88517e0
Adding virtual fact cli test case
May 31, 2017
797f1c4
Bug fixes
May 31, 2017
3daf296
Bug fixes
May 31, 2017
a07b354
Bug fixes
May 31, 2017
5e97771
Adding virtual fact cli test case
May 31, 2017
172bdd3
checkstyle fix
May 31, 2017
0057767
Fixed expression resolver bug
prongs May 31, 2017
6918421
checkstyle fix
Jun 1, 2017
904bac4
checkstyle fix
Jun 1, 2017
5152407
test case fix
Jun 1, 2017
cfefeb7
fixing tests
prongs Jun 1, 2017
41ff208
Merge remote-tracking branch 'rajitha/my_new_master' into expression_…
prongs Jun 1, 2017
e6b974f
checkstyle fix
Jun 1, 2017
069decd
checkstyle fix
Jun 1, 2017
0db2c51
Merge remote-tracking branch 'rajitha/my_new_master' into expression_…
prongs Jun 2, 2017
c5e751d
findbugs
prongs Jun 2, 2017
3d943e5
vf+seg combo bugs
prongs Jun 2, 2017
5f5aba4
Dynamic segmentation weight
prongs Jun 5, 2017
ed51d14
VF bugs
prongs Jun 5, 2017
300f2d1
VF bugs: iteration 2
prongs Jun 5, 2017
2dbf754
Sushil:LENS-1429
prongs Jun 5, 2017
ab0bef9
merge
prongs Jun 6, 2017
8649788
merge with master
prongs Jun 6, 2017
958e3f6
fixing broken tests
prongs Jun 6, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class SchemaTraverser implements Runnable {
types.put("cubes/derived", XDerivedCube.class);
types.put("dimensions", XDimension.class);
types.put("facts", XFactTable.class);
types.put("facts/virtual", XVirtualFactTable.class);
types.put("dimtables", XDimensionTable.class);
types.put("dimensiontables", XDimensionTable.class);
types.put("dimensiontables", XDimensionTable.class);
Expand Down
176 changes: 92 additions & 84 deletions lens-api/src/main/resources/cube-0.1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -168,76 +168,6 @@
</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>
Expand Down Expand Up @@ -1287,9 +1217,99 @@
</xs:sequence>
</xs:complexType>

<xs:element name="x_fact" type="x_fact"/>

<xs:complexType name="x_fact" abstract="true">
<xs:annotation>
<xs:documentation>
XFact can either be a Cube Fact for which the user would give the full specification of the
columns and storages
or can be a Virtual fact, for which the user would specify only the Source fact and filters if any.
Virtual fact derives its columns and storage specific details all from the source Fact. It can however have
different properties associated with it than the source.
</xs:documentation>
</xs:annotation>
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="description"/>
<xs:attribute type="xs:string" name="cube_name" use="required">
<xs:annotation>
<xs:documentation>
The cube's name to which the fact is associated.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:element name="x_virtual_fact_table" type="x_virtual_fact_table"/>
<xs:complexType name="x_virtual_fact_table">
<xs:complexContent>
<xs:extension base="x_fact">
<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 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:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="x_fact_table" type="x_fact_table"/>

<xs:complexType name="x_fact_table">
<xs:complexContent>
<xs:extension base="x_fact">
<xs:annotation>
<xs:documentation>
Fact table that is associated to a base cube. The columns in the fact table will be a subset of
Expand Down Expand Up @@ -1334,20 +1354,6 @@
</xs:element>
<xs:element name="storage_tables" type="x_storage_tables" maxOccurs="1" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
The fact table name.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cube_name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>
The base cube's name to which the fact_table is associated.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="weight" use="required" >
<xs:annotation>
<xs:documentation>
Expand All @@ -1361,6 +1367,8 @@
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:element name="x_segmentation" type="x_segmentation"/>
Expand Down
6 changes: 6 additions & 0 deletions lens-api/src/main/resources/lens-errors.conf
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ lensCubeErrorsForMetastore = [
errorMsg = "Partition filter can not be null or empty"
}

{
errorCode = 3106
httpStatusCode = ${BAD_REQUEST}
errorMsg = "Fact %s not of type %s"
}

]

lensDriverErrors = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

import org.apache.lens.api.APIResult;
import org.apache.lens.api.metastore.XFactTable;
import org.apache.lens.api.metastore.XFact;
import org.apache.lens.api.metastore.XPartition;
import org.apache.lens.api.metastore.XStorageTableElement;
import org.apache.lens.cli.commands.annotations.UserDocumentation;
Expand All @@ -39,7 +39,7 @@
@Component
@UserDocumentation(title = "Commands for Facts Management",
description = "These command provide CRUD for facts, associated storages, and fact partitions")
public class LensFactCommands extends LogicalTableCrudCommand<XFactTable> {
public class LensFactCommands extends LogicalTableCrudCommand<XFact> {

/**
* Show facts.
Expand Down Expand Up @@ -352,7 +352,7 @@ protected APIResult doCreate(String path, boolean ignoreIfExists) {
}

@Override
protected XFactTable doRead(String name) {
protected XFact doRead(String name) {
return getClient().getFactTable(name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.lens.api.metastore.SchemaTraverser;
import org.apache.lens.api.metastore.XBaseCube;
import org.apache.lens.api.metastore.XDerivedCube;
import org.apache.lens.api.metastore.XDimension;
import org.apache.lens.api.metastore.XDimensionTable;
import org.apache.lens.api.metastore.XFactTable;
import org.apache.lens.api.metastore.XSegmentation;
import org.apache.lens.api.metastore.XStorage;
import org.apache.lens.api.metastore.*;
import org.apache.lens.cli.commands.annotations.UserDocumentation;

import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -81,7 +74,12 @@ public class LensSchemaCommands implements CommandMarker {
+ "|\n"
+ "|-- facts\n"
+ " |-- fact1.xml\n"
+ " |-- fact2.xml\n\n\n"
+ " |-- fact2.xml\n"
+ "| |\n"
+ "| |-- virtual\n"
+ "| | |-- virtual_fact1.xml\n"
+ "| | |-- virtual_fact2.xml\n"
+ "| |\n\n\n"
+ "If your cubes are divided between base and derived cubes,\nit makes sense to seperate into two directories, "
+ "since derived cubes can't be created unless base cube exists.\nIn the other case you can keep them in the cubes "
+ "directory itself.\nFor dimtables, you can keep your schema files in a directory named either dimtables or "
Expand Down Expand Up @@ -114,6 +112,8 @@ public class LensSchemaCommands implements CommandMarker {
UPDATE_COMMAND_MAP.put(XDimensionTable.class, "update dimtable --dimtable_name %s --path %s");
CREATE_COMMAND_MAP.put(XFactTable.class, "create fact --path %s");
UPDATE_COMMAND_MAP.put(XFactTable.class, "update fact --fact_name %s --path %s");
CREATE_COMMAND_MAP.put(XVirtualFactTable.class, "create fact --path %s");
UPDATE_COMMAND_MAP.put(XVirtualFactTable.class, "update fact --name %s --path %s");
CREATE_COMMAND_MAP.put(XSegmentation.class, "create segmentation --path %s");
UPDATE_COMMAND_MAP.put(XSegmentation.class, "update segmentation --name %s --path %s");
}
Expand Down
Loading