gh-yzou commented on code in PR #1349: URL: https://github.com/apache/polaris/pull/1349#discussion_r2040492800
########## plugins/spark/v3.5/integration/src/intTest/java/org/apache/polaris/spark/quarkus/it/SparkCatalogOperationsIT.java: ########## @@ -0,0 +1,250 @@ +/* + * 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.polaris.spark.quarkus.it; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.google.common.collect.Maps; +import io.quarkus.test.junit.QuarkusIntegrationTest; +import java.util.Arrays; +import java.util.Map; +import org.apache.iceberg.exceptions.BadRequestException; +import org.apache.polaris.spark.SparkCatalog; +import org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException; +import org.apache.spark.sql.catalyst.analysis.NoSuchViewException; +import org.apache.spark.sql.connector.catalog.Identifier; +import org.apache.spark.sql.connector.catalog.NamespaceChange; +import org.apache.spark.sql.connector.catalog.View; +import org.apache.spark.sql.connector.catalog.ViewChange; +import org.apache.spark.sql.types.StructType; +import org.junit.jupiter.api.Test; + +@QuarkusIntegrationTest +public class SparkCatalogOperationsIT extends SparkIntegrationBase { + /** + * This integration directly performs operations using the SparkCatalog instance, instead of going + * through Spark SQL interface. Some operations don't have an easy way to trigger through the + * SparkSQL, for example, list nested namespaces. + */ + private static StructType schema = new StructType().add("id", "long").add("name", "string"); + + @Test + void testNamespaceOperations() throws Exception { + SparkCatalog catalog = loadSparkCatalog(); Review Comment: Oh, the SparkCatalog instance loaded here is actually our Polaris SparkCatalog (org.apache.polaris.spark.SparkCatalog), which have connection to both IcebergSparkCatalog and our Polaris specific catalog. This test suite is suppose to cover all table operations with different table formats (iceberg, delta, csv), namespaces and views. Since we only have full support with namespaces and views at this moment, this test suite only covers namespace and view operations for now. Ideally, i would like all tests could be covered just by Spark SQL, but there are some operations seems not possible to test like list namespaces under a nested namespace, so i am adding this suite to enable more direct operation testing on the Polaris SparkCatalog instance. Updated the comments for this testing class, hope it could be more clear. -- 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]
