KnightChess commented on a change in pull request #3459: URL: https://github.com/apache/iceberg/pull/3459#discussion_r746224078
########## File path: spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/sql/TestPartitionSQL.java ########## @@ -0,0 +1,150 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iceberg.spark.sql; + +import java.util.List; +import java.util.Map; +import org.apache.iceberg.AssertHelpers; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; +import org.apache.iceberg.spark.SparkCatalogTestBase; +import org.apache.spark.sql.AnalysisException; +import org.junit.After; +import org.junit.Test; + +public class TestPartitionSQL extends SparkCatalogTestBase { + + public TestPartitionSQL(String catalogName, String implementation, Map<String, String> config) { + super(catalogName, implementation, config); + } + + @After + public void removeTables() { + sql("DROP TABLE IF EXISTS %s", tableName); + } + Review comment: According to the suggestions, I thought of a question. What do users want when use show partitions, 1. if the table is unpartitioned now but partitioned before. Is there need to return to the historical partition info 2. the partition has been updated, is there need to return the historical partition info Considering the way updated, the result is different: > now have a table, partitioned by (year, month), has `/year=2021/month=01/xxxx.parquet` data file - add partitions day, then add data, data path: - /year=2021/month=01/xxxx.parqut - /year=2021/month=01/day=01/xxxx.parqut - drop partitions year, then add data, data path: - /year=2021/month=01/xxxx.parqut - /year=2021/month=01/day=01/xxxx.parqut - /year=null/month=01/day=02/xxxx.parqut - /year=null/month=01/day=03/xxxx.parqut - then drop partitions month, day, data path: - /year=2021/month=01/xxxx.parqut - /year=2021/month=01/day=01/xxxx.parqut - /year=null/month=01/day=02/xxxx.parqut - /year=null/month=01/day=03/xxxx.parqut - /year=null/month=null/day=null/xxxx.parqut now the table is unpartitioned, when use show partitions, need throw `the table is unpartitioned` or return the partitions the table has( and is there need to remove xxx=null fields) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
