You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Ted Dunning <te...@gmail.com> on 2015/04/09 03:20:36 UTC

limit and count do odd things

Am I missing something?  It seems that count should return 3 in the second
query.

This happens with the 0.8.0 release running in embedded mode.


0: jdbc:drill:zk=local> select count(1) from
dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*`;
+------------+
|   EXPR$0   |
+------------+
| 20000      |
+------------+
1 row selected (1.311 seconds)
0: jdbc:drill:zk=local> select count(*) from
dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*` limit 3;
+------------+
|   EXPR$0   |
+------------+
| 20000      |
+------------+

Re: limit and count do odd things

Posted by Ted Dunning <te...@gmail.com>.
On Thu, Apr 9, 2015 at 12:25 AM, Julian Hyde <ju...@gmail.com> wrote:

> 'll forgive you (and anyone) the occasional intellectual lapse. I came
> across your wonderful t-digest paper earlier today.
>

Well, there is another example.  But thanks to my new co-author, that paper
is getting significantly better in the near future.

Re: limit and count do odd things

Posted by Julian Hyde <ju...@gmail.com>.
Ted,

I'll forgive you (and anyone) the occasional intellectual lapse. I came across your wonderful t-digest paper earlier today. 

https://github.com/tdunning/t-digest/raw/master/docs/t-digest-paper/histo.pdf

Julian 

> On Apr 8, 2015, at 20:20, Ted Dunning <te...@gmail.com> wrote:
> 
> Thanks.
> 
> Brain fart.
> 
>> On Wed, Apr 8, 2015 at 8:26 PM, Aman Sinha <as...@maprtech.com> wrote:
>> 
>> Why ?  limit is applied to the final result set of the query.   If you did
>> select count(*) from (select * from T limit 3) you will get 3.
>> 
>>> On Wed, Apr 8, 2015 at 6:20 PM, Ted Dunning <te...@gmail.com> wrote:
>>> 
>>> Am I missing something?  It seems that count should return 3 in the
>> second
>>> query.
>>> 
>>> This happens with the 0.8.0 release running in embedded mode.
>>> 
>>> 
>>> 0: jdbc:drill:zk=local> select count(1) from
>>> dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*`;
>>> +------------+
>>> |   EXPR$0   |
>>> +------------+
>>> | 20000      |
>>> +------------+
>>> 1 row selected (1.311 seconds)
>>> 0: jdbc:drill:zk=local> select count(*) from
>>> dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*` limit 3;
>>> +------------+
>>> |   EXPR$0   |
>>> +------------+
>>> | 20000      |
>>> +------------+
>> 

Re: limit and count do odd things

Posted by Ted Dunning <te...@gmail.com>.
Thanks.

Brain fart.

On Wed, Apr 8, 2015 at 8:26 PM, Aman Sinha <as...@maprtech.com> wrote:

> Why ?  limit is applied to the final result set of the query.   If you did
> select count(*) from (select * from T limit 3) you will get 3.
>
> On Wed, Apr 8, 2015 at 6:20 PM, Ted Dunning <te...@gmail.com> wrote:
>
> > Am I missing something?  It seems that count should return 3 in the
> second
> > query.
> >
> > This happens with the 0.8.0 release running in embedded mode.
> >
> >
> > 0: jdbc:drill:zk=local> select count(1) from
> > dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*`;
> > +------------+
> > |   EXPR$0   |
> > +------------+
> > | 20000      |
> > +------------+
> > 1 row selected (1.311 seconds)
> > 0: jdbc:drill:zk=local> select count(*) from
> > dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*` limit 3;
> > +------------+
> > |   EXPR$0   |
> > +------------+
> > | 20000      |
> > +------------+
> >
>

Re: limit and count do odd things

Posted by Aman Sinha <as...@maprtech.com>.
Why ?  limit is applied to the final result set of the query.   If you did
select count(*) from (select * from T limit 3) you will get 3.

On Wed, Apr 8, 2015 at 6:20 PM, Ted Dunning <te...@gmail.com> wrote:

> Am I missing something?  It seems that count should return 3 in the second
> query.
>
> This happens with the 0.8.0 release running in embedded mode.
>
>
> 0: jdbc:drill:zk=local> select count(1) from
> dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*`;
> +------------+
> |   EXPR$0   |
> +------------+
> | 20000      |
> +------------+
> 1 row selected (1.311 seconds)
> 0: jdbc:drill:zk=local> select count(*) from
> dfs.`/Users/tdunning/tmp/apache-drill-0.8.0/foo/*` limit 3;
> +------------+
> |   EXPR$0   |
> +------------+
> | 20000      |
> +------------+
>