You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "zhuangchong (via GitHub)" <gi...@apache.org> on 2023/04/11 05:54:13 UTC
[GitHub] [incubator-paimon] zhuangchong opened a new pull request, #872: [test] Introduce CatalogTestBase
zhuangchong opened a new pull request, #872:
URL: https://github.com/apache/incubator-paimon/pull/872
*(Please specify the module before the PR name: [core] ... or [flink] ...)*
### Purpose
*(What is the purpose of the change, or the associated issue)*
this pr closes: #751
### Tests
*(List UT and IT cases to verify this change)*
### API and Format
*(Does this change affect API or storage format)*
### Documentation
*(Does this change introduce a new feature)*
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] zhuangchong commented on a diff in pull request #872: [test] Introduce CatalogTestBase
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #872:
URL: https://github.com/apache/incubator-paimon/pull/872#discussion_r1162670184
##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -108,6 +108,14 @@ void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)
*/
List<String> listTables(String databaseName) throws DatabaseNotExistException;
+ /**
+ * Check if a table exists in this catalog.
+ *
+ * @param identifier Path of the table
+ * @return true if the given table exists in the catalog false otherwise
+ */
+ boolean tableExists(Identifier identifier);
Review Comment:
Thanks, done.
##########
paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java:
##########
@@ -0,0 +1,504 @@
+/*
+ * 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.paimon.catalog;
+
+import org.apache.paimon.fs.FileIO;
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.options.CatalogOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.schema.Schema;
+import org.apache.paimon.schema.SchemaChange;
+import org.apache.paimon.shade.guava30.com.google.common.collect.Lists;
+import org.apache.paimon.shade.guava30.com.google.common.collect.Maps;
+import org.apache.paimon.table.Table;
+import org.apache.paimon.types.DataField;
+import org.apache.paimon.types.DataTypes;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Base test class of paimon catalog in {@link Catalog}. */
+public abstract class CatalogTestBase {
Review Comment:
Thanks, done.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi merged pull request #872: [test] Introduce CatalogTestBase
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #872:
URL: https://github.com/apache/incubator-paimon/pull/872
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #872: [test] Introduce CatalogTestBase
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #872:
URL: https://github.com/apache/incubator-paimon/pull/872#discussion_r1162369923
##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -108,6 +108,14 @@ void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)
*/
List<String> listTables(String databaseName) throws DatabaseNotExistException;
+ /**
+ * Check if a table exists in this catalog.
+ *
+ * @param identifier Path of the table
+ * @return true if the given table exists in the catalog false otherwise
+ */
+ boolean tableExists(Identifier identifier);
Review Comment:
I removed this method because it is very confused if we have system tables. You can find always return false for system tables in current implementations.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #872: [test] Introduce CatalogTestBase
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #872:
URL: https://github.com/apache/incubator-paimon/pull/872#discussion_r1162371549
##########
paimon-core/src/test/java/org/apache/paimon/catalog/CatalogTestBase.java:
##########
@@ -0,0 +1,504 @@
+/*
+ * 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.paimon.catalog;
+
+import org.apache.paimon.fs.FileIO;
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.options.CatalogOptions;
+import org.apache.paimon.options.Options;
+import org.apache.paimon.schema.Schema;
+import org.apache.paimon.schema.SchemaChange;
+import org.apache.paimon.shade.guava30.com.google.common.collect.Lists;
+import org.apache.paimon.shade.guava30.com.google.common.collect.Maps;
+import org.apache.paimon.table.Table;
+import org.apache.paimon.types.DataField;
+import org.apache.paimon.types.DataTypes;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Base test class of paimon catalog in {@link Catalog}. */
+public abstract class CatalogTestBase {
Review Comment:
Add tests for system tables.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #872: [test] Introduce CatalogTestBase
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #872:
URL: https://github.com/apache/incubator-paimon/pull/872#discussion_r1162370778
##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -108,6 +108,14 @@ void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)
*/
List<String> listTables(String databaseName) throws DatabaseNotExistException;
+ /**
+ * Check if a table exists in this catalog.
+ *
+ * @param identifier Path of the table
+ * @return true if the given table exists in the catalog false otherwise
+ */
+ boolean tableExists(Identifier identifier);
Review Comment:
If we just have a syntactic sugar:
```
default boolean tableExists(Identifier ident) {
try {
return loadTable(ident) != null;
} catch (TableNotExistException e) {
return false;
}
}
```
OK, that is fine.
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-paimon] zhuangchong closed pull request #872: [test] Introduce CatalogTestBase
Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong closed pull request #872: [test] Introduce CatalogTestBase
URL: https://github.com/apache/incubator-paimon/pull/872
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org