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

Sean R. Owen commented on SPARK-32700:
--------------------------------------

I don't think you're guaranteed to get exactly 50% here. With a small data set, 
due to random sampling, it could be even 3 with not-small probability.

> select from table TABLESAMPLE gives wrong resultset.
> ----------------------------------------------------
>
>                 Key: SPARK-32700
>                 URL: https://issues.apache.org/jira/browse/SPARK-32700
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>         Environment: Spark 3.0.0
>            Reporter: Chetan Bhat
>            Priority: Minor
>
> create table test(id int,name string) stored as parquet;
> insert into test values 
> (5,'Alex'),(8,'Lucy'),(2,'Mary'),(4,'Fred'),(1,'Lisa'),(9,'Eric'),(10,'Adam'),(6,'Mark'),(7,'Lily'),(3,'Evan');
> SELECT * FROM test TABLESAMPLE (50 PERCENT); --> output is giving only 3 rows.
> spark-sql> SELECT * FROM test TABLESAMPLE (50 PERCENT);
> 5 Alex
> 10 Adam
> 4 Fred
>  
> Expected as per the link is 5 rows 
> -->[https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-sampling.html]
>  
> Also the bucket parameter for select from table TABLESAMPLE gives wrong 
> resultset.
> spark-sql> SELECT * FROM test TABLESAMPLE (BUCKET 4 OUT OF 10);
> 5 Alex
> 8 Lucy
> 9 Eric
> 1 Lisa
> 3 Evan
> Expected is 4 records.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to