Paul Rogers created IMPALA-7900: ----------------------------------- Summary: Constant SELECT stmt base table expression is inconsistent Key: IMPALA-7900 URL: https://issues.apache.org/jira/browse/IMPALA-7900 Project: IMPALA Issue Type: Bug Components: Frontend Affects Versions: Impala 3.0 Reporter: Paul Rogers Assignee: Paul Rogers
A SELECT statement has three independent copies of the SELECT list expressions: * The SELECT list itself, as provided by the parser * The result expressions, which represents the output tuple * The Base table result expressions, maintained by the QueryStmt When using a constant expression, the base table list is out of sync with the other two: {code:java} String query = "SELECT 1 + 1 AS c" + " from functional.alltypestiny"; AnalysisContext ctx = createAnalysisCtx(); ctx.getQueryOptions().setEnable_expr_rewrites(true); SelectStmt select = (SelectStmt) AnalyzesOk(query, ctx); Expr selectExpr = select.getSelectList().getItems().get(0).getExpr(); assertEquals(ScalarType.SMALLINT, selectExpr.getType()); Expr resultExpr = select.getResultExprs().get(0); assertEquals(ScalarType.SMALLINT, resultExpr.getType()); Expr baseTableExpr = select.getBaseTblResultExprs().get(0); // Fails assertEquals(ScalarType.SMALLINT, baseTableExpr.getType()); {code} The last assertion above fails with: {noformat} Expected: SMALLINT but was: TINYINT {noformat} This error does not occur if rewrites are disabled: {code:java} ctx.getQueryOptions().setEnable_expr_rewrites(false); {code} It is not clear if the BE needs the information that is incorrect. But, to reduce cognitive load on developers, things should be consistent. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org