name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_ParquetUtils_filterParquetRowKeys_rdh
/** * Read the rowKey list matching the given filter, from the given parquet file. If the filter is empty, then this will * return all the rowkeys. * * @param filePath * The parquet file path. * @param configuration * configuration to build fs object * @param filter ...
3.26
hudi_ParquetUtils_readRangeFromParquetMetadata_rdh
/** * Parse min/max statistics stored in parquet footers for all columns. */ @SuppressWarnings("rawtype") public List<HoodieColumnRangeMetadata<Comparable>> readRangeFromParquetMetadata(@Nonnull Configuration conf, @Nonnull Path parquetFilePath, @Nonnull List<String> cols) { ParquetMetadata metadata = readMetada...
3.26
hudi_ParquetUtils_fetchRecordKeysWithPositions_rdh
/** * Fetch {@link HoodieKey}s with row positions from the given parquet file. * * @param configuration * configuration to build fs object * @param filePath * The parquet file path. * @param keyGeneratorOpt * instance of KeyGenerator. * @return {@link List} of pairs of {@link HoodieKey} and row position ...
3.26
hudi_ParquetUtils_getRowCount_rdh
/** * Returns the number of records in the parquet file. * * @param conf * Configuration * @param parquetFilePath * path of the file */ @Override public long getRowCount(Configuration conf, Path parquetFilePath) { ParquetMetadata footer; long rowCount = 0; footer = readMetadata(conf, parquetFileP...
3.26
hudi_FlinkTables_createTable_rdh
/** * Creates the hoodie flink table. * * <p>This expects to be used by driver. */ public static HoodieFlinkTable<?> createTable(Configuration conf) { HoodieWriteConfig writeConfig = FlinkWriteClients.getHoodieClientConfig(conf, true, false); return HoodieFlinkTable.create(writeConfig, HoodieFlinkEngineCon...
3.26
hudi_HoodieLSMTimelineManifest_toJsonString_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- public String toJsonString() throws IOException { return JsonUtils.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this); }
3.26
hudi_HoodieWriteStat_setPath_rdh
/** * Set path and tempPath relative to the given basePath. */ public void setPath(Path basePath, Path path) { this.path = path.toString().replace(basePath + "/", ""); }
3.26
hudi_EmbeddedTimelineServerHelper_createEmbeddedTimelineService_rdh
/** * Instantiate Embedded Timeline Server. * * @param context * Hoodie Engine Context * @param config * Hoodie Write Config * @return TimelineServer if configured to run * @throws IOException */ public static Option<EmbeddedTimelineService> createEmbeddedTimelineService(HoodieEngineContext context, Hoodie...
3.26
hudi_SparkInsertOverwritePartitioner_getSmallFiles_rdh
/** * Returns a list of small files in the given partition path. */ @Override protected List<SmallFile> getSmallFiles(String partitionPath) { // for overwrite, we ignore all existing files. So do not consider any file to be smallFiles return Collections.emptyList(); }
3.26
hudi_CleanPlanActionExecutor_requestClean_rdh
/** * Creates a Cleaner plan if there are files to be cleaned and stores them in instant file. * Cleaner Plan contains absolute file paths. * * @param startCleanTime * Cleaner Instant Time * @return Cleaner Plan if generated */ protected Option<HoodieCleanerPlan> requestClean(String startCleanTime) { fina...
3.26
hudi_HoodieDataBlock_list2Iterator_rdh
/** * Converts the given list to closable iterator. */ static <T> ClosableIterator<T> list2Iterator(List<T> list) { Iterator<T> iterator = list.iterator(); return new ClosableIterator<T>() { @Override public void close() { // ignored } @Override public boolean hasNext() { return iterator.hasNext(); } @Override pub...
3.26
hudi_HoodieDataBlock_getRecordIterator_rdh
/** * Batch get of keys of interest. Implementation can choose to either do full scan and return matched entries or * do a seek based parsing and return matched entries. * * @param keys * keys of interest. * @return List of IndexedRecords for the keys of interest. * @throws IOEx...
3.26
hudi_HoodieDataBlock_getEngineRecordIterator_rdh
/** * Batch get of keys of interest. Implementation can choose to either do full scan and return matched entries or * do a seek based parsing and return matched entries. * * @param readerContext * {@link HoodieReaderContext} instance with type T. * @param keys * Keys of interest. * @param fullKey * Wheth...
3.26
hudi_HoodieFileGroup_getLatestFileSlice_rdh
/** * Gets the latest slice - this can contain either. * <p> * - just the log files without data file - (or) data file with 0 or more log files */ public Option<FileSlice> getLatestFileSlice() { // there should always be one return Option.fromJavaOptional(getAllFileSlices().findFirst()); }
3.26
hudi_HoodieFileGroup_addLogFile_rdh
/** * Add a new log file into the group. * * <p>CAUTION: the log file must be added in sequence of the delta commit time. */ public void addLogFile(CompletionTimeQueryView completionTimeQueryView, HoodieLogFile logFile) { String baseInstantTime = getBaseInstantTime(completionTimeQueryView, logFile); if (!fi...
3.26
hudi_HoodieFileGroup_addNewFileSliceAtInstant_rdh
/** * Potentially add a new file-slice by adding base-instant time A file-slice without any data-file and log-files can * exist (if a compaction just got requested). */ public void addNewFileSliceAtInstant(String baseInstantTime) { if (!fileSlices.containsKey(baseInstantTime)) { fileSlices.put(baseInstan...
3.26
hudi_HoodieFileGroup_getAllFileSlices_rdh
/** * Provides a stream of committed file slices, sorted reverse base commit time. */ public Stream<FileSlice> getAllFileSlices() { if (!timeline.empty()) { return fileSlices.values().stream().filter(this::isFileSliceCommitted); } return Stream.empty(); }
3.26
hudi_HoodieFileGroup_getAllFileSlicesIncludingInflight_rdh
/** * Get all the file slices including in-flight ones as seen in underlying file system. */ public Stream<FileSlice> getAllFileSlicesIncludingInflight() { return fileSlices.values().stream(); }
3.26
hudi_HoodieFileGroup_getLatestFileSlicesIncludingInflight_rdh
/** * Get the latest file slices including inflight ones. */public Option<FileSlice> getLatestFileSlicesIncludingInflight() { return Option.fromJavaOptional(getAllFileSlicesIncludingInflight().findFirst()); }
3.26
hudi_HoodieFileGroup_isFileSliceCommitted_rdh
/** * A FileSlice is considered committed, if one of the following is true - There is a committed data file - There are * some log files, that are based off a commit or delta commit. */ private boolean isFileSliceCommitted(FileSlice slice) { if (!compareTimestamps(slice.getBaseInstantTime(), LESSER_THAN_OR_EQUA...
3.26
hudi_HoodieFileGroup_addBaseFile_rdh
/** * Add a new datafile into the file group. */ public void addBaseFile(HoodieBaseFile dataFile) { if (!fileSlices.containsKey(dataFile.getCommitTime())) { fileSlices.put(dataFile.getCommitTime(), new FileSlice(fileGroupId, dataFile.getCommitTime())); } fileSlices.get(dataFile.getCommitTime()).s...
3.26
hudi_HoodieFileGroup_getLatestFileSliceBefore_rdh
/** * Obtain the latest file slice, upto an instantTime i.e < maxInstantTime. * * @param maxInstantTime * Max Instant Time * @return the latest file slice */public Option<FileSlice> getLatestFileSliceBefore(String maxInstantTime) { return Option.fromJavaOptional(getAllFileSlices().filter(slice -> compareTim...
3.26
hudi_HoodieFileGroup_getAllBaseFiles_rdh
/** * Stream of committed data files, sorted reverse commit time. */ public Stream<HoodieBaseFile> getAllBaseFiles() { return getAllFileSlices().filter(slice -> slice.getBaseFile().isPresent()).map(slice -> slice.getBaseFile().get()); }
3.26
hudi_HoodieFileGroup_getLatestFileSliceBeforeOrOn_rdh
/** * Obtain the latest file slice, upto a instantTime i.e <= maxInstantTime. */ public Option<FileSlice> getLatestFileSliceBeforeOrOn(String maxInstantTime) { return Option.fromJavaOptional(getAllFileSlices().filter(slice -> compareTimestamps(slice.getBaseInstantTime(), LESSER_THAN_OR_EQUALS, maxInstantTime)).fi...
3.26
hudi_HoodieIndexID_isPartition_rdh
/** * Is this ID a Partition type ? * * @return True if this ID of PartitionID type */ public final boolean isPartition() { return getType() == Type.PARTITION; }
3.26
hudi_HoodieIndexID_isFileID_rdh
/** * Is this ID a FileID type ? * * @return True if this ID of FileID type */ public final boolean isFileID() { return getType() == Type.FILE; }
3.26
hudi_HoodieIndexID_asBase64EncodedString_rdh
/** * Get the Base64 encoded version of the ID. */ public String asBase64EncodedString() { throw new HoodieNotSupportedException("Unsupported hash for " + getType()); }
3.26
hudi_HoodieIndexID_isColumnID_rdh
/** * Is this ID a ColumnID type ? * * @return True if this ID of ColumnID type */ public final boolean isColumnID() { return getType() == Type.COLUMN; }
3.26
hudi_HoodieMultiTableStreamer_populateTableExecutionContextList_rdh
// commonProps are passed as parameter which contain table to config file mapping private void populateTableExecutionContextList(TypedProperties properties, String configFolder, FileSystem fs, Config config) throws IOException { List<String> tablesToBeIngested = getTablesToBeIngested(properties);logger.info("tabl...
3.26
hudi_HoodieMultiTableStreamer_sync_rdh
/** * Creates actual HoodieDeltaStreamer objects for every table/topic and does incremental sync. */ public void sync() { for (TableExecutionContext context : tableExecutionContexts) {try { new HoodieStreamer(context.getConfig(), jssc, Option.ofNullable(context.getProperties())).sync(); ...
3.26
hudi_HoodieAvroHFileReader_getSharedHFileReader_rdh
/** * Instantiates the shared HFile reader if not instantiated * * @return the shared HFile reader */ private Reader getSharedHFileReader() { if (!sharedReader.isPresent()) { synchronized(sharedLock) { if (!sharedReader.isPresent()) { sharedReader = Option.of(getHFileRead...
3.26
hudi_HoodieAvroHFileReader_filterRowKeys_rdh
/** * Filter keys by availability. * <p> * Note: This method is performant when the caller passes in a sorted candidate keys. * * @param candidateRowKeys * - Keys to check for the availability * @return Subset of candidate keys that are available */ @Override public Set<Pair<String, Long>> filterRowKeys(Set<S...
3.26
hudi_HoodieAvroHFileReader_getHFileReader_rdh
/** * Instantiate a new reader for HFile files. * * @return an instance of {@link HFile.Reader} */ private Reader getHFileReader() { if (content.isPresent()) { return HoodieHFileUtils.createHFileReader(fs, path, content.get()); } return HoodieHFileUtils.createHFileReader(fs, path, config, hadoop...
3.26
hudi_HoodieAvroHFileReader_readRecords_rdh
/** * NOTE: THIS SHOULD ONLY BE USED FOR TESTING, RECORDS ARE MATERIALIZED EAGERLY * <p> * Reads all the records with given schema and filtering keys. */ public static List<IndexedRecord> readRecords(HoodieAvroHFileReader reader, List<String> keys, Schema schema) throws IOException { Collections.sort(keys); return ...
3.26
hudi_SparkRDDReadClient_tagLocation_rdh
/** * Looks up the index and tags each incoming record with a location of a file that contains the row (if it is actually * present). Input RDD should contain no duplicates if needed. * * @param hoodieRecords * Input RDD of Hoodie records * @return Tagged RDD of Hoodie records */public JavaRDD<HoodieRecord<T>>...
3.26
hudi_SparkRDDReadClient_readROView_rdh
/** * Given a bunch of hoodie keys, fetches all the individual records out as a data frame. * * @return a dataframe */ public Dataset<Row> readROView(JavaRDD<HoodieKey> hoodieKeys, int parallelism) { assertSqlContext(); JavaPairRDD<HoodieKey, Option<Pair<String, String>>> lookupResultRDD = checkExists(hoodieKeys); ...
3.26
hudi_SparkRDDReadClient_checkExists_rdh
/** * Checks if the given [Keys] exists in the hoodie table and returns [Key, Option[FullFilePath]] If the optional * FullFilePath value is not present, then the key is not found. If the FullFilePath value is present, it is the path * component (without scheme) of the URI underlying file */ public JavaPairRDD<Hoodi...
3.26
hudi_SparkRDDReadClient_m0_rdh
/** * Return all pending compactions with instant time for clients to decide what to compact next. * * @return */ public List<Pair<String, HoodieCompactionPlan>> m0() { HoodieTableMetaClient metaClient = HoodieTableMetaClient.builder().setConf(hadoopConf).setBasePath(hoodieTable.getMetaClient().getBasePath()).setLo...
3.26
hudi_SparkRDDReadClient_filterExists_rdh
/** * Filter out HoodieRecords that already exists in the output folder. This is useful in deduplication. * * @param hoodieRecords * Input RDD of Hoodie records. * @return A subset of hoodieRecords RDD, with existing records filtered out. */ public JavaRDD<HoodieRecord<T>> filterExists(JavaRDD<HoodieRecord<T>> ...
3.26
hudi_SparkRDDReadClient_addHoodieSupport_rdh
/** * Adds support for accessing Hoodie built tables from SparkSQL, as you normally would. * * @return SparkConf object to be used to construct the SparkContext by caller */ public static SparkConf addHoodieSupport(SparkConf conf) { conf.set("spark.sql.hive.convertMetastoreParquet", "false")...
3.26
hudi_StringUtils_join_rdh
/** * <p> * Joins the elements of the provided array into a single String containing the provided list of elements. * </p> * * <p> * No separator is added to the joined String. Null objects or empty strings within the array are represented by empty * strings. * </p> * * <pre> * StringUtils.join(null) ...
3.26
hudi_StringUtils_nullToEmpty_rdh
/** * Returns the given string if it is non-null; the empty string otherwise. * * @param string * the string to test and possibly return * @return {@code string} itself if it is non-null; {@code ""} if it is null */ public static String nullToEmpty(@Nullable String string) { return string == null ? "" :...
3.26
hudi_StringUtils_emptyToNull_rdh
/** * Returns the given string if it is nonempty; {@code null} otherwise. * * @param string * the string to test and possibly return * @return {@code string} itself if it is nonempty; {@code null} if it is empty or null */ @Nullable public static String emptyToNull(@Nullable String string) { return stri...
3.26
hudi_StringUtils_split_rdh
/** * Splits input string, delimited {@code delimiter} into a list of non-empty strings * (skipping any empty string produced during splitting) */ public static List<String> split(@Nullable String input, String delimiter) { if (isNullOrEmpty(input)) { return Collections.emptyList(); } return Stre...
3.26
hudi_HoodieDataTableValidator_readConfigFromFileSystem_rdh
/** * Reads config from the file system. * * @param jsc * {@link JavaSparkContext} instance. * @param cfg * {@link Config} instance. * @return the {@link TypedProperties} instance. */private TypedProperties readConfigFromFileSystem(JavaSparkContext jsc, Config cfg) { return UtilHelpers.readConfig(jsc.ha...
3.26
hudi_RDDBucketIndexPartitioner_doPartitionAndCustomColumnSort_rdh
/** * Sort by specified column value. The behaviour is the same as `RDDCustomColumnsSortPartitioner` * * @param records * @param partitioner * @return */ private JavaRDD<HoodieRecord<T>> doPartitionAndCustomColumnSort(JavaRDD<HoodieRecord<T>> records, Partitioner partitioner) { final String[] sortColumns = so...
3.26
hudi_RDDBucketIndexPartitioner_doPartition_rdh
/** * Execute partition using the given partitioner. * If sorting is required, will do it within each data partition: * - if sortColumnNames is specified, apply sort to the column (the behaviour is the same as `RDDCustomColumnsSortPartitioner`) * - if table requires sort or BulkInsertSortMode is not None, then sort...
3.26
hudi_RDDBucketIndexPartitioner_doPartitionAndSortByRecordKey_rdh
/** * Sort by record key within each partition. The behaviour is the same as BulkInsertSortMode.PARTITION_SORT. * * @param records * @param partitioner * @return */ private JavaRDD<HoodieRecord<T>> doPartitionAndSortByRecordKey(JavaRDD<HoodieRecord<T>> records, Partitioner partitioner) { if (table.getConfig(...
3.26
hudi_HoodieHeartbeatClient_stopHeartbeatTimer_rdh
/** * Stops the timer of the given heartbeat. * * @param heartbeat * The heartbeat to stop. */ private void stopHeartbeatTimer(Heartbeat heartbeat) { LOG.info("Stopping heartbeat for instant " + heartbeat.getInstantTime()); heartbeat.getTimer().cancel(); heartbeat.setHeartbeatStopped(true); LOG.info("Stopped hea...
3.26
hudi_HoodieHeartbeatClient_stopHeartbeatTimers_rdh
/** * Stops all timers of heartbeats started via this instance of the client. * * @throws HoodieException */ public void stopHeartbeatTimers() throws HoodieException { instantToHeartbeatMap.values().stream().filter(this::isHeartbeatStarted).forEach(this::stopHeartbeatTimer); }
3.26
hudi_HoodieHeartbeatClient_start_rdh
/** * Start a new heartbeat for the specified instant. If there is already one running, this will be a NO_OP * * @param instantTime * The instant time for the heartbeat. */ public void start(String instantTime) { LOG.info("Received request to start heartbeat for instant time " + instantTime);Heartbeat heartbeat ...
3.26
hudi_HoodieHeartbeatClient_stop_rdh
/** * Stops the heartbeat and deletes the heartbeat file for the specified instant. * * @param instantTime * The instant time for the heartbeat. * @throws HoodieException */ public void stop(String instantTime) throws HoodieException { Heartbeat heartbeat = instantToHeartbeatMap.get(instantTime); if (isHeartb...
3.26
hudi_HoodieHeartbeatClient_isHeartbeatStarted_rdh
/** * Whether the given heartbeat is started. * * @param heartbeat * The heartbeat to check whether is started. * @return Whether the heartbeat is started. * @throws IOException */ private boolean isHeartbeatStarted(Heartbeat heartbeat) { return ((heartbeat != null) && heartbeat.isHeartbeatStarted()) && (!hear...
3.26
hudi_BaseVectorizedColumnReader_nextInt_rdh
/** * return zero. */protected static final class NullIntIterator extends IntIterator { @Override int nextInt() { return 0; }
3.26
hudi_SparkHoodieHBaseIndex_canIndexLogFiles_rdh
/** * Mapping is available in HBase already. */ @Override public boolean canIndexLogFiles() { return true; }
3.26
hudi_SparkHoodieHBaseIndex_locationTagFunction_rdh
/** * Function that tags each HoodieRecord with an existing location, if known. */ private <R> Function2<Integer, Iterator<HoodieRecord<R>>, Iterator<HoodieRecord<R>>> locationTagFunction(HoodieTableMetaClient metaClient) { // `multiGetBatchSize` is intended to be a batch per 100ms. To creat...
3.26
hudi_SparkHoodieHBaseIndex_getBatchSize_rdh
/** * Calculate putBatch size so that sum of requests across multiple jobs in a second does not exceed * maxQpsPerRegionServer for each Region Server. Multiplying qpsFraction to reduce the aggregate load on common RS * across topics. Assumption here is that all tables have regions across all RS, which is not necessa...
3.26
hudi_SparkHoodieHBaseIndex_doMutations_rdh
/** * Helper method to facilitate performing mutations (including puts and deletes) in Hbase. */ private void doMutations(BufferedMutator mutator, List<Mutation> mutations, RateLimiter limiter) throws IOException { if (mutations.isEmpty()) { return; } // report number of operations to account per second with ra...
3.26
hudi_SparkHoodieHBaseIndex_addShutDownHook_rdh
/** * Since we are sharing the HBaseConnection across tasks in a JVM, make sure the HBaseConnection is closed when JVM * exits. */ private void addShutDownHook() {if (null == shutdownThread) { shutdownThread = new Thread(() -> { try { hbaseConnection.close(); } catch...
3.26
hudi_SparkHoodieHBaseIndex_m0_rdh
/** * Only looks up by recordKey. */ @Override public boolean m0() { return true; }
3.26
hudi_SparkHoodieHBaseIndex_close_rdh
/** * Ensure that any resources used for indexing are released here. */ @Override public void close() { LOG.info("No resources to release from Hbase index"); }
3.26
hudi_DirectWriteMarkers_create_rdh
/** * Creates a marker file based on the full marker name excluding the base path and instant. * * @param markerName * the full marker name, e.g., "2021/08/13/file1.marker.CREATE" * @return path of the marker file */ public Option<Path> create(String markerName) { return create(new Path(markerDirPath, mark...
3.26
hudi_DirectWriteMarkers_deleteMarkerDir_rdh
/** * Deletes Marker directory corresponding to an instant. * * @param context * HoodieEngineContext. * @param parallelism * parallelism for deletion. */ public boolean deleteMarkerDir(HoodieEngineContext context, int parallelism) { return FSUtils.deleteDir(context, fs, markerDirPath, parallelism); } /*...
3.26
hudi_HoodieBackedTableMetadataWriter_updateFromWriteStatuses_rdh
/** * Update from {@code HoodieCommitMetadata}. * * @param commitMetadata * {@code HoodieCommitMetadata} * @param instantTime * Timestamp at which the commit was performed */ @Override public void updateFromWriteStatuses(HoodieCommitMetadata commitMetadata, HoodieData<WriteStatus> writeStatus, String instant...
3.26
hudi_HoodieBackedTableMetadataWriter_prepRecords_rdh
/** * Tag each record with the location in the given partition. * The record is tagged with respective file slice's location based on its record key. */ protected HoodieData<HoodieRecord> prepRecords(Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionRecordsMap) { // The result set HoodieData<Hoo...
3.26
hudi_HoodieBackedTableMetadataWriter_m3_rdh
/** * Validates the timeline for both main and metadata tables to ensure compaction on MDT can be scheduled. */ protected boolean m3(Option<String> inFlightInstantTimestamp, String latestDeltaCommitTimeInMetadataTable) { // we need to find if there are any inflights in data table timeline before or equal to the l...
3.26
hudi_HoodieBackedTableMetadataWriter_compactIfNecessary_rdh
/** * Perform a compaction on the Metadata Table. * <p> * Cases to be handled: * 1. We cannot perform compaction if there are previous inflight operations on the dataset. This is because * a compacted metadata base file at time Tx should represent all the actions on the dataset till time Tx. * <p> * 2. In multi-...
3.26
hudi_HoodieBackedTableMetadataWriter_isBootstrapNeeded_rdh
/** * Whether initialize operation needed for this metadata table. * <p> * Rollback of the first commit would look like un-synced instants in the metadata table. * Action metadata is needed to verify the instant time and avoid erroneous initializing. * <p> * TODO: Revisit this logic and validate that filtering fo...
3.26
hudi_HoodieBackedTableMetadataWriter_update_rdh
/** * Update from {@code HoodieRollbackMetadata}. * * @param rollbackMetadata * {@code HoodieRollbackMetadata} * @param instantTime * Timestamp at which the rollback was performed */ @Override public void update(HoodieRollbackMetadata rollbackMetadata, String instantTime) { if (initialized && (f0 != nul...
3.26
hudi_HoodieBackedTableMetadataWriter_preWrite_rdh
/** * Allows the implementation to perform any pre-commit operations like transitioning a commit to inflight if required. * * @param instantTime * time of commit */ protected void preWrite(String instantTime) { // Default is No-Op }
3.26
hudi_HoodieBackedTableMetadataWriter_enablePartitions_rdh
/** * Enable metadata table partitions based on config. */ private void enablePartitions() { final HoodieMetadataConfig v0 = dataWriteConfig.getMetadataConfig(); if (dataWriteConfig.isMetadataTableEnabled() || f1.getTableC...
3.26
hudi_HoodieBackedTableMetadataWriter_updateFunctionalIndexIfPresent_rdh
/** * Update functional index from {@link HoodieCommitMetadata}. */ private void updateFunctionalIndexIfPresent(HoodieCommitMetadata commitMetadata, String instantTime, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap) { f1.getTableConfig().getMetadataPartitions()....
3.26
hudi_HoodieBackedTableMetadataWriter_m2_rdh
/** * Update from {@code HoodieRestoreMetadata}. * * @param restoreMetadata * {@code HoodieRestoreMetadata} * @param instantTime * Timestamp at which the restore was performed */ @Override public void m2(HoodieRestoreMetadata restoreMetadata, String instantTime) { f1.reloadActiveTimeline(); // Fetch ...
3.26
hudi_HoodieBackedTableMetadataWriter_initializeFromFilesystem_rdh
/** * Initialize the Metadata Table by listing files and partitions from the file system. * * @param initializationTime * - Timestamp to use for the commit * @param partitionsToInit * - List of MDT partitions to initialize * @param inflightInstantTimestamp * - Current action instant responsible for this i...
3.26
hudi_HoodieBackedTableMetadataWriter_listAllPartitionsFromMDT_rdh
/** * Function to find hoodie partitions and list files in them in parallel from MDT. * * @param initializationTime * Files which have a timestamp after this are neglected * @return List consisting of {@code DirectoryInfo} for each partition found. */ private List<DirectoryInfo> listAllPartitionsFromMDT(String ...
3.26
hudi_HoodieBackedTableMetadataWriter_processAndCommit_rdh
/** * Processes commit metadata from data table and commits to metadata table. * * @param instantTime * instant time of interest. * @param convertMetadataFunction * converter function to convert the respective metadata to List of HoodieRecords to be written to metadata table. */ private void processAndCommit...
3.26
hudi_HoodieBackedTableMetadataWriter_generateUniqueCommitInstantTime_rdh
/** * Returns a unique timestamp to use for initializing a MDT partition. * <p> * Since commits are immutable, we should use unique timestamps to initialize each partition. For this, we will add a suffix to the given initializationTime * until we find a unique timestamp. * * @param initializationTime * Timesta...
3.26
hudi_HoodieBackedTableMetadataWriter_m0_rdh
/** * Initialize the metadata table if needed. * * @param dataMetaClient * - meta client for the data table * @param inflightInstantTimestamp * - timestamp of an instant in progress on the dataset * @throws IOException * on errors */ protected boolean m0(HoodieTableMetaClient dataMetaClient, Option<Strin...
3.26
hudi_HoodieBackedTableMetadataWriter_getFileNameToSizeMap_rdh
// Returns a map of filenames mapped to their lengths Map<String, Long> getFileNameToSizeMap() { return filenameToSizeMap; }
3.26
hudi_HoodieBackedTableMetadataWriter_getFunctionalIndexUpdates_rdh
/** * Loads the file slices touched by the commit due to given instant time and returns the records for the functional index. * * @param commitMetadata * {@code HoodieCommitMetadata} * @param indexPartition * partition name of the functional index * @param instantTime * timestamp at of the current update ...
3.26
hudi_HoodieBackedTableMetadataWriter_deletePendingIndexingInstant_rdh
/** * Deletes any pending indexing instant, if it exists. * It reads the plan from indexing.requested file and deletes both requested and inflight instants, * if the partition path in the plan matches with the given partition path. */ private static void deletePendingIndexingInstant(HoodieTableMetaClient metaClient...
3.26
hudi_HoodieBackedTableMetadataWriter_listAllPartitionsFromFilesystem_rdh
/** * Function to find hoodie partitions and list files in them in parallel. * * @param initializationTime * Files which have a timestamp after this are neglected * @return List consisting of {@code DirectoryInfo} for each partition found. */ private List<DirectoryInfo> listAllPartitionsFromFilesystem(String in...
3.26
hudi_HoodieBackedTableMetadataWriter_getRecordIndexUpdates_rdh
/** * Return records that represent update to the record index due to write operation on the dataset. * * @param writeStatuses * {@code WriteStatus} from the write operation */ private HoodieData<HoodieRecord> getRecordIndexUpdates(HoodieData<WriteStatus> writeStatuses) { HoodiePairData<String, HoodieRecordD...
3.26
hudi_HoodieBackedTableMetadataWriter_performTableServices_rdh
/** * Optimize the metadata table by running compaction, clean and archive as required. * <p> * Don't perform optimization if there are inflight operations on the dataset. This is for two reasons: * - The compaction will contain the correct data as all failed operations have been rolled back. * - Clean/compaction ...
3.26
hudi_HoodieBackedTableMetadataWriter_initializeFileGroups_rdh
/** * Initialize file groups for a partition. For file listing, we just have one file group. * <p> * All FileGroups for a given metadata partition has a fixed prefix as per the {@link MetadataPartitionType#getFileIdPrefix()}. * Each file group is suffixed with 4 digits with i...
3.26
hudi_CleanerUtils_rollbackFailedWrites_rdh
/** * Execute {@link HoodieFailedWritesCleaningPolicy} to rollback failed writes for different actions. * * @param cleaningPolicy * @param actionType * @param rollbackFailedWritesFunc */ public static void rollbackFailedWrites(HoodieFailedWritesCleaningPolicy cleaningPolicy, String actionType, Functions.Function0...
3.26
hudi_CleanerUtils_getCleanerMetadata_rdh
/** * Get Latest Version of Hoodie Cleaner Metadata - Output of cleaner operation. * * @return Latest version of Clean metadata corresponding to clean instant * @throws IOException */ public static HoodieCleanMetadata getCleanerMetadata(HoodieTableMetaClient metaClient, byte[] details) throws IOException { Cle...
3.26
hudi_CleanerUtils_convertToHoodieCleanFileInfoList_rdh
/** * Convert list of cleanFileInfo instances to list of avro-generated HoodieCleanFileInfo instances. * * @param cleanFileInfoList * @return */ public static List<HoodieCleanFileInfo> convertToHoodieCleanFileInfoList(List<CleanFileInfo> cleanFileInfoList) { return cleanFileInfoList.stream().map(CleanFileInfo...
3.26
hudi_CleanerUtils_getCleanerPlan_rdh
/** * Get Latest version of cleaner plan corresponding to a clean instant. * * @param metaClient * Hoodie Table Meta Client * @return Cleaner plan corresponding to clean instant * @throws IOException */ public static HoodieCleanerPlan getCleanerPlan(HoodieTableMetaClient metaClient, byte[] details) throws IOE...
3.26
hudi_ActiveAction_getPendingAction_rdh
/** * A COMPACTION action eventually becomes COMMIT when completed. */ public String getPendingAction() { return getPendingInstant().getAction(); }
3.26
hudi_HoodieCreateHandle_close_rdh
/** * Performs actions to durably, persist the current changes and returns a WriteStatus object. */ @Override public List<WriteStatus> close() { LOG.info((("Closing the file " + writeStatus.getFileId()) + " as we are done with all the records ") + recordsWritten); try { ...
3.26
hudi_HoodieCreateHandle_setupWriteStatus_rdh
/** * Set up the write status. * * @throws IOException * if error occurs */ protected void setupWriteStatus() throws IOException { HoodieWriteStat stat = writeStatus.getStat(); stat.setPartitionPath(writeStatus.getPartitionPath()); stat.setNumWrites(recordsWritten); stat.setNumDel...
3.26
hudi_HoodieCreateHandle_doWrite_rdh
/** * Perform the actual writing of the given record into the backing file. */ @Override protected void doWrite(HoodieRecord record, Schema schema, TypedProperties props) { Option<Map<String, String>> recordMetadata = record.getMetadata(); try { if ((!HoodieOperation.isDelete(record.getOperation())...
3.26
hudi_HoodieCreateHandle_write_rdh
/** * Writes all records passed. */ public void write() { Iterator<String> keyIterator; if (hoodieTable.requireSortedRecords()) { // Sorting the keys limits the amount of extra memory required for writing sorted records keyIterator = recordMap.keySet().stream().sorted().iterator(); } else ...
3.26
hudi_DeletePartitionUtils_m0_rdh
/** * Check if there are any pending table service actions (requested + inflight) on a table affecting the partitions to * be dropped. * <p> * This check is to prevent a drop-partition from proceeding should a partition have a table service action in * the pending stage. If this is allowed to happen, the filegroup...
3.26
hudi_ViewStorageProperties_createProperties_rdh
/** * Initialize the {@link #FILE_NAME} meta file. */ public static void createProperties(String basePath, FileSystemViewStorageConfig config, Configuration flinkConf) throws IOException { Path propertyPath = getPropertiesFilePath(basePath, flinkConf.getString(FlinkOptions.WRITE_CLIENT_ID)); ...
3.26
hudi_ViewStorageProperties_loadFromProperties_rdh
/** * Read the {@link FileSystemViewStorageConfig} with given table base path. */ public static FileSystemViewStorageConfig loadFromProperties(String basePath, Configuration conf) { Path propertyPath = getPropertiesFilePath(basePath, conf.getString(FlinkOptions.WRITE_CLIENT_ID)); LOG.info("Loading filesyst...
3.26
hudi_ExecutionStrategyUtil_transform_rdh
/** * Transform IndexedRecord into HoodieRecord. * * @param indexedRecord * indexedRecord. * @param writeConfig * writeConfig. * @return hoodieRecord. * @param <T> */ public static <T> HoodieRecord<T> transform(IndexedRecord indexedRecord, HoodieWriteConfig writeConfig) { GenericRecord record = ((Gen...
3.26
hudi_CommitUtils_getCommitActionType_rdh
/** * Gets the commit action type for given table type. * Note: Use this API only when the commit action type is not dependent on the write operation type. * See {@link CommitUtils#getCommitActionType(WriteOperationType, HoodieTableType)} for more details. */ public static String getCommitActionType(HoodieTableType...
3.26
hudi_CommitUtils_getValidCheckpointForCurrentWriter_rdh
/** * Process previous commits metadata in the timeline to determine the checkpoint given a checkpoint key. * NOTE: This is very similar in intent to DeltaSync#getLatestCommitMetadataWithValidCheckpointInfo except that * different deployment models (deltastreamer or spark structured streaming) could have different c...
3.26