Maxim Gekk created SPARK-34251:
----------------------------------
Summary: TRUNCATE TABLE resets stats for non-empty v1 table
Key: SPARK-34251
URL: https://issues.apache.org/jira/browse/SPARK-34251
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 3.0.2, 3.2.0, 3.1.1
Reporter: Maxim Gekk
The example below portraits the issue:
{code: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
...
{code}
Let's truncate one partition:
{code:sql}
spark-sql> TRUNCATE TABLE tbl PARTITION (part=1);
spark-sql> DESCRIBE TABLE EXTENDED tbl;
...
Statistics 0 bytes, 0 rows
...
spark-sql> SELECT * FROM tbl;
0 0
{code}
*The last query returns a row but stats show 0 rows. *
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]