Search in sources :

Example 1 with ColumnSpec

use of com.sap.hadoop.windowing.query2.specification.ColumnSpec in project SQLWindowing by hbutani.

the class WindowSpecTranslation method translatePartitionColumn.

static ColumnDef translatePartitionColumn(QueryDef qDef, InputInfo iInfo, ColumnSpec cSpec) throws WindowingException {
    ColumnDef cDef = new ColumnDef(cSpec);
    translateColumn(qDef, cDef, iInfo, cSpec);
    TranslateUtils.validateComparable(cDef.getOI(), sprintf("Partition Column %s is not comparable", cSpec));
    return cDef;
}
Also used : OrderColumnDef(com.sap.hadoop.windowing.query2.definition.OrderColumnDef) ColumnDef(com.sap.hadoop.windowing.query2.definition.ColumnDef)

Example 2 with ColumnSpec

use of com.sap.hadoop.windowing.query2.specification.ColumnSpec in project SQLWindowing by hbutani.

the class WindowSpecTranslation method translatePartition.

static PartitionDef translatePartition(QueryDef qDef, InputInfo iInfo, PartitionSpec spec) throws WindowingException {
    if (spec == null || spec.getColumns() == null || spec.getColumns().size() == 0)
        return null;
    PartitionDef pDef = new PartitionDef(spec);
    for (ColumnSpec colSpec : spec.getColumns()) {
        ColumnDef cDef = translatePartitionColumn(qDef, iInfo, colSpec);
        pDef.addColumn(cDef);
    }
    return pDef;
}
Also used : OrderColumnSpec(com.sap.hadoop.windowing.query2.specification.OrderColumnSpec) ColumnSpec(com.sap.hadoop.windowing.query2.specification.ColumnSpec) PartitionDef(com.sap.hadoop.windowing.query2.definition.PartitionDef) OrderColumnDef(com.sap.hadoop.windowing.query2.definition.OrderColumnDef) ColumnDef(com.sap.hadoop.windowing.query2.definition.ColumnDef)

Example 3 with ColumnSpec

use of com.sap.hadoop.windowing.query2.specification.ColumnSpec in project SQLWindowing by hbutani.

the class OutputTranslation method translateSelectExpr.

public static ColumnDef translateSelectExpr(QueryDef qDef, InputInfo iInfo, int colIdx, String alias, ASTNode expr) throws WindowingException {
    ColumnDef cDef = new ColumnDef((ColumnSpec) null);
    ExprNodeDesc exprNode = TranslateUtils.buildExprNode(expr, iInfo.getTypeCheckCtx());
    ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(qDef.getTranslationInfo(), exprNode);
    ObjectInspector oi = TranslateUtils.initExprNodeEvaluator(qDef, exprNode, exprEval, iInfo);
    cDef.setExpression(expr);
    cDef.setExprNode(exprNode);
    cDef.setExprEvaluator(exprEval);
    cDef.setOI(oi);
    cDef.setAlias(getAlias(alias, expr, colIdx));
    return cDef;
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) ExprNodeEvaluator(org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator) ColumnDef(com.sap.hadoop.windowing.query2.definition.ColumnDef) ExprNodeDesc(org.apache.hadoop.hive.ql.plan.ExprNodeDesc)

Aggregations

ColumnDef (com.sap.hadoop.windowing.query2.definition.ColumnDef)3 OrderColumnDef (com.sap.hadoop.windowing.query2.definition.OrderColumnDef)2 PartitionDef (com.sap.hadoop.windowing.query2.definition.PartitionDef)1 ColumnSpec (com.sap.hadoop.windowing.query2.specification.ColumnSpec)1 OrderColumnSpec (com.sap.hadoop.windowing.query2.specification.OrderColumnSpec)1 ExprNodeEvaluator (org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)1