You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/02/14 22:54:38 UTC

[GitHub] [iceberg] RussellSpitzer commented on issue #4114: Spark: select * from table.partitions Exception

RussellSpitzer commented on issue #4114:
URL: https://github.com/apache/iceberg/issues/4114#issuecomment-1039653819


   Tried to repo this, but didn't seem to have the issue. Are you sure your classpath doesn't have entries from previous iceberg versions? Seems like it may be from the older partition metadata code.
   
   ```scala> spark.sql("create table iceberg.default.ptest (id int, test string) location '/Users/russellspitzer/Temp/ffz'")
   res6: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("insert into table iceberg.default.ptest Values (5, 'foobar')")
   
   scala> spark.sql("ALTER table iceberg.default.ptest ADD PARTITION FIELD bucket(5, id)")
   res8: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("insert into table iceberg.default.ptest Values (6, 'foobar')")
   res9: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("SELECT * from iceberg.default.ptest.partitions")
   res10: org.apache.spark.sql.DataFrame = [partition: struct<id_bucket_5: int>, record_count: bigint ... 1 more field]
   
   scala> spark.sql("SELECT * from iceberg.default.ptest.partitions").show
   +---------+------------+----------+
   |partition|record_count|file_count|
   +---------+------------+----------+
   |   {null}|           1|         1|
   |      {4}|           1|         1|
   +---------+------------+----------+
   
   
   scala> spark.sql("ALTER TABLE iceberg.default.ptest DROP PARTITION FIELD bucket(5, id)")
   res12: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("SELECT * from iceberg.default.ptest.partitions").show
   +---------+------------+----------+
   |partition|record_count|file_count|
   +---------+------------+----------+
   |   {null}|           1|         1|
   |      {4}|           1|         1|
   +---------+------------+----------+
   
   
   scala> spark.sql("insert into table iceberg.default.ptest Values (7, 'foobar')")
   res14: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("SELECT * from iceberg.default.ptest.partitions").show
   +---------+------------+----------+
   |partition|record_count|file_count|
   +---------+------------+----------+
   |   {null}|           2|         2|
   |      {4}|           1|         1|
   +---------+------------+----------+```


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org