org.apache.lens.cube.parse
Class CubeQueryContext

java.lang.Object
  extended by org.apache.lens.cube.parse.CubeQueryContext

public class CubeQueryContext
extends Object


Field Summary
static String DEFAULT_TABLE
           
static org.apache.commons.logging.Log LOG
           
static String NOW
           
static String TIME_RANGE_FUNC
           
 
Constructor Summary
CubeQueryContext(org.apache.hadoop.hive.ql.parse.ASTNode ast, org.apache.hadoop.hive.ql.parse.QB qb, org.apache.hadoop.hive.conf.HiveConf conf)
           
 
Method Summary
 void addAggregateExpr(String expr)
           
 void addColumnsQueried(AbstractCubeTable table, String column)
           
 void addColumnsQueried(String alias, String column)
           
 void addDimPruningMsgs(Dimension dim, CubeDimensionTable dimtable, CandidateTablePruneCause msg)
           
 void addExprToAlias(org.apache.hadoop.hive.ql.parse.ASTNode expr, org.apache.hadoop.hive.ql.parse.ASTNode alias)
           
 void addFactPruningMsgs(CubeFactTable fact, CandidateTablePruneCause factPruningMsg)
           
 void addOptionalDimTable(String alias, String col, CandidateTable candidate, boolean isRequiredInJoin)
           
 void addQueriedDimAttrs(Set<String> dimAttrs)
           
 void addQueriedMsrs(Set<String> msrs)
           
 boolean addQueriedTable(String alias)
           
 void addSelectAlias(String alias, String spacedAlias)
           
 String getAlias(String expr)
           
 String getAliasForTabName(String tabName)
           
 JoinResolver.AutoJoinContext getAutoJoinCtx()
           
 Map<Dimension,Set<org.apache.lens.cube.parse.CandidateDim>> getCandidateDimTables()
           
 Set<org.apache.lens.cube.parse.CandidateFact> getCandidateFactTables()
           
 Set<String> getColumnsQueried(String tblName)
           
 AbstractCubeTable getCubeTableForAlias(String alias)
           
 DenormalizationResolver.DenormalizationContext getDenormCtx()
           
 Map<String,String> getExprToAliasMap()
           
 String getGroupByTree()
           
 String getHavingTree()
           
 org.apache.hadoop.hive.conf.HiveConf getHiveConf()
           
 HQLContextInterface getHqlContext()
           
 String getInsertClause()
           
 org.apache.hadoop.hive.ql.parse.ASTNode getJoinTree()
           
 Integer getLimitValue()
           
 String getNonExistingParts()
           
 Map<Dimension,org.apache.lens.cube.parse.CubeQueryContext.OptionalDimCtx> getOptionalDimensionMap()
           
 Set<Dimension> getOptionalDimensions()
           
 String getOrderByTree()
           
static String getPartitionColumnOfTimeDim(CubeInterface cube, String timeDimName)
           
 String getPartitionColumnOfTimeDim(String timeDimName)
           
 org.apache.hadoop.hive.ql.parse.QB getQB()
           
 org.apache.hadoop.hive.ql.parse.QBJoinTree getQBJoinTree()
           
 Set<String> getQueriedDimAttrs()
           
 AbstractCubeTable getQueriedTable(String alias)
           
 String getSelectAlias(int index)
           
 String getSelectFinalAlias(int index)
           
 String getSelectTree()
           
static String getTimeDimOfPartitionColumn(CubeInterface cube, String partCol)
           
 String getTimeDimOfPartitionColumn(String partCol)
           
 List<TimeRange> getTimeRanges()
           
 String getWhereTree()
           
 boolean hasAggregates()
           
 boolean hasCubeInQuery()
           
 boolean hasDimensionInQuery()
           
 boolean isAggregateExpr(String expr)
           
 boolean isAutoJoinResolved()
           
 boolean isCubeMeasure(String col)
           
 void print()
           
 void pruneCandidateFactSet(CandidateTablePruneCause.CandidateTablePruneCode pruneCause)
          Prune candidate fact sets with respect to available candidate facts.
 void pruneCandidateFactWithCandidateSet(CandidateTablePruneCause.CandidateTablePruneCode pruneCause)
          Prune candidate fact with respect to available candidate fact sets.
 void setAutoJoinCtx(JoinResolver.AutoJoinContext autoJoinCtx)
           
 void setDenormCtx(DenormalizationResolver.DenormalizationContext deNormCtx)
           
 void setJoinCond(org.apache.hadoop.hive.ql.parse.QBJoinTree qb, String cond)
           
 boolean shouldReplaceTimeDimWithPart()
           
 org.apache.hadoop.hive.ql.parse.ASTNode toAST(org.apache.hadoop.hive.ql.Context ctx)
           
 String toHQL()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_RANGE_FUNC

public static final String TIME_RANGE_FUNC
See Also:
Constant Field Values

NOW

public static final String NOW
See Also:
Constant Field Values

DEFAULT_TABLE

public static final String DEFAULT_TABLE
See Also:
Constant Field Values

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

CubeQueryContext

public CubeQueryContext(org.apache.hadoop.hive.ql.parse.ASTNode ast,
                        org.apache.hadoop.hive.ql.parse.QB qb,
                        org.apache.hadoop.hive.conf.HiveConf conf)
                 throws org.apache.hadoop.hive.ql.parse.SemanticException
Throws:
org.apache.hadoop.hive.ql.parse.SemanticException
Method Detail

hasCubeInQuery

public boolean hasCubeInQuery()

hasDimensionInQuery

public boolean hasDimensionInQuery()

addQueriedTable

public boolean addQueriedTable(String alias)
                        throws org.apache.hadoop.hive.ql.parse.SemanticException
Throws:
org.apache.hadoop.hive.ql.parse.SemanticException

isAutoJoinResolved

public boolean isAutoJoinResolved()

addOptionalDimTable

public void addOptionalDimTable(String alias,
                                String col,
                                CandidateTable candidate,
                                boolean isRequiredInJoin)
                         throws org.apache.hadoop.hive.ql.parse.SemanticException
Throws:
org.apache.hadoop.hive.ql.parse.SemanticException

getCubeTableForAlias

public AbstractCubeTable getCubeTableForAlias(String alias)

getQB

public org.apache.hadoop.hive.ql.parse.QB getQB()

getCandidateFactTables

public Set<org.apache.lens.cube.parse.CandidateFact> getCandidateFactTables()

getCandidateDimTables

public Map<Dimension,Set<org.apache.lens.cube.parse.CandidateDim>> getCandidateDimTables()

addFactPruningMsgs

public void addFactPruningMsgs(CubeFactTable fact,
                               CandidateTablePruneCause factPruningMsg)

addDimPruningMsgs

public void addDimPruningMsgs(Dimension dim,
                              CubeDimensionTable dimtable,
                              CandidateTablePruneCause msg)

getAliasForTabName

public String getAliasForTabName(String tabName)

print

public void print()

getSelectTree

public String getSelectTree()

getWhereTree

public String getWhereTree()

getGroupByTree

public String getGroupByTree()

getHavingTree

public String getHavingTree()

getJoinTree

public org.apache.hadoop.hive.ql.parse.ASTNode getJoinTree()

getQBJoinTree

public org.apache.hadoop.hive.ql.parse.QBJoinTree getQBJoinTree()

getOrderByTree

public String getOrderByTree()

getLimitValue

public Integer getLimitValue()

getNonExistingParts

public String getNonExistingParts()

toHQL

public String toHQL()
             throws org.apache.hadoop.hive.ql.parse.SemanticException
Throws:
org.apache.hadoop.hive.ql.parse.SemanticException

toAST

public org.apache.hadoop.hive.ql.parse.ASTNode toAST(org.apache.hadoop.hive.ql.Context ctx)
                                              throws org.apache.hadoop.hive.ql.parse.SemanticException
Throws:
org.apache.hadoop.hive.ql.parse.SemanticException

getColumnsQueried

public Set<String> getColumnsQueried(String tblName)

addColumnsQueried

public void addColumnsQueried(AbstractCubeTable table,
                              String column)

addColumnsQueried

public void addColumnsQueried(String alias,
                              String column)

isCubeMeasure

public boolean isCubeMeasure(String col)

isAggregateExpr

public boolean isAggregateExpr(String expr)

hasAggregates

public boolean hasAggregates()

getAlias

public String getAlias(String expr)

getSelectAlias

public String getSelectAlias(int index)

getSelectFinalAlias

public String getSelectFinalAlias(int index)

getExprToAliasMap

public Map<String,String> getExprToAliasMap()

addAggregateExpr

public void addAggregateExpr(String expr)

setJoinCond

public void setJoinCond(org.apache.hadoop.hive.ql.parse.QBJoinTree qb,
                        String cond)

getQueriedTable

public AbstractCubeTable getQueriedTable(String alias)

getInsertClause

public String getInsertClause()

addExprToAlias

public void addExprToAlias(org.apache.hadoop.hive.ql.parse.ASTNode expr,
                           org.apache.hadoop.hive.ql.parse.ASTNode alias)

addSelectAlias

public void addSelectAlias(String alias,
                           String spacedAlias)

getTimeRanges

public List<TimeRange> getTimeRanges()

getHiveConf

public org.apache.hadoop.hive.conf.HiveConf getHiveConf()

setAutoJoinCtx

public void setAutoJoinCtx(JoinResolver.AutoJoinContext autoJoinCtx)

getAutoJoinCtx

public JoinResolver.AutoJoinContext getAutoJoinCtx()

setDenormCtx

public void setDenormCtx(DenormalizationResolver.DenormalizationContext deNormCtx)

getDenormCtx

public DenormalizationResolver.DenormalizationContext getDenormCtx()

getOptionalDimensions

public Set<Dimension> getOptionalDimensions()

getOptionalDimensionMap

public Map<Dimension,org.apache.lens.cube.parse.CubeQueryContext.OptionalDimCtx> getOptionalDimensionMap()

getHqlContext

public HQLContextInterface getHqlContext()
Returns:
the hqlContext

shouldReplaceTimeDimWithPart

public boolean shouldReplaceTimeDimWithPart()

getPartitionColumnOfTimeDim

public String getPartitionColumnOfTimeDim(String timeDimName)

getPartitionColumnOfTimeDim

public static String getPartitionColumnOfTimeDim(CubeInterface cube,
                                                 String timeDimName)

getTimeDimOfPartitionColumn

public String getTimeDimOfPartitionColumn(String partCol)

getTimeDimOfPartitionColumn

public static String getTimeDimOfPartitionColumn(CubeInterface cube,
                                                 String partCol)

getQueriedDimAttrs

public Set<String> getQueriedDimAttrs()
Returns:
the queriedDimAttrs

addQueriedDimAttrs

public void addQueriedDimAttrs(Set<String> dimAttrs)

addQueriedMsrs

public void addQueriedMsrs(Set<String> msrs)

pruneCandidateFactSet

public void pruneCandidateFactSet(CandidateTablePruneCause.CandidateTablePruneCode pruneCause)
Prune candidate fact sets with respect to available candidate facts.

Prune a candidate set, if any of the fact is missing.

Parameters:
pruneCause -

pruneCandidateFactWithCandidateSet

public void pruneCandidateFactWithCandidateSet(CandidateTablePruneCause.CandidateTablePruneCode pruneCause)
Prune candidate fact with respect to available candidate fact sets.

If candidate fact is not present in any of the candidate fact sets, remove it.

Parameters:
pruneCause -


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