[HUDI-3730] Improve meta sync class design and hierarchies (#5854)
* [HUDI-3730] Improve meta sync class design and hierarchies (#5754) * Implements class design proposed in RFC-55 Co-authored-by: jian.feng <fengjian428@gmial.com> Co-authored-by: jian.feng <jian.feng@shopee.com>
This commit is contained in:
@@ -32,6 +32,10 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import static org.apache.hudi.hive.HiveSyncConfigHolder.HIVE_PASS;
|
||||
import static org.apache.hudi.hive.HiveSyncConfigHolder.HIVE_URL;
|
||||
import static org.apache.hudi.hive.HiveSyncConfigHolder.HIVE_USER;
|
||||
|
||||
/**
|
||||
* A hive query node in the DAG of operations for a workflow. used to perform a hive query with given config.
|
||||
*/
|
||||
@@ -57,8 +61,8 @@ public class HiveQueryNode extends DagNode<Boolean> {
|
||||
.getDeltaSyncService().getDeltaSync().getCfg().baseFileFormat);
|
||||
HiveSyncConfig hiveSyncConfig = new HiveSyncConfig(properties);
|
||||
this.hiveServiceProvider.syncToLocalHiveIfNeeded(executionContext.getHoodieTestSuiteWriter());
|
||||
Connection con = DriverManager.getConnection(hiveSyncConfig.jdbcUrl, hiveSyncConfig.hiveUser,
|
||||
hiveSyncConfig.hivePass);
|
||||
Connection con = DriverManager.getConnection(hiveSyncConfig.getString(HIVE_URL),
|
||||
hiveSyncConfig.getString(HIVE_USER), hiveSyncConfig.getString(HIVE_PASS));
|
||||
Statement stmt = con.createStatement();
|
||||
stmt.execute("set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat");
|
||||
for (String hiveProperty : this.config.getHiveProperties()) {
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
|
||||
package org.apache.hudi.integ.testsuite.helpers;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hive.service.server.HiveServer2;
|
||||
|
||||
import org.apache.hudi.common.fs.FSUtils;
|
||||
import org.apache.hudi.hive.HiveSyncTool;
|
||||
import org.apache.hudi.hive.testutils.HiveTestService;
|
||||
import org.apache.hudi.integ.testsuite.HoodieTestSuiteWriter;
|
||||
import org.apache.hudi.integ.testsuite.configuration.DeltaConfig.Config;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hive.service.server.HiveServer2;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Hive Service provider.
|
||||
*/
|
||||
@@ -52,12 +52,10 @@ public class HiveServiceProvider {
|
||||
HiveSyncTool hiveSyncTool;
|
||||
if (this.config.isHiveLocal()) {
|
||||
hiveSyncTool = new HiveSyncTool(writer.getWriteConfig().getProps(),
|
||||
getLocalHiveServer().getHiveConf(),
|
||||
FSUtils.getFs(writer.getWriteConfig().getBasePath(), getLocalHiveServer().getHiveConf()));
|
||||
getLocalHiveServer().getHiveConf());
|
||||
} else {
|
||||
hiveSyncTool = new HiveSyncTool(writer.getWriteConfig().getProps(),
|
||||
getLocalHiveServer().getHiveConf(),
|
||||
FSUtils.getFs(writer.getWriteConfig().getBasePath(), writer.getConfiguration()));
|
||||
writer.getConfiguration());
|
||||
}
|
||||
hiveSyncTool.syncHoodieTable();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.apache.hudi.DataSourceWriteOptions;
|
||||
import org.apache.hudi.common.config.TypedProperties;
|
||||
import org.apache.hudi.common.model.HoodieTableType;
|
||||
import org.apache.hudi.common.table.HoodieTableMetaClient;
|
||||
import org.apache.hudi.hive.HiveSyncConfig;
|
||||
import org.apache.hudi.index.HoodieIndex;
|
||||
import org.apache.hudi.integ.testsuite.HoodieTestSuiteJob;
|
||||
import org.apache.hudi.integ.testsuite.HoodieTestSuiteJob.HoodieTestSuiteConfig;
|
||||
@@ -55,6 +54,10 @@ import org.junit.jupiter.params.provider.MethodSource;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.apache.hudi.hive.HiveSyncConfigHolder.HIVE_URL;
|
||||
import static org.apache.hudi.sync.common.HoodieSyncConfig.META_SYNC_DATABASE_NAME;
|
||||
import static org.apache.hudi.sync.common.HoodieSyncConfig.META_SYNC_PARTITION_FIELDS;
|
||||
import static org.apache.hudi.sync.common.HoodieSyncConfig.META_SYNC_TABLE_NAME;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
@@ -177,10 +180,10 @@ public class TestHoodieTestSuiteJob extends UtilitiesTestBase {
|
||||
// Make path selection test suite specific
|
||||
props.setProperty("hoodie.deltastreamer.source.input.selector", DFSTestSuitePathSelector.class.getName());
|
||||
// Hive Configs
|
||||
props.setProperty(HiveSyncConfig.HIVE_URL.key(), "jdbc:hive2://127.0.0.1:9999/");
|
||||
props.setProperty(HiveSyncConfig.META_SYNC_DATABASE_NAME.key(), "testdb1");
|
||||
props.setProperty(HiveSyncConfig.META_SYNC_TABLE_NAME.key(), "table1");
|
||||
props.setProperty(HiveSyncConfig.META_SYNC_PARTITION_FIELDS.key(), "datestr");
|
||||
props.setProperty(HIVE_URL.key(), "jdbc:hive2://127.0.0.1:9999/");
|
||||
props.setProperty(META_SYNC_DATABASE_NAME.key(), "testdb1");
|
||||
props.setProperty(META_SYNC_TABLE_NAME.key(), "table1");
|
||||
props.setProperty(META_SYNC_PARTITION_FIELDS.key(), "datestr");
|
||||
props.setProperty(DataSourceWriteOptions.KEYGENERATOR_CLASS_NAME().key(), TimestampBasedKeyGenerator.class.getName());
|
||||
|
||||
props.setProperty("hoodie.write.lock.provider", "org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider");
|
||||
|
||||
Reference in New Issue
Block a user