name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_HoodieInputFormatUtils_getHoodieTimelineForIncrementalQuery_rdh
/** * Get HoodieTimeline for incremental query from Hive map reduce configuration. * * @param job * @param tableName * @param timeline * @return */ public static HoodieTimeline getHoodieTimelineForIncrementalQuery(JobContext job, String tableName, HoodieTimeline timeline) { String lastIncrementalTs = HoodieH...
3.26
hudi_HoodieInputFormatUtils_getFilteredCommitsTimeline_rdh
/** * Extract HoodieTimeline based on HoodieTableMetaClient. * * @param job * @param tableMetaClient * @return */ public static Option<HoodieTimeline> getFilteredCommitsTimeline(JobContext job, HoodieTableMetaClient tableMetaClient) { String tableName = tableMetaClient.getTableConfig().getTableName(); HoodieDefau...
3.26
hudi_HoodieInputFormatUtils_getWritePartitionPaths_rdh
/** * Returns all the incremental write partition paths as a set with the given commits metadata. * * @param metadataList * The commits metadata * @return the partition path set */ public static Set<String> getWritePartitionPaths(List<HoodieCommitMetadata> metadataList) { return metadataList.stream().map(Hood...
3.26
hudi_TimelineDiffHelper_getPendingCompactionTransitions_rdh
/** * Getting pending compaction transitions. */ private static List<Pair<HoodieInstant, HoodieInstant>> getPendingCompactionTransitions(HoodieTimeline oldTimeline, HoodieTimeline newTimeline) { Set<HoodieInstant> newTimelineInstants = newTimeline.getInstantsAsStream().collect(Collectors.toSet());return oldTimeli...
3.26
hudi_TimelineDiffHelper_getPendingLogCompactionTransitions_rdh
/** * Getting pending log compaction transitions. */ private static List<Pair<HoodieInstant, HoodieInstant>> getPendingLogCompactionTransitions(HoodieTimeline oldTimeline, HoodieTimeline newTimeline) { Set<HoodieInstant> newTimelineInstants = newTimeline.getInstantsAsStream().collect(Collectors.toSet()); retu...
3.26
hudi_SqlQueryBuilder_on_rdh
/** * Appends an ON clause to a query. * * @param predicate * The predicate to join on. * @return The {@link SqlQueryBuilder} instance. */ public SqlQueryBuilder on(String predicate) { if (StringUtils.isNullOrEmpty(predicate)) { throw new IllegalArgumentException(); } sqlBuilder.append(" o...
3.26
hudi_SqlQueryBuilder_orderBy_rdh
/** * Appends an ORDER BY clause to a query. By default, records are ordered in ascending order by the given column. * To order in descending order use DESC after the column name, e.g. queryBuilder.orderBy("update_time desc"). * * @param columns * Column names to order by. * @return The {@link SqlQueryBuilder} ...
3.26
hudi_SqlQueryBuilder_from_rdh
/** * Appends a FROM clause to a query. * * @param tables * The table names to select from. * @return The {@link SqlQueryBuilder} instance. */ public SqlQueryBuilder from(String... tables) { if ((tables == null) || (tables.length == 0)) { throw new IllegalArgumentException("No table name provid...
3.26
hudi_SqlQueryBuilder_where_rdh
/** * Appends a WHERE clause to a query. * * @param predicate * The predicate for WHERE clause. * @return The {@link SqlQueryBuilder} instance. */ public SqlQueryBuilder where(String predicate) { if (StringUtils.isNullOrEmpty(predicate)) { throw new IllegalArgumentException("No predicate p...
3.26
hudi_SqlQueryBuilder_m0_rdh
/** * Appends a "limit" clause to a query. * * @param count * The limit count. * @return The {@link SqlQueryBuilder} instance. */ public SqlQueryBuilder m0(long count) { if (count < 0) { throw new IllegalArgumentException("P...
3.26
hudi_SqlQueryBuilder_select_rdh
/** * Creates a SELECT query. * * @param columns * The column names to select. * @return The new {@link SqlQueryBuilder} instance. */ public static SqlQueryBuilder select(String... columns) { if ((columns == null) || (columns.length == 0)) { throw new IllegalArgumentException("No columns provided wi...
3.26
hudi_SqlQueryBuilder_join_rdh
/** * Appends a JOIN clause to a query. * * @param table * The table to join with. * @return The {@link SqlQueryBuilder} instance. */ public SqlQueryBuilder join(String table) { if (StringUtils.isNullOrEmpty(table)) { throw new IllegalArgumentException("No table name provided with JOIN clause. Pleas...
3.26
hudi_HoodieParquetRealtimeInputFormat_getRecordReader_rdh
// To make Hive on Spark queries work with RT tables. Our theory is that due to // {@link org.apache.hadoop.hive.ql.io.parquet.ProjectionPusher} // not handling empty list correctly, the ParquetRecordReaderWrapper ends up adding the same column ids multiple // times which ultimately breaks the query. @Override public R...
3.26
hudi_HoodieDataSourceHelpers_latestCommit_rdh
/** * Returns the last successful write operation's instant time. */ @PublicAPIMethod(maturity = ApiMaturityLevel.STABLE) public static String latestCommit(FileSystem fs, String basePath) { HoodieTimeline timeline = allCompletedCommitsCompactions(fs, basePath); return timeline.lastInstant().get().getTimes...
3.26
hudi_HoodieDataSourceHelpers_hasNewCommits_rdh
/** * Checks if the Hoodie table has new data since given timestamp. This can be subsequently fed to an incremental * view read, to perform incremental processing. */@PublicAPIMethod(maturity = ApiMaturityLevel.STABLE) public static boolean hasNewCommits(FileSystem fs, String basePath, String commitTimestamp) { ...
3.26
hudi_HoodieDataSourceHelpers_listCommitsSince_rdh
/** * Get a list of instant times that have occurred, from the given instant timestamp. */ @PublicAPIMethod(maturity = ApiMaturityLevel.STABLE) public static List<String> listCommitsSince(FileSystem fs, String basePath, String instantTimestamp) { HoodieTimeline v0 = allCompletedCommitsCompactions(fs, basePath); r...
3.26
hudi_CompletionTimeQueryView_load_rdh
/** * This is method to read instant completion time. * This would also update 'startToCompletionInstantTimeMap' map with start time/completion time pairs. * Only instants starts from 'startInstant' (inclusive) are considered. */ private void load() { // load active instants first. this.f0.getActiveTimeline...
3.26
hudi_CompletionTimeQueryView_isCompleted_rdh
/** * Returns whether the instant is completed. */public boolean isCompleted(String instantTime) { return this.startToCompletionInstantTimeMap.containsKey(instantTime) || HoodieTimeline.compareTimestamps(instantTime, LESSER_THAN, this.firstNonSavepointCommit); }
3.26
hudi_CompletionTimeQueryView_isSlicedAfterOrOn_rdh
/** * Returns whether the give instant time {@code instantTime} is sliced after or on the base instant {@code baseInstant}. */ public boolean isSlicedAfterOrOn(String baseInstant, String instantTime) { Option<String> completionTimeOpt = getCompletionTime(baseInstant, instantTime); if (completionTimeOpt.isPres...
3.26
hudi_CompletionTimeQueryView_getCompletionTime_rdh
/** * Queries the instant completion time with given start time. * * @param startTime * The start time. * @return The completion time if the instant finished or empty if it is still pending. */ public Option<String> getCompletionTime(String startTime) { String completionTime = this.startToCompletionInstantT...
3.26
hudi_CompletionTimeQueryView_isCompletedBefore_rdh
/** * Returns whether the give instant time {@code instantTime} completed before the base instant {@code baseInstant}. */ public boolean isCompletedBefore(String baseInstant, String instantTime) { Option<String> completionTimeOpt = getCompletionTime(baseInstant, instantTime); if (compl...
3.26
hudi_ConflictDetectionUtils_getDefaultEarlyConflictDetectionStrategy_rdh
/** * * @param markerType * Marker type. * @return The class name of the default strategy for early conflict detection. */ public static String getDefaultEarlyConflictDetectionStrategy(MarkerType markerType) { switch (markerType) { case DIRECT : return SimpleDirectMarkerBasedDetectionStr...
3.26
hudi_HoodieParquetDataBlock_readRecordsFromBlockPayload_rdh
/** * NOTE: We're overriding the whole reading sequence to make sure we properly respect * the requested Reader's schema and only fetch the columns that have been explicitly * requested by the caller (providing projected Reader's schema) */ @Override protected <T> ClosableIterator<HoodieRecord<T>> read...
3.26
hudi_AbstractIndexingCatchupTask_awaitInstantCaughtUp_rdh
/** * For the given instant, this method checks if it is already caught up or not. * If not, it waits until the instant is completed. * * @param instant * HoodieInstant to check * @return null if instant is already caught up, else the instant after it is completed. */ HoodieInstant awaitInstantCaughtUp(HoodieI...
3.26
hudi_AdbSyncTool_syncPartitions_rdh
/** * Syncs the list of storage partitions passed in (checks if the partition is in adb, if not adds it or if the * partition path does not match, it updates the partition path). */ private void syncPartitions(String tableName, List<String> writtenPartitionsSince) { try { if (config.getSplitStrings(META_SYNC_PAR...
3.26
hudi_AdbSyncTool_syncSchema_rdh
/** * Get the latest schema from the last commit and check if its in sync with the ADB * table schema. If not, evolves the table schema. * * @param tableName * The table to be synced * @param tableExists * Whether target table exists * @param useRealTimeInputFormat * Whether using realtime input format ...
3.26
hudi_MergeOnReadInputFormat_builder_rdh
/** * Returns the builder for {@link MergeOnReadInputFormat}. */ public static Builder builder() { return new Builder(); }
3.26
hudi_MergeOnReadInputFormat_mayShiftInputSplit_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- /** * Shifts the input split by its consumed records number. * * <p>Note: This action is time-consuming. */ private void mayShiftInputSplit(MergeOnRe...
3.26
hudi_MergeOnReadInputFormat_getRequiredPosWithCommitTime_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- private static int[] getRequiredPosWithCommitTime(int[] requiredPos) { if (getCommitTimePos(requiredPos) >= 0) { return requiredPos; } ...
3.26
hudi_ExecutorFactory_isBufferingRecords_rdh
/** * Checks whether configured {@link HoodieExecutor} buffer records (for ex, by holding them * in the queue) */ public static boolean isBufferingRecords(HoodieWriteConfig config) { ExecutorType executorType = config.getExecutorType(); switch (executorType) { case BOUNDED_IN_MEMORY : cas...
3.26
hudi_NonThrownExecutor_execute_rdh
/** * Run the action in a loop. */ public void execute(final ThrowingRunnable<Throwable> action, final String actionName, final Object... actionParams) { m0(action, this.exceptionHook, actionName, actionParams); }
3.26
hudi_NonThrownExecutor_m0_rdh
/** * Run the action in a loop. */ public void m0(final ThrowingRunnable<Throwable> action, final ExceptionHook hook, final String actionName, final Object... actionParams) { executor.execute(wrapAction(action, hook, actionName, actionParams)); }
3.26
hudi_NonThrownExecutor_m1_rdh
/** * Run the action in a loop and wait for completion. */ public void m1(ThrowingRunnable<Throwable> action, String actionName, Object... actionParams) { try { executor.submit(wrapAction(action, this.exceptionHook, actionName, actionParams)).get(); } catch (InterruptedException e) {handleException(...
3.26
hudi_MaxwellJsonKafkaSourcePostProcessor_isTargetTable_rdh
/** * Check if it is the right table we want to consume from. * * @param database * database the data belong to * @param table * table the data belong to */ private boolean isTargetTable(String database, String table) { if (!...
3.26
hudi_WriteMarkers_create_rdh
/** * Creates a marker without checking if the marker already exists. * This can invoke marker-based early conflict detection when enabled for multi-writers. * * @param partitionPath * partition path in the table * @param fileName * file name * @param type * write ...
3.26
hudi_WriteMarkers_getMarkerPath_rdh
/** * Returns the marker path. Would create the partition path first if not exists * * @param partitionPath * The partition path * @param fileName * The file name * @param type * The IO type * @return path of the marker file */ protected Path getMarkerPath(String partitionPath, String fileName, IOTyp...
3.26
hudi_WriteMarkers_getMarkerFileName_rdh
/** * Gets the marker file name, in the format of "[file_name].marker.[IO_type]". * * @param fileName * file name * @param type * IO type * @return the marker file name */ protected static String getMarkerFileName(String fileName, IOType type) { return String.format("%s%s.%s", fileName, HoodieTableMetaC...
3.26
hudi_WriteMarkers_stripMarkerSuffix_rdh
/** * Strips the marker file suffix from the input path, i.e., ".marker.[IO_type]". * * @param path * file path * @return Stripped path */ public static String stripMarkerSuffix(String path) { return path.substring(0, path.indexOf(HoodieTableMetaClient.MARKER_EXTN)); }
3.26
hudi_WriteMarkers_createIfNotExists_rdh
/** * Creates a marker if the marker does not exist. * This can invoke marker-based early conflict detection when enabled for multi-writers. * * @param partitionPath * partition path in the table * @param fileName * file name * @param type * write IO type * @param writeConfig * Hudi write configs. *...
3.26
hudi_WriteMarkers_quietDeleteMarkerDir_rdh
/** * Quietly deletes the marker directory. * * @param context * {@code HoodieEngineContext} instance. * @param parallelism * parallelism for deleting the marker files in the directory. */ public void quietDeleteMarkerDir(HoodieEngineContext context, int parallelism) { try { context.setJobStatus(...
3.26
hudi_SparkHoodieIndexFactory_isGlobalIndex_rdh
/** * Whether index is global or not. * * @param config * HoodieWriteConfig to use. * @return {@code true} if index is a global one. else {@code false}. */ public static boolean isGlobalIndex(HoodieWriteConfig config) { switch (config.getIndexType()) { case HBASE : return true; case INMEMORY : ...
3.26
hudi_MetadataConversionUtils_convertCommitMetadataToJsonBytes_rdh
/** * Convert commit metadata from avro to json. */ public static <T extends SpecificRecordBase> byte[] convertCommitMetadataToJsonBytes(T avroMetaData, Class<T> clazz) { Schema avroSchema = (clazz == HoodieReplaceCommitMetadata.class) ? HoodieReplaceCommitMetadata.getClassSchema() : HoodieCommitMetadata.getClas...
3.26
hudi_MetadataConversionUtils_convertReplaceCommitMetadata_rdh
/** * Convert replacecommit metadata from json to avro. */ private static HoodieReplaceCommitMetadata convertReplaceCommitMetadata(HoodieReplaceCommitMetadata replaceCommitMetadata) { replaceCommitMetadata.getPartitionToWriteStats().remove(null); replaceCommitMetadata.getPartitionToReplaceFileIds().remove(nul...
3.26
hudi_MetadataConversionUtils_convertCommitMetadata_rdh
/** * Convert commit metadata from json to avro. */ public static <T extends SpecificRecordBase> T convertCommitMetadata(HoodieCommitMetadata hoodieCommitMetadata) { if (hoodieCommitMetadata instanceof HoodieReplaceCommitMetadata) { return ((T) (convertReplaceCommitMetadata(((HoodieReplaceCommitMetadat...
3.26
hudi_HoodieSparkQuickstart_insertData_rdh
/** * Generate some new trips, load them into a DataFrame and write the DataFrame into the Hudi dataset as below. */ public static Dataset<Row> insertData(SparkSession spark, JavaSparkContext jsc, String tablePath, String tableName, HoodieExampleDataGenerator<HoodieAvroPayload> dataGen) { String v21 = Long.toStri...
3.26
hudi_HoodieSparkQuickstart_insertOverwriteData_rdh
/** * Generate new records, load them into a {@link Dataset} and insert-overwrite it into the Hudi dataset */ public static Dataset<Row> insertOverwriteData(SparkSession spark, JavaSparkContext jsc, String tablePath, String tableName, HoodieExampleDataGenerator<HoodieAvroPayload> dataGen) { String commitTime =...
3.26
hudi_HoodieSparkQuickstart_delete_rdh
/** * Delete data based in data information. */ public static Dataset<Row> delete(SparkSession spark, String tablePath, String tableName) { Dataset<Row> roViewDF = spark.read().format("hudi").load(tablePath + "/*/*/*/*"); roViewDF.createOrReplaceTempView("hudi_ro_table"); Dataset<Row> toBeDeletedDf = spar...
3.26
hudi_HoodieSparkQuickstart_updateData_rdh
/** * This is similar to inserting new data. Generate updates to existing trips using the data generator, * load into a DataFrame and write DataFrame into the hudi dataset. */ public static Dataset<Row> updateData(SparkSession spark, JavaSparkContext jsc, String tablePath, String tableName, HoodieExampleDataGenerat...
3.26
hudi_HoodieSparkQuickstart_incrementalQuery_rdh
/** * Hudi also provides capability to obtain a stream of records that changed since given commit timestamp. * This can be achieved using Hudi’s incremental view and providing a begin time from which changes need to be streamed. * We do not need to specify endTime, if we want all changes after the given commit (as i...
3.26
hudi_HoodieSparkQuickstart_pointInTimeQuery_rdh
/** * Lets look at how to query data as of a specific time. * The specific time can be represented by pointing endTime to a specific commit time * and beginTime to “000” (denoting earliest possible commit time). */ public static void pointInTimeQuery(SparkSession spark, String tablePath, String tableName) { Lis...
3.26
hudi_HoodieSparkQuickstart_runQuickstart_rdh
/** * Visible for testing */ public static void runQuickstart(JavaSparkContext jsc, SparkSession spark, String tableName, String tablePath) { final HoodieExampleDataGenerator<HoodieAvroPayload> dataGen = new HoodieExampleDataGenerator<>(); String snapshotQuery = "SELECT begin_lat, begin_lon, driver, end_lat, ...
3.26
hudi_HoodieSparkQuickstart_queryData_rdh
/** * Load the data files into a DataFrame. */ public static void queryData(SparkSession spark, JavaSparkContext jsc, String tablePath, String tableName, HoodieExampleDataGenerator<HoodieAvroPayload> dataGen) { Dataset<Row> roViewDF = spark.read().format("hudi").load(tablePath + "/*/*/*/*"); roViewDF.createO...
3.26
hudi_HoodieSparkQuickstart_deleteByPartition_rdh
/** * Delete the data of the first partition. */ public static void deleteByPartition(SparkSession spark, String tablePath, String tableName) { Dataset<Row> df = spark.emptyDataFrame(); df.write().format("hudi").options(QuickstartUtils.getQuickstartWriteConfigs()).option(HoodieWriteConfig.PRECOMBINE_FIELD_N...
3.26
hudi_DagUtils_convertYamlToDag_rdh
/** * Converts a YAML representation to {@link WorkflowDag}. */ public static WorkflowDag convertYamlToDag(String yaml) throws IOException { int dagRounds = DEFAULT_DAG_ROUNDS; int intermittentDelayMins = DEFAULT_INTERMITTENT_DELAY_MINS; String dagName = DEFAULT_DAG_NAME; Map<String, DagNode> allNode...
3.26
hudi_DagUtils_convertDagToYaml_rdh
/** * Converts {@link WorkflowDag} to a YAML representation. */ public static String convertDagToYaml(WorkflowDag dag) throws IOException { final ObjectMapper yamlWriter = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER).enable(Feature.MINIMIZE_QUOTES).enable(JsonParser.Feature.ALLOW_UN...
3.26
hudi_DagUtils_convertYamlPathToDag_rdh
/** * Converts a YAML path to {@link WorkflowDag}. */ public static WorkflowDag convertYamlPathToDag(FileSystem fs, String path) throws IOException { InputStream is = fs.open(new Path(path)); return convertYamlToDag(toString(is)); }
3.26
hudi_HoodieLogFormatWriter_getLogBlockLength_rdh
/** * This method returns the total LogBlock Length which is the sum of 1. Number of bytes to write version 2. Number of * bytes to write ordinal 3. Length of the headers 4. Number of bytes used to write content length 5. Length of the * content 6. Length of the footers 7. Number of bytes to write totalLogBlockLengt...
3.26
hudi_HoodieLogFormatWriter_withOutputStream_rdh
/** * Overrides the output stream, only for test purpose. */ @VisibleForTesting public void withOutputStream(FSDataOutputStream output) { this.f1 = output; }
3.26
hudi_HoodieLogFormatWriter_addShutDownHook_rdh
/** * Close the output stream when the JVM exits. */ private void addShutDownHook() { shutdownThread = new Thread() { public void run() { try { if (f1 != null) { close(); } } catch (Exception e) { f0.warn("unable to c...
3.26
hudi_HoodieLogFormatWriter_getOutputStream_rdh
/** * Lazily opens the output stream if needed for writing. * * @return OutputStream for writing to current log file. * @throws IOException */ private FSDataOutputStream getOutputStream() throws IOException { if (this.f1 == null) { boolean created = false; while (!created) { try { ...
3.26
hudi_HoodieFlinkCompactor_start_rdh
/** * Main method to start compaction service. */ public void start(boolean serviceMode) throws Exception { if (serviceMode) { compactionScheduleService.start(null); try { compactionScheduleService.waitForShutdown(); } catch (Exception e) { throw new HoodieException...
3.26
hudi_HoodieFlinkCompactor_shutdownAsyncService_rdh
/** * Shutdown async services like compaction/clustering as DeltaSync is shutdown. */ public void shutdownAsyncService(boolean error) { LOG.info("Gracefully shutting down compactor. Error ?" + error); executor.shutdown(); writeClient.close(); }
3.26
hudi_HoodieHFileDataBlock_lookupRecords_rdh
// TODO abstract this w/in HoodieDataBlock @Override protected <T> ClosableIterator<HoodieRecord<T>> lookupRecords(List<String> sortedKeys, boolean fullKey) throws IOException { HoodieLogBlockContentLocation blockContentLoc = getBlockContentLocation().get(); // NOTE: It's important to extend Hadoop configuration here t...
3.26
hudi_HoodieHFileDataBlock_printRecord_rdh
/** * Print the record in json format */ private void printRecord(String msg, byte[] bs, Schema schema) throws IOException { GenericRecord record = HoodieAvroUtils.bytesToAvro(bs, schema); byte[] json = HoodieAvroUtils.avroToJson(record, true); LOG.error(String.format("%s: %s", msg, new String(json))); }
3.26
hudi_FlinkOptions_flatOptions_rdh
/** * Collects all the config options, the 'properties.' prefix would be removed if the option key starts with it. */ public static Configuration flatOptions(Configuration conf) { final Map<String, String> propsMap = new HashMap<>(); conf.toMap().forEach((key, value) -> { final String subKey = (key.st...
3.26
hudi_FlinkOptions_isDefaultValueDefined_rdh
/** * Returns whether the given conf defines default value for the option {@code option}. */ public static <T> boolean isDefaultValueDefined(Configuration conf, ConfigOption<T> option) { return (!conf.getOptional(option).isPresent()) || conf.get(option).equals(option.defaultValue()); }
3.26
hudi_FlinkOptions_fromMap_rdh
/** * Creates a new configuration that is initialized with the options of the given map. */ public static Configuration fromMap(Map<String, String> map) { final Configuration configuration = new Configuration(); for (Map.Entry<String, String> entry : map.entrySet()) { configuration.setString(entry.g...
3.26
hudi_FlinkOptions_optionalOptions_rdh
/** * Returns all the optional config options. */ public static Set<ConfigOption<?>> optionalOptions() { Set<ConfigOption<?>> options = new HashSet<>(allOptions());options.remove(PATH); return options; }
3.26
hudi_FlinkOptions_getPropertiesWithPrefix_rdh
/** * Collects the config options that start with specified prefix {@code prefix} into a 'key'='value' list. */ public static Map<String, String> getPropertiesWithPrefix(Map<String, String> options, String prefix) { final Map<String, String> hoodieProperties = new HashMap<>(); if (hasPropertyOptions(options, ...
3.26
hudi_FlinkOptions_allOptions_rdh
/** * Returns all the config options. */ public static List<ConfigOption<?>> allOptions() { return OptionsResolver.allOptions(FlinkOptions.class); }
3.26
hudi_SerializationUtils_serialize_rdh
/** * <p> * Serializes an {@code Object} to a byte array for storage/serialization. * </p> * * @param obj * the object to serialize to bytes * @return a byte[] with the converted Serializable * @throws IOException * if the serialization fails */ public static byte[] serialize(final Object obj) throws IOEx...
3.26
hudi_SerializationUtils_deserialize_rdh
/** * <p> * Deserializes a single {@code Object} from an array of bytes. * </p> * * <p> * If the call site incorrectly types the return value, a {@link ClassCastException} is thrown from the call site. * Without Generics in this declaration, the call site must type cast and can cause the same ClassCastException....
3.26
hudi_DataSourceUtils_dropDuplicates_rdh
/** * Drop records already present in the dataset. * * @param jssc * JavaSparkContext * @param incomingHoodieRecords * HoodieRecords to deduplicate * @param writeConfig * HoodieWriteConfig */ @SuppressWarnings("unchecked") public static JavaRDD<HoodieRecord> dropDuplicates(JavaSparkContext jssc, JavaRDD...
3.26
hudi_DataSourceUtils_createPayload_rdh
/** * Create a payload class via reflection, do not ordering/precombine value. */ public static HoodieRecordPayload createPayload(String payloadClass, GenericRecord record) throws IOException { try {return ((HoodieRecordPayload) (ReflectionUtils.loadClass(payloadClass, new Class<?>[]{ Option.class }, Op...
3.26
hudi_DataSourceUtils_tryOverrideParquetWriteLegacyFormatProperty_rdh
/** * Checks whether default value (false) of "hoodie.parquet.writelegacyformat.enabled" should be * overridden in case: * * <ul> * <li>Property has not been explicitly set by the writer</li> * <li>Data schema contains {@code DecimalType} that would be affected by it</li> * </ul> * * If both of the aforeme...
3.26
hudi_DataSourceUtils_createUserDefinedBulkInsertPartitioner_rdh
/** * Create a UserDefinedBulkInsertPartitioner class via reflection, * <br> * if the class name of UserDefinedBulkInsertPartitioner is configured through the HoodieWriteConfig. * * @see HoodieWriteConfig#getUserDefinedBulkInsertPartitionerClass() */ private static Option<BulkInsertPartitioner> createUserDefinedB...
3.26
hudi_CompactionCommitSink_commitIfNecessary_rdh
/** * Condition to commit: the commit buffer has equal size with the compaction plan operations * and all the compact commit event {@link CompactionCommitEvent} has the same compaction instant time. * * @param instant * Compaction commit instant time * @param events * Commit e...
3.26
hudi_HoodieMergeHandleFactory_create_rdh
/** * Creates a merge handle for compaction path. */ public static <T, I, K, O> HoodieMergeHandle<T, I, K, O> create(HoodieWriteConfig writeConfig, String instantTime, HoodieTable<T, I, K, O> table, Map<String, HoodieRecord<T>> keyToNewRecords, String partitionPath, String fileId, HoodieBaseFile dataFileToBeMerged, T...
3.26
hudi_OptionsInference_m0_rdh
/** * Utilities that help to auto generate the client id for multi-writer scenarios. * It basically handles two cases: * * <ul> * <li>find the next client id for the new job;</li> * <li>clean the existing inactive client heartbeat files.</li> * </ul> * * @see ClientIds */ public static void m0(Configurati...
3.26
hudi_OptionsInference_setupSourceTasks_rdh
/** * Sets up the default source task parallelism if it is not specified. * * @param conf * The configuration * @param envTasks * The parallelism of the execution env */ public static void setupSourceTasks(Configuration conf, int envTasks) { if (!conf.contains(FlinkOptions.READ_TASKS)) { conf.set...
3.26
hudi_OptionsInference_setupSinkTasks_rdh
/** * Sets up the default sink tasks parallelism if it is not specified. * * @param conf * The configuration * @param envTasks * The parallelism of the execution env */ public static void setupSinkTasks(Configuration conf, int envTasks) { // write task number, default same as execution env tasks if (...
3.26
hudi_DefaultHoodieRecordPayload_m0_rdh
/** * * @param genericRecord * instance of {@link GenericRecord} of interest. * @param properties * payload related properties * @returns {@code true} if record represents a delete record. {@code false} otherwise. */ protected boolean m0(GenericRecord genericRecord, Properties properties) { final String dele...
3.26
hudi_HoodieAsyncService_waitForShutdown_rdh
/** * Wait till the service shutdown. If the service shutdown with exception, it will be thrown * * @throws ExecutionException * @throws InterruptedException */ public void waitForShutdown() throws ExecutionException, InterruptedException { if (future == null) { return; } try { future.g...
3.26
hudi_HoodieAsyncService_shutdownCallback_rdh
/** * Add shutdown callback for the completable future. * * @param callback * The callback */ @SuppressWarnings("unchecked") private void shutdownCallback(Function<Boolean, Boolean> callback) { if (future == null) { return; } future.whenComplete((resp, error) -> { if (null != callback...
3.26
hudi_HoodieAsyncService_start_rdh
/** * Start the service. Runs the service in a different thread and returns. Also starts a monitor thread to * run-callbacks in case of shutdown * * @param onShutdownCallback */ public void start(Function<Boolean, Boolean> onShutdo...
3.26
hudi_HoodieAsyncService_enqueuePendingAsyncServiceInstant_rdh
/** * Enqueues new pending table service instant. * * @param instant * {@link HoodieInstant} to enqueue. */ public void enqueuePendingAsyncServiceInstant(HoodieInstant instant) { f0.info("Enqueuing new pending table service instant: " + instant.getTimestamp()); pendingInstants.add(instant); }
3.26
hudi_HoodieAsyncService_shutdown_rdh
/** * Request shutdown either forcefully or gracefully. Graceful shutdown allows the service to finish up the current * round of work and shutdown. For graceful shutdown, it waits till the service is shutdown * * @param force * Forcefully shutdown */ public void shutdown(boolean force) { if ((!f1) || force...
3.26
hudi_HoodieAsyncService_waitTillPendingAsyncServiceInstantsReducesTo_rdh
/** * Wait till outstanding pending compaction/clustering reduces to the passed in value. * * @param numPending * Maximum pending compactions/clustering allowed * @throws InterruptedException */ public void waitTillPendingAsyncServiceInstantsReducesTo(int numPending) throws InterruptedException { try { ...
3.26
hudi_HoodieAsyncService_fetchNextAsyncServiceInstant_rdh
/** * Fetch next pending compaction/clustering instant if available. * * @return {@link HoodieInstant} corresponding to the next pending compaction/clustering. * @throws InterruptedException */ HoodieInstant fetchNextAsyncServiceInstant() throws InterruptedException { f0.info(String.format("Waiting for next i...
3.26
hudi_Registry_getAllMetrics_rdh
/** * Get all registered metrics. * * @param flush * clear all metrics after this operation. * @param prefixWithRegistryName * prefix each metric name with the registry name. * @return */ static Map<String, Long> getAllMetrics(boolean flush, boolean prefixWithRegistryName) { synchronized(Registry.class...
3.26
hudi_Registry_getAllCounts_rdh
/** * Get all Counter type metrics. */ default Map<String, Long> getAllCounts() { return getAllCounts(false); }
3.26
hudi_Registry_getRegistry_rdh
/** * Get (or create) the registry for a provided name and given class. * * @param registryName * Name of the registry. * @param clazz * The fully qualified name of the registry class to create. */ static Registry getRegistry(String registryName, String clazz) { synchronized(Registry.class) { if...
3.26
hudi_CompactionAdminClient_repairCompaction_rdh
/** * Renames delta files to make file-slices consistent with the timeline as dictated by Hoodie metadata. Use when * compaction unschedule fails partially. * * This operation MUST be executed with compactions and writer turned OFF. * * @param compactionInstant * Compaction Instant to be repaired * @param dry...
3.26
hudi_CompactionAdminClient_unscheduleCompactionFileId_rdh
/** * Remove a fileId from pending compaction. Removes the associated compaction operation and rename delta-files that * were generated for that file-id after the compaction operation was scheduled. * * This operation MUST be executed with compactions and writer turned OFF. * * @param fgId * FileGroupId to be ...
3.26
hudi_CompactionAdminClient_runRenamingOps_rdh
/** * Execute Renaming operation. * * @param metaClient * HoodieTable MetaClient * @param renameActions * List of rename operations */ private List<RenameOpResult> runRenamingOps(HoodieTableMetaClient metaClient, List<Pair<HoodieLogFile, HoodieLogFile>> renameActions, int parallelism, boolean dryRun) { i...
3.26
hudi_CompactionAdminClient_getCompactionPlan_rdh
/** * Construction Compaction Plan from compaction instant. */ private static HoodieCompactionPlan getCompactionPlan(HoodieTableMetaClient metaClient, String compactionInstant) throws IOException { return TimelineMetadataUtils.deserializeCompactionPlan(metaClient.getActiveTimeline().readCompactionPlanAsBytes(Hood...
3.26
hudi_CompactionAdminClient_unscheduleCompactionPlan_rdh
/** * Un-schedules compaction plan. Remove All compaction operation scheduled. * * @param compactionInstant * Compaction Instant * @param skipValidation * Skip validation step * @param parallelism * Parallelism * @param dryRun * Dry Run */public List<RenameOpResult> unscheduleCompactionPlan(String co...
3.26
hudi_CompactionAdminClient_validateCompactionOperation_rdh
/** * Check if a compaction operation is valid. * * @param metaClient * Hoodie Table Meta client * @param compactionInstant * Compaction Instant * @param operation * Compaction Operation * @param fsViewOpt * File System View */ private ValidationOpResult validateCompactionOperation(HoodieTableMetaCli...
3.26
hudi_CompactionAdminClient_validateCompactionPlan_rdh
/** * Validate all compaction operations in a compaction plan. Verifies the file-slices are consistent with corresponding * compaction operations. * * @param metaClient * Hoodie Table Meta Client * @param compactionInstant * Compaction Instant */ public List<ValidationOpResult> validateCompactionPlan(Hoodi...
3.26
hudi_CompactionAdminClient_renameLogFile_rdh
/** * Rename log files. This is done for un-scheduling a pending compaction operation NOTE: Can only be used safely when * no writer (ingestion/compaction) is running. * * @param metaClient * Hoodie Table Meta-Client * @param oldLogFile * Old Log File * @param newLogFile * New Log File */ protected stat...
3.26