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/20 21:14:00 UTC
[jira] [Resolved] (IMPALA-5657) FunctionCallExpr.toSql() and
clone() ignore "IGNORE NULLS" case
[ https://issues.apache.org/jira/browse/IMPALA-5657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
bharath v resolved IMPALA-5657.
-------------------------------
Resolution: Fixed
Fix Version/s: Impala 2.10.0
> FunctionCallExpr.toSql() and clone() ignore "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.8.0, Impala 2.9.0, Impala 2.10.0
> Reporter: bharath v
> Assignee: bharath v
> Priority: Blocker
> Labels: correctness
> Fix For: Impala 2.10.0
>
>
> {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();
> }
> protected FunctionCallExpr(FunctionCallExpr other) {
> super(other);
> fnName_ = other.fnName_;
> isAnalyticFnCall_ = other.isAnalyticFnCall_;
> isInternalFnCall_ = other.isInternalFnCall_;
> mergeAggInputFn_ = other.mergeAggInputFn_ == null ?
> null : (FunctionCallExpr)other.mergeAggInputFn_.clone();
> // Clone the params in a way that keeps the children_ and the params.exprs()
> // in sync. The children have already been cloned in the super c'tor.
> if (other.params_.isStar()) {
> Preconditions.checkState(children_.isEmpty());
> params_ = FunctionParams.createStarParam();
> } else {
> params_ = new FunctionParams(other.params_.isDistinct(), children_); <------- other.params_.isIgnoreNulls() is ignored.
> }
> label_ = other.label_;
> }
> {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)