use of org.apache.hadoop.hive.ql.parse.TypeCheckCtx in project SQLWindowing by hbutani.
the class ResultExpressionParser method setupSelectListInputInfo.
private void setupSelectListInputInfo() throws WindowingException {
selectListInputRowResolver = HiveUtils.getRowResolver("npathInput", selectListInputOI);
selectListInputTypeCheckCtx = new TypeCheckCtx(selectListInputRowResolver);
selectListInputTypeCheckCtx.setUnparseTranslator(null);
}
use of org.apache.hadoop.hive.ql.parse.TypeCheckCtx in project SQLWindowing by hbutani.
the class WindowingTypeCheckProcFactory method processGByExpr.
/**
* Function to do groupby subexpression elimination. This is called by all
* the processors initially. As an example, consider the query select a+b,
* count(1) from T group by a+b; Then a+b is already precomputed in the
* group by operators key, so we substitute a+b in the select list with the
* internal column name of the a+b expression that appears in the in input
* row resolver.
*
* @param nd
* The node that is being inspected.
* @param procCtx
* The processor context.
*
* @return exprNodeColumnDesc.
*/
public static ExprNodeDesc processGByExpr(Node nd, Object procCtx) throws SemanticException {
// We recursively create the exprNodeDesc. Base cases: when we encounter
// a column ref, we convert that into an exprNodeColumnDesc; when we
// encounter
// a constant, we convert that into an exprNodeConstantDesc. For others
// we
// just
// build the exprNodeFuncDesc with recursively built children.
ASTNode expr = (ASTNode) nd;
TypeCheckCtx ctx = (TypeCheckCtx) procCtx;
RowResolver input = ctx.getInputRR();
ExprNodeDesc desc = null;
// If the current subExpression is pre-calculated, as in Group-By etc.
ColumnInfo colInfo = input.getExpression(expr);
if (colInfo != null) {
desc = new ExprNodeColumnDesc(colInfo.getType(), colInfo.getInternalName(), colInfo.getTabAlias(), colInfo.getIsVirtualCol());
// }
return desc;
}
return desc;
}
Aggregations