You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "bharath v (JIRA)" <ji...@apache.org> on 2017/07/12 22:28:00 UTC

[jira] [Created] (IMPALA-5657) FunctionCallExpr.toSql() ignores "IGNORE NULLS" case

bharath v created IMPALA-5657:
---------------------------------

             Summary: FunctionCallExpr.toSql() ignores "IGNORE NULLS" case
                 Key: IMPALA-5657
                 URL: https://issues.apache.org/jira/browse/IMPALA-5657
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
    Affects Versions: Impala 2.10.0
            Reporter: bharath v
            Assignee: bharath v


{noformat}
@Override
  public String toSqlImpl() {
    if (label_ != null) return label_;
    // Merge agg fns should have an explicit label.
    Preconditions.checkState(!isMergeAggFn());
    StringBuilder sb = new StringBuilder();
    sb.append(fnName_).append("(");
    if (params_.isStar()) sb.append("*");
    if (params_.isDistinct()) sb.append("DISTINCT ");
    sb.append(Joiner.on(", ").join(childrenToSql())).append(")");
    return sb.toString();
  }
{noformat}

We don't include the "IGNORE NULLS" clause if present, causing it to break the cases which rely on it, for example an InlineViewRef. A sample repro.

{noformat}
[localhost:21000] > create foo(a int, b int);
[localhost:21000] > create view test_view as select * from (select last_value(b IGNORE NULLS) OVER (PARTITION BY a order by b) from test) x;
[localhost:21000] > show create view test_view;
Query: show create view test_view
+------------------------------------------------------------------------------------------------+
| result                                                                                         |
+------------------------------------------------------------------------------------------------+
| CREATE VIEW incrstat.test_view AS                                                              |
| SELECT * FROM (SELECT last_value(b) OVER (PARTITION BY a ORDER BY b ASC) FROM incrstat.test) x |
+------------------------------------------------------------------------------------------------+
{noformat}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)