[ 
https://issues.apache.org/jira/browse/IMPALA-2581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765785#comment-17765785
 ] 

ASF subversion and git services commented on IMPALA-2581:
---------------------------------------------------------

Commit 704ff7788d015dcbe66a319fb017d0a3f8a76399 in impala's branch 
refs/heads/branch-4.3.0 from Michael Smith
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=704ff7788 ]

IMPALA-12383: Fix SingleNodePlanner aggregation limits

IMPALA-2581 added enforcement of the limit when adding entries to the
grouping aggregation. It would stop adding new entries if the number of
entries in the grouping aggregation was >= the limit. If the grouping
aggregation never contains more entries than the limit, then it would
not output more entries.

However, this limit was not enforced exactly when adding. It would add a
whole batch before checking the limit, so it can go past the limit. In
practice the exchange in a distributed aggregation would enforce limits,
so this would only show up when num_nodes=1. As a result, the following
query incorrectly returns 16 rows, not 10:

  set num_nodes=1;
  select distinct l_orderkey from tpch.lineitem limit 10;

One option is to be exact when adding items to the group aggregation,
which would require testing the limit on each row (we don't know which
are duplicates). This is awkward. Removing the limit on the output of
the aggregation also is not really needed for the original change
(stopping the children early once the limit is reached). Instead, we
restore the limit on the output of the grouping agg (which is already
known to work).

Testing:
- added a test case where we assert number of rows returned by an
  aggregation node (rather than an exchange or top-n).
- restores definition of ALL_CLUSTER_SIZES and makes it simpler to
  enable for individual test suites. Filed IMPALA-12394 to generally
  re-enable testing with ALL_CLUSTER_SIZES. Enables ALL_CLUSTER_SIZES
  for aggregation tests.

Change-Id: Ic5eec1190e8e182152aa954897b79cc3f219c816
Reviewed-on: http://gerrit.cloudera.org:8080/20379
Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
Reviewed-by: Joe McDonnell <joemcdonn...@cloudera.com>


> Push down LIMIT  past DISTINCT
> ------------------------------
>
>                 Key: IMPALA-2581
>                 URL: https://issues.apache.org/jira/browse/IMPALA-2581
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 2.5.0
>            Reporter: Jim Apple
>            Assignee: liuyao
>            Priority: Minor
>              Labels: backend, frontend, performance
>             Fix For: Impala 4.1.0
>
>
> In a table t with a column x with no null values, "SELECT DISTINCT x FROM t 
> LIMIT 1" should be roughly instant. Instead, it finds *all* the distinct 
> values, then returns one of them.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to