You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Argenis Leon <ar...@mood.com.ve> on 2016/08/16 05:59:32 UTC
rand expected behavior
Hi guys,
I am trying to get a sample from a database using,
select * from table where rand() <= .3
but it seems that in drill the same random number is used in every row
vars(drill.query('''SELECT rand() FROM `dfs`.`/home/argenisleon/rep.csv`
LIMIT 10''', timeout))
{'columns': ['EXPR$0'], 'data': {'columns': ['EXPR$0'], 'rows': [{'EXPR$0':
'0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
'0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
'0.9510525762405785'}]}, 'duration': 0.05265951156616211, 'response':
<Response [200]>, 'rows': [{'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
'0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
'0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}]}
is this the expected behavior?
Re: rand expected behavior
Posted by Chunhui Shi <cs...@maprtech.com>.
There is a JIRA for this: https://issues.apache.org/jira/browse/DRILL-4618
and a pull request for the fix https://github.com/apache/drill/pull/509
Thanks.
On Mon, Aug 15, 2016 at 10:59 PM, Argenis Leon <ar...@mood.com.ve>
wrote:
> Hi guys,
>
> I am trying to get a sample from a database using,
>
> select * from table where rand() <= .3
>
> but it seems that in drill the same random number is used in every row
>
> vars(drill.query('''SELECT rand() FROM `dfs`.`/home/argenisleon/rep.csv`
> LIMIT 10''', timeout))
>
> {'columns': ['EXPR$0'], 'data': {'columns': ['EXPR$0'], 'rows': [{'EXPR$0':
> '0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
> '0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
> '0.9510525762405785'}]}, 'duration': 0.05265951156616211, 'response':
> <Response [200]>, 'rows': [{'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
> '0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}, {'EXPR$0':
> '0.9510525762405785'}, {'EXPR$0': '0.9510525762405785'}]}
>
> is this the expected behavior?
>