You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/26 17:39:40 UTC

[GitHub] [spark] MaxGekk opened a new pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

MaxGekk opened a new pull request #31350:
URL: https://github.com/apache/spark/pull/31350


   ### What changes were proposed in this pull request?
   1. Take into account the SQL config `spark.sql.statistics.size.autoUpdate.enabled` as other commands do.
   2. Re-calculate actual table size in fs. Before the changes, `TRUNCATE TABLE` always sets table size to 0 in stats.
   
   ### Why are the changes needed?
   This fixes the bug that demonstrated by the example:
   1. Create a partitioned table with 2 non-empty partitions:
   ```sql
   spark-sql> CREATE TABLE tbl (c0 int, part int) PARTITIONED BY (part);
   spark-sql> INSERT INTO tbl PARTITION (part=0) SELECT 0;
   spark-sql> INSERT INTO tbl PARTITION (part=1) SELECT 1;
   spark-sql> ANALYZE TABLE tbl COMPUTE STATISTICS;
   spark-sql> DESCRIBE TABLE EXTENDED tbl;
   ...
   Statistics	4 bytes, 2 rows
   ...
   ``` 
   2. Truncate only one partition:
   ```sql
   spark-sql> TRUNCATE TABLE tbl PARTITION (part=1);
   spark-sql> SELECT * FROM tbl;
   0	0
   ```
   3. The table is still non-empty but `TRUNCATE TABLE` reseted stats:
   ```
   spark-sql> DESCRIBE TABLE EXTENDED tbl;
   ...
   Statistics	0 bytes, 0 rows
   ...
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   It could impact on performance of following queries.
   
   ### How was this patch tested?
   Added new test to `StatisticsCollectionSuite`:
   ```
   $ build/sbt -Phive -Phive-thriftserver "test:testOnly *StatisticsCollectionSuite"
   $ build/sbt -Phive -Phive-thriftserver "test:testOnly *StatisticsSuite"
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767737364


   Kubernetes integration test starting
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39103/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767753801


   Kubernetes integration test status success
   URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39103/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767742960


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/134518/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767773599


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/39103/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-768079786


   thanks, merging to master!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767742960


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/134518/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767773599


   
   Refer to this link for build results (access rights to CI server needed): 
   https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/39103/
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan closed pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #31350:
URL: https://github.com/apache/spark/pull/31350


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] MaxGekk commented on pull request #31350: [SPARK-34251][SQL] Fix table stats calculation by `TRUNCATE TABLE`

Posted by GitBox <gi...@apache.org>.
MaxGekk commented on pull request #31350:
URL: https://github.com/apache/spark/pull/31350#issuecomment-767825276


   @dongjoon-hyun @sunchao @cloud-fan @HyukjinKwon Could you review this fix, please.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org