You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/11/25 19:27:50 UTC

[GitHub] [hudi] rmahindra123 commented on a change in pull request #4080: [HUDI-2757] Extend the hive sync tool to enable AWS Glue meta sync

rmahindra123 commented on a change in pull request #4080:
URL: https://github.com/apache/hudi/pull/4080#discussion_r757098783



##########
File path: hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/AbstractHiveSyncHoodieClient.java
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.hudi.hive;
+
+import org.apache.hudi.sync.common.AbstractSyncHoodieClient;
+import org.apache.hudi.sync.common.HoodieSyncException;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.apache.parquet.schema.MessageType;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Base class to sync Hudi tables with Hive based metastores, such as Hive server, HMS, AWS Glue etc.
+ */
+public abstract class AbstractHiveSyncHoodieClient extends AbstractSyncHoodieClient {
+
+  private static final Logger LOG = LogManager.getLogger(AbstractHiveSyncHoodieClient.class);
+
+  public AbstractHiveSyncHoodieClient(String basePath, boolean assumeDatePartitioning, boolean useFileListingFromMetadata, boolean verifyMetadataFileListing, boolean withOperationField,
+                                      FileSystem fs) {
+    super(basePath, assumeDatePartitioning, useFileListingFromMetadata, verifyMetadataFileListing, withOperationField, fs);
+  }
+
+  public AbstractHiveSyncHoodieClient(String basePath, boolean assumeDatePartitioning, boolean useFileListingFromMetadata, boolean withOperationField, FileSystem fs) {
+    super(basePath, assumeDatePartitioning, useFileListingFromMetadata, withOperationField, fs);
+  }
+
+  public abstract void createDatabase(String databaseName);
+
+  /**
+   * @param databaseName
+   * @return true if the configured database exists
+   */
+  public abstract boolean doesDataBaseExist(String databaseName);
+
+  public abstract void updateTableDefinition(String tableName, MessageType newSchema);

Review comment:
       Resolved the first comment.
   For second comment, that's a good catch. I checked, looks like we are converting avro schema to parquet schema when we sync, and then convert parquet schema to hive schema (or Map for glue). Looks like we can potentially just pass in avro schema from hudi and convert directly to hive schema. However, this involves changing some legacy code in a few classes, including all the hive sync classes and HoodieDLAClient, so I created a follow up ticket to investigate this more: https://issues.apache.org/jira/browse/HUDI-2859  




-- 
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: commits-unsubscribe@hudi.apache.org

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