1
0

[MINOR] Improve variable names (#6039)

This commit is contained in:
Shiyan Xu
2022-07-04 20:03:50 -05:00
committed by GitHub
parent c091e4cc30
commit 6187622178
2 changed files with 22 additions and 22 deletions

View File

@@ -61,11 +61,11 @@ public class ReflectionUtils {
return CLAZZ_CACHE.get(clazzName); return CLAZZ_CACHE.get(clazzName);
} }
public static <T> T loadClass(String fqcn) { public static <T> T loadClass(String className) {
try { try {
return (T) getClass(fqcn).newInstance(); return (T) getClass(className).newInstance();
} catch (InstantiationException | IllegalAccessException e) { } catch (InstantiationException | IllegalAccessException e) {
throw new HoodieException("Could not load class " + fqcn, e); throw new HoodieException("Could not load class " + className, e);
} }
} }

View File

@@ -39,27 +39,27 @@ public class SyncUtilHelpers {
* Create an instance of an implementation of {@link HoodieSyncTool} that will sync all the relevant meta information * Create an instance of an implementation of {@link HoodieSyncTool} that will sync all the relevant meta information
* with an external metastore such as Hive etc. to ensure Hoodie tables can be queried or read via external systems. * with an external metastore such as Hive etc. to ensure Hoodie tables can be queried or read via external systems.
* *
* @param metaSyncFQCN The class that implements the sync of the metadata. * @param syncToolClassName Class name of the {@link HoodieSyncTool} implementation.
* @param props property map. * @param props property map.
* @param hadoopConfig Hadoop confs. * @param hadoopConfig Hadoop confs.
* @param fs Filesystem used. * @param fs Filesystem used.
* @param targetBasePath The target base path that contains the hoodie table. * @param targetBasePath The target base path that contains the hoodie table.
* @param baseFileFormat The file format used by the hoodie table (defaults to PARQUET). * @param baseFileFormat The file format used by the hoodie table (defaults to PARQUET).
*/ */
public static void runHoodieMetaSync(String metaSyncFQCN, public static void runHoodieMetaSync(String syncToolClassName,
TypedProperties props, TypedProperties props,
Configuration hadoopConfig, Configuration hadoopConfig,
FileSystem fs, FileSystem fs,
String targetBasePath, String targetBasePath,
String baseFileFormat) { String baseFileFormat) {
try { try {
instantiateMetaSyncTool(metaSyncFQCN, props, hadoopConfig, fs, targetBasePath, baseFileFormat).syncHoodieTable(); instantiateMetaSyncTool(syncToolClassName, props, hadoopConfig, fs, targetBasePath, baseFileFormat).syncHoodieTable();
} catch (Throwable e) { } catch (Throwable e) {
throw new HoodieException("Could not sync using the meta sync class " + metaSyncFQCN, e); throw new HoodieException("Could not sync using the meta sync class " + syncToolClassName, e);
} }
} }
static HoodieSyncTool instantiateMetaSyncTool(String metaSyncFQCN, static HoodieSyncTool instantiateMetaSyncTool(String syncToolClassName,
TypedProperties props, TypedProperties props,
Configuration hadoopConfig, Configuration hadoopConfig,
FileSystem fs, FileSystem fs,
@@ -70,28 +70,28 @@ public class SyncUtilHelpers {
properties.put(HoodieSyncConfig.META_SYNC_BASE_PATH.key(), targetBasePath); properties.put(HoodieSyncConfig.META_SYNC_BASE_PATH.key(), targetBasePath);
properties.put(HoodieSyncConfig.META_SYNC_BASE_FILE_FORMAT.key(), baseFileFormat); properties.put(HoodieSyncConfig.META_SYNC_BASE_FILE_FORMAT.key(), baseFileFormat);
if (ReflectionUtils.hasConstructor(metaSyncFQCN, if (ReflectionUtils.hasConstructor(syncToolClassName,
new Class<?>[] {Properties.class, Configuration.class})) { new Class<?>[] {Properties.class, Configuration.class})) {
return ((HoodieSyncTool) ReflectionUtils.loadClass(metaSyncFQCN, return ((HoodieSyncTool) ReflectionUtils.loadClass(syncToolClassName,
new Class<?>[] {Properties.class, Configuration.class}, new Class<?>[] {Properties.class, Configuration.class},
properties, hadoopConfig)); properties, hadoopConfig));
} else if (ReflectionUtils.hasConstructor(metaSyncFQCN, } else if (ReflectionUtils.hasConstructor(syncToolClassName,
new Class<?>[] {Properties.class})) { new Class<?>[] {Properties.class})) {
return ((HoodieSyncTool) ReflectionUtils.loadClass(metaSyncFQCN, return ((HoodieSyncTool) ReflectionUtils.loadClass(syncToolClassName,
new Class<?>[] {Properties.class}, new Class<?>[] {Properties.class},
properties)); properties));
} else if (ReflectionUtils.hasConstructor(metaSyncFQCN, } else if (ReflectionUtils.hasConstructor(syncToolClassName,
new Class<?>[] {TypedProperties.class, Configuration.class, FileSystem.class})) { new Class<?>[] {TypedProperties.class, Configuration.class, FileSystem.class})) {
return ((HoodieSyncTool) ReflectionUtils.loadClass(metaSyncFQCN, return ((HoodieSyncTool) ReflectionUtils.loadClass(syncToolClassName,
new Class<?>[] {TypedProperties.class, Configuration.class, FileSystem.class}, new Class<?>[] {TypedProperties.class, Configuration.class, FileSystem.class},
properties, hadoopConfig, fs)); properties, hadoopConfig, fs));
} else if (ReflectionUtils.hasConstructor(metaSyncFQCN, } else if (ReflectionUtils.hasConstructor(syncToolClassName,
new Class<?>[] {Properties.class, FileSystem.class})) { new Class<?>[] {Properties.class, FileSystem.class})) {
return ((HoodieSyncTool) ReflectionUtils.loadClass(metaSyncFQCN, return ((HoodieSyncTool) ReflectionUtils.loadClass(syncToolClassName,
new Class<?>[] {Properties.class, FileSystem.class}, new Class<?>[] {Properties.class, FileSystem.class},
properties, fs)); properties, fs));
} else { } else {
throw new HoodieException("Could not load meta sync class " + metaSyncFQCN throw new HoodieException("Could not load meta sync class " + syncToolClassName
+ ": no valid constructor found."); + ": no valid constructor found.");
} }
} }