This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new a0c94dd8be6 [MINOR] Fix the check for connector identity in
HoodieHiveCatalog (#9770)
a0c94dd8be6 is described below
commit a0c94dd8be6527d17a08d2bde31325acc9cf5b00
Author: Zouxxyy <[email protected]>
AuthorDate: Sun Sep 24 11:40:44 2023 +0800
[MINOR] Fix the check for connector identity in HoodieHiveCatalog (#9770)
---
.../main/java/org/apache/hudi/table/catalog/HoodieHiveCatalog.java | 6 ++++--
.../java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git
a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/catalog/HoodieHiveCatalog.java
b/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/catalog/HoodieHiveCatalog.java
index 14e3ceaf85a..710ca554182 100644
---
a/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/catalog/HoodieHiveCatalog.java
+++
b/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/catalog/HoodieHiveCatalog.java
@@ -35,6 +35,7 @@ import org.apache.hudi.configuration.OptionsResolver;
import org.apache.hudi.exception.HoodieCatalogException;
import org.apache.hudi.exception.HoodieMetadataException;
import org.apache.hudi.hadoop.utils.HoodieInputFormatUtils;
+import org.apache.hudi.table.HoodieTableFactory;
import org.apache.hudi.table.format.FilePathUtils;
import org.apache.hudi.util.AvroSchemaConverter;
import org.apache.hudi.util.DataTypeUtils;
@@ -455,8 +456,9 @@ public class HoodieHiveCatalog extends AbstractCatalog {
throw new DatabaseNotExistException(getName(),
tablePath.getDatabaseName());
}
- if (!table.getOptions().getOrDefault(CONNECTOR.key(),
"").equalsIgnoreCase("hudi")) {
- throw new HoodieCatalogException(String.format("The %s is not hoodie
table", tablePath.getObjectName()));
+ if (!table.getOptions().getOrDefault(CONNECTOR.key(),
"").equalsIgnoreCase(HoodieTableFactory.FACTORY_ID)) {
+ throw new HoodieCatalogException(String.format("Unsupported connector
identity %s, supported identity is %s",
+ table.getOptions().getOrDefault(CONNECTOR.key(), ""),
HoodieTableFactory.FACTORY_ID));
}
if (table instanceof CatalogView) {
diff --git
a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
index 822ed54de77..9eed5e8a5d6 100644
---
a/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
+++
b/hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/catalog/TestHoodieHiveCatalog.java
@@ -211,11 +211,11 @@ public class TestHoodieHiveCatalog {
@Test
public void testCreateNonHoodieTable() throws TableAlreadyExistException,
DatabaseNotExistException {
CatalogTable table =
- new CatalogTableImpl(schema, Collections.emptyMap(), "hudi table");
+ new CatalogTableImpl(schema,
Collections.singletonMap(FactoryUtil.CONNECTOR.key(), "hudi-fake"), "hudi
table");
try {
hoodieCatalog.createTable(tablePath, table, false);
} catch (HoodieCatalogException e) {
- assertEquals(String.format("The %s is not hoodie table",
tablePath.getObjectName()), e.getMessage());
+ assertEquals("Unsupported connector identity hudi-fake, supported
identity is hudi", e.getMessage());
}
}