org.apache.lens.cube.metadata
Class Cube

java.lang.Object
  extended by org.apache.lens.cube.metadata.AbstractCubeTable
      extended by org.apache.lens.cube.metadata.AbstractBaseTable
          extended by org.apache.lens.cube.metadata.Cube
All Implemented Interfaces:
CubeInterface, Named

public class Cube
extends AbstractBaseTable
implements CubeInterface


Field Summary
 
Fields inherited from class org.apache.lens.cube.metadata.AbstractCubeTable
LOG
 
Constructor Summary
Cube(String name, Set<CubeMeasure> measures, Set<CubeDimAttribute> dimensions)
           
Cube(String name, Set<CubeMeasure> measures, Set<CubeDimAttribute> dimensions, Map<String,String> properties)
           
Cube(String name, Set<CubeMeasure> measures, Set<CubeDimAttribute> dimensions, Map<String,String> properties, double weight)
           
Cube(String name, Set<CubeMeasure> measures, Set<CubeDimAttribute> dimensions, Set<ExprColumn> expressions, Set<JoinChain> joinChains, Map<String,String> properties, double weight)
           
Cube(org.apache.hadoop.hive.ql.metadata.Table tbl)
           
 
Method Summary
 void addProperties()
           
 void addTimedDimension(String timedDimension)
          Adds the timed dimension
 boolean allFieldsQueriable()
          Whether all the fields of cube can be queried.
 void alterDimension(CubeDimAttribute dimension)
          Alters the dimension if already existing or just adds if it is new dimension
 void alterMeasure(CubeMeasure measure)
          Alters the measure if already existing or just adds if it is new measure.
 boolean equals(Object obj)
           
 Set<String> getAllFieldNames()
          Get all field names reachable from cube
 CubeColumn getColumnByName(String column)
          Get cube column given by column name.
 CubeDimAttribute getDimAttributeByName(String dimension)
          Get dimension attribute given by name
 Set<String> getDimAttributeNames()
          Get all dimension attribute names
 Set<CubeDimAttribute> getDimAttributes()
          Get all dimension attributes of the cube
static Set<CubeDimAttribute> getDimensions(String name, Map<String,String> props)
           
 CubeMeasure getMeasureByName(String measure)
          Get measure by given by name
 Set<String> getMeasureNames()
          Get all measure names
 Set<CubeMeasure> getMeasures()
          Get all measures of the cube
static Set<CubeMeasure> getMeasures(String name, Map<String,String> props)
           
 String getPartitionColumnOfTimeDim(String timeDimName)
           
 CubeTableType getTableType()
           
 Set<String> getTimedDimensions()
          Get all timed dimensions of cube
 String getTimeDimOfPartitionColumn(String partCol)
           
 int hashCode()
           
 boolean isDerivedCube()
          Is the cube a derived cube or base cube
 void removeDimension(String dimName)
          Remove the dimension with name specified
 boolean removeJoinChain(String chainName)
          Remove the joinchain with name specified
 void removeMeasure(String msrName)
          Remove the measure with name specified
 void removeTimedDimension(String timedDimension)
          Removes the timed dimension
 
Methods inherited from class org.apache.lens.cube.metadata.AbstractBaseTable
alterExpression, alterJoinChain, getChainByName, getExpressionByName, getExpressionNames, getExpressions, getJoinChainNames, getJoinChains, getStorages, removeExpression, setJoinChainProperties
 
Methods inherited from class org.apache.lens.cube.metadata.AbstractCubeTable
addProperties, alterWeight, getColumns, getName, getProperties, getWeight, removeProperty, toString, weight
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.lens.cube.metadata.CubeInterface
getChainByName, getExpressionByName, getExpressionNames, getExpressions, getJoinChainNames, getJoinChains
 
Methods inherited from interface org.apache.lens.cube.metadata.Named
getName
 

Constructor Detail

Cube

public Cube(String name,
            Set<CubeMeasure> measures,
            Set<CubeDimAttribute> dimensions)

Cube

public Cube(String name,
            Set<CubeMeasure> measures,
            Set<CubeDimAttribute> dimensions,
            Map<String,String> properties)

Cube

public Cube(String name,
            Set<CubeMeasure> measures,
            Set<CubeDimAttribute> dimensions,
            Map<String,String> properties,
            double weight)

Cube

public Cube(String name,
            Set<CubeMeasure> measures,
            Set<CubeDimAttribute> dimensions,
            Set<ExprColumn> expressions,
            Set<JoinChain> joinChains,
            Map<String,String> properties,
            double weight)

Cube

public Cube(org.apache.hadoop.hive.ql.metadata.Table tbl)
Method Detail

getMeasures

public Set<CubeMeasure> getMeasures()
Description copied from interface: CubeInterface
Get all measures of the cube

Specified by:
getMeasures in interface CubeInterface
Returns:
set of CubeMeasure

getDimAttributes

public Set<CubeDimAttribute> getDimAttributes()
Description copied from interface: CubeInterface
Get all dimension attributes of the cube

Specified by:
getDimAttributes in interface CubeInterface
Returns:
set CubeDimAttribute

getTimedDimensions

public Set<String> getTimedDimensions()
Description copied from interface: CubeInterface
Get all timed dimensions of cube

Specified by:
getTimedDimensions in interface CubeInterface
Returns:
Set of strings

getTableType

public CubeTableType getTableType()
Specified by:
getTableType in class AbstractCubeTable

addProperties

public void addProperties()
Overrides:
addProperties in class AbstractBaseTable

getMeasures

public static Set<CubeMeasure> getMeasures(String name,
                                           Map<String,String> props)

getDimensions

public static Set<CubeDimAttribute> getDimensions(String name,
                                                  Map<String,String> props)

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractBaseTable

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractBaseTable

getDimAttributeByName

public CubeDimAttribute getDimAttributeByName(String dimension)
Description copied from interface: CubeInterface
Get dimension attribute given by name

Specified by:
getDimAttributeByName in interface CubeInterface
Parameters:
dimension - dimension attribute name
Returns:
A CubeDimAttribute object

getMeasureByName

public CubeMeasure getMeasureByName(String measure)
Description copied from interface: CubeInterface
Get measure by given by name

Specified by:
getMeasureByName in interface CubeInterface
Parameters:
measure - Measure name
Returns:
A CubeMeasure object

getColumnByName

public CubeColumn getColumnByName(String column)
Description copied from interface: CubeInterface
Get cube column given by column name.

It can be a measure, dimension attribute or an expression.

Specified by:
getColumnByName in interface CubeInterface
Overrides:
getColumnByName in class AbstractBaseTable
Parameters:
column - Column name
Returns:
A CubeColumn object

alterMeasure

public void alterMeasure(CubeMeasure measure)
                  throws org.apache.hadoop.hive.ql.metadata.HiveException
Alters the measure if already existing or just adds if it is new measure.

Parameters:
measure -
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException

removeJoinChain

public boolean removeJoinChain(String chainName)
Remove the joinchain with name specified

Overrides:
removeJoinChain in class AbstractBaseTable
Parameters:
chainName -

alterDimension

public void alterDimension(CubeDimAttribute dimension)
                    throws org.apache.hadoop.hive.ql.metadata.HiveException
Alters the dimension if already existing or just adds if it is new dimension

Parameters:
dimension -
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException

removeDimension

public void removeDimension(String dimName)
Remove the dimension with name specified

Parameters:
dimName -

removeMeasure

public void removeMeasure(String msrName)
Remove the measure with name specified

Parameters:
msrName -

addTimedDimension

public void addTimedDimension(String timedDimension)
                       throws org.apache.hadoop.hive.ql.metadata.HiveException
Adds the timed dimension

Parameters:
timedDimension -
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException

removeTimedDimension

public void removeTimedDimension(String timedDimension)
                          throws org.apache.hadoop.hive.ql.metadata.HiveException
Removes the timed dimension

Parameters:
timedDimension -
Throws:
org.apache.hadoop.hive.ql.metadata.HiveException

isDerivedCube

public boolean isDerivedCube()
Description copied from interface: CubeInterface
Is the cube a derived cube or base cube

Specified by:
isDerivedCube in interface CubeInterface
Returns:
true if cube is derived, false if it is base

getMeasureNames

public Set<String> getMeasureNames()
Description copied from interface: CubeInterface
Get all measure names

Specified by:
getMeasureNames in interface CubeInterface
Returns:
Set of strings

getDimAttributeNames

public Set<String> getDimAttributeNames()
Description copied from interface: CubeInterface
Get all dimension attribute names

Specified by:
getDimAttributeNames in interface CubeInterface
Returns:
Set of strings

allFieldsQueriable

public boolean allFieldsQueriable()
Description copied from interface: CubeInterface
Whether all the fields of cube can be queried.

If false, the fields can queried through derived cubes. Users can look at derived cube fields to know which all fields can be queried together.

If true, all the fields can be directly queried.

Specified by:
allFieldsQueriable in interface CubeInterface
Returns:
true or false

getAllFieldNames

public Set<String> getAllFieldNames()
Description copied from interface: CubeInterface
Get all field names reachable from cube

Specified by:
getAllFieldNames in interface CubeInterface
Overrides:
getAllFieldNames in class AbstractBaseTable
Returns:
Set of strings

getPartitionColumnOfTimeDim

public String getPartitionColumnOfTimeDim(String timeDimName)

getTimeDimOfPartitionColumn

public String getTimeDimOfPartitionColumn(String partCol)


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.