RowResolver input = ctx.getInputRR(); if(input == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr), expr); return null; ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr), expr); return null; ctx.setError(ErrorMsg.NON_KEY_EXPR_IN_GROUPBY.getMsg(exprNode), expr); return null; } else { String reason = String.format("(possible column names are: %s)", StringUtils.join(possibleColumnNames, ", ")); ctx.setError(ErrorMsg.INVALID_TABLE_OR_COLUMN.getMsg(expr.getChild(0), reason), expr); LOG.debug(ErrorMsg.INVALID_TABLE_OR_COLUMN.toString() + ":"
ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr), expr); return null; ctx.setError(ErrorMsg.NON_KEY_EXPR_IN_GROUPBY.getMsg(exprNode), expr); return null; } else { String reason = String.format("(possible column names are: %s)", StringUtils.join(possibleColumnNames, ", ")); ctx.setError(ErrorMsg.INVALID_TABLE_OR_COLUMN.getMsg(expr.getChild(0), reason), expr); LOG.debug(ErrorMsg.INVALID_TABLE_OR_COLUMN.toString() + ":"
@Override protected ExprNodeColumnDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. ColumnInfo colInfo = getColInfo((JoinTypeCheckCtx) ctx, tableAlias, ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(), expr); if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return new ExprNodeColumnDesc(colInfo.getType(), colInfo.getInternalName(), tableAlias, colInfo.getIsVirtualCol()); }
@Override protected ExprNodeColumnDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. ColumnInfo colInfo = getColInfo((JoinTypeCheckCtx) ctx, tableAlias, ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(), expr); if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return new ExprNodeColumnDesc(colInfo.getType(), colInfo.getInternalName(), tableAlias, colInfo.getIsVirtualCol()); }
protected ExprNodeDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { RowResolver input = ctx.getInputRR(); String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. String colName; if (nodeOutputs[1] instanceof ExprNodeConstantDesc) { colName = ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(); } else if (nodeOutputs[1] instanceof ExprNodeColumnDesc) { colName = ((ExprNodeColumnDesc)nodeOutputs[1]).getColumn(); } else { throw new SemanticException("Unexpected ExprNode : " + nodeOutputs[1]); } ColumnInfo colInfo = input.get(tableAlias, colName); // Try outer Row resolver if(colInfo == null && ctx.getOuterRR() != null) { RowResolver outerRR = ctx.getOuterRR(); colInfo = outerRR.get(tableAlias, colName); } if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return toExprNodeDesc(colInfo); }
protected ExprNodeDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { RowResolver input = ctx.getInputRR(); String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. String colName; if (nodeOutputs[1] instanceof ExprNodeConstantDesc) { colName = ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(); } else if (nodeOutputs[1] instanceof ExprNodeColumnDesc) { colName = ((ExprNodeColumnDesc)nodeOutputs[1]).getColumn(); } else { throw new SemanticException("Unexpected ExprNode : " + nodeOutputs[1]); } ColumnInfo colInfo = input.get(tableAlias, colName); // Try outer Row resolver if(colInfo == null && ctx.getOuterRR() != null) { RowResolver outerRR = ctx.getOuterRR(); colInfo = outerRR.get(tableAlias, colName); } if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return toExprNodeDesc(colInfo); }
ctx.setError(ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg(sqNode, "Currently only IN & EXISTS SubQuery expressions are allowed"), sqNode);
ctx.setError(ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg(sqNode, "Currently only IN & EXISTS SubQuery expressions are allowed"), sqNode);
ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr), expr); return null; ctx.setError(ErrorMsg.NON_KEY_EXPR_IN_GROUPBY.getMsg(exprNode), expr); return null; } else { String reason = String.format("(possible column names are: %s)", StringUtils.join(possibleColumnNames, ", ")); ctx.setError(ErrorMsg.INVALID_TABLE_OR_COLUMN.getMsg(expr.getChild(0), reason), expr); LOG.debug(ErrorMsg.INVALID_TABLE_OR_COLUMN.toString() + ":"
protected ExprNodeDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { RowResolver input = ctx.getInputRR(); String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. String colName; if (nodeOutputs[1] instanceof ExprNodeConstantDesc) { colName = ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(); } else if (nodeOutputs[1] instanceof ExprNodeColumnDesc) { colName = ((ExprNodeColumnDesc)nodeOutputs[1]).getColumn(); } else { throw new SemanticException("Unexpected ExprNode : " + nodeOutputs[1]); } ColumnInfo colInfo = input.get(tableAlias, colName); if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return toExprNodeDesc(colInfo); }
ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr), expr); return null; if (colInfo != null) { ctx.setError(ErrorMsg.AMBIGUOUS_TABLE_OR_COLUMN.getMsg(expr), expr); return null; } else { ctx.setError(ErrorMsg.NON_KEY_EXPR_IN_GROUPBY.getMsg(expr), expr); return null; } else { ctx.setError(ErrorMsg.INVALID_TABLE_OR_COLUMN.getMsg(expr .getChild(0)), expr); LOG.debug(ErrorMsg.INVALID_TABLE_OR_COLUMN.toString() + ":"
@Override protected ExprNodeColumnDesc processQualifiedColRef(TypeCheckCtx ctx, ASTNode expr, Object... nodeOutputs) throws SemanticException { String tableAlias = BaseSemanticAnalyzer.unescapeIdentifier(expr.getChild(0).getChild(0) .getText()); // NOTE: tableAlias must be a valid non-ambiguous table alias, // because we've checked that in TOK_TABLE_OR_COL's process method. ColumnInfo colInfo = getColInfo((JoinTypeCheckCtx) ctx, tableAlias, ((ExprNodeConstantDesc) nodeOutputs[1]).getValue().toString(), expr); if (colInfo == null) { ctx.setError(ErrorMsg.INVALID_COLUMN.getMsg(expr.getChild(1)), expr); return null; } return new ExprNodeColumnDesc(colInfo.getType(), colInfo.getInternalName(), tableAlias, colInfo.getIsVirtualCol()); }
@Override public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { TypeCheckCtx ctx = (TypeCheckCtx) procCtx; if (ctx.getError() != null) { return null; } ASTNode expr = (ASTNode) nd; ASTNode sqNode = (ASTNode) expr.getParent().getChild(1); if (!ctx.getallowSubQueryExpr()) throw new SemanticException(SemanticAnalyzer.generateErrorMessage(sqNode, ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg())); ExprNodeDesc desc = TypeCheckProcFactory.processGByExpr(nd, procCtx); if (desc != null) { return desc; } /* * Restriction.1.h :: SubQueries only supported in the SQL Where Clause. */ ctx.setError(ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg(sqNode, "Currently SubQuery expressions are only allowed as Where Clause predicates"), sqNode); return null; } }