name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_CleanPlanner_getFilesToCleanKeepingLatestVersions_rdh
/** * Selects the older versions of files for cleaning, such that it bounds the number of versions of each file. This * policy is useful, if you are simply interested in querying the table, and you don't want too many versions for a * single file (i.e., run it with versionsRetained = 1) */ private Pair<Boolean, Lis...
3.26
hudi_CleanPlanner_getLastCompletedCommitTimestamp_rdh
/** * Returns the last completed commit timestamp before clean. */ public String getLastCompletedCommitTimestamp() { if (commitTimeline.lastInstant().isPresent()) { return commitTimeline.lastInstant().get().getTimestamp(); } else { return ""; } }
3.26
hudi_CleanPlanner_m0_rdh
/** * Gets the latest version < instantTime. This version file could still be used by queries. */ private String m0(List<FileSlice> fileSliceList, HoodieInstant instantTime) { for (FileSlice file : fileSliceList) { String fileCommitTime = file.getBaseInstantTime(); if (HoodieTimeline.compareTimest...
3.26
hudi_CleanPlanner_getPartitionPathsForFullCleaning_rdh
/** * Scan and list all partitions for cleaning. * * @return all partitions paths for the dataset. */ private List<String> getPartitionPathsForFullCleaning() { // Go to brute force mode of scanning all partitions return FSUtils.getAllPartitionPaths(context, config.getMetadataConfig(), config.getBasePath());...
3.26
hudi_CleanPlanner_isFileSliceNeededForPendingLogCompaction_rdh
/** * Determine if file slice needed to be preserved for pending logcompaction. * * @param fileSlice * File Slice * @return true if file slice needs to be preserved, false otherwise. */ private boolean isFileSliceNeededForPendingLogCompaction(FileSlice fileSlice) { CompactionOperation op = fgIdToPendingLogC...
3.26
hudi_CleanPlanner_getFilesToCleanKeepingLatestHours_rdh
/** * This method finds the files to be cleaned based on the number of hours. If {@code config.getCleanerHoursRetained()} is set to 5, * all the files with commit time earlier than 5 hours will be removed. Also the latest file for any file group is retained. * This policy gives much more flexibility to users for ret...
3.26
hudi_CleanPlanner_isFileSliceNeededForPendingMajorOrMinorCompaction_rdh
/* Determine if file slice needed to be preserved for pending compaction or log compaction. @param fileSlice File slice @return true if file slice needs to be preserved, false otherwise. */ private boolean isFileSliceNeededForPendingMajorOrMinorCompaction(FileSlice fileSlice) { return isFileSliceNeededForPendingCo...
3.26
hudi_CleanPlanner_getPartitionPathsForCleanByCommits_rdh
/** * Return partition paths for cleaning by commits mode. * * @param instantToRetain * Earliest Instant to retain * @return list of partitions * @throws IOException */ private List<String> getPartitionPathsForCleanByCommits(Option<HoodieInstant> instantToRetain) throws IOException { if (!instantToRetain.i...
3.26
hudi_CleanPlanner_getPartitionPathsForIncrementalCleaning_rdh
/** * Use Incremental Mode for finding partition paths. * * @param cleanMetadata * @param newInstantToRetain * @return */ private List<String> getPartitionPathsForIncrementalCleaning(HoodieCleanMetadata cleanMetadata, Option<HoodieInstant> newInstantToRetain) { LOG.info(((("Incremental Cleaning mode is enab...
3.26
hudi_CleanPlanner_getPartitionPathsToClean_rdh
/** * Returns list of partitions where clean operations needs to be performed. * * @param earliestRetainedInstant * New instant to be retained after this cleanup operation * @return list of partitions to scan for cleaning * @throws IOException * when underlying file-system throws this exception */ public Li...
3.26
hudi_CleanPlanner_isFileSliceExistInSavepointedFiles_rdh
/** * Verify whether file slice exists in savepointedFiles, check both base file and log files */ private boolean isFileSliceExistInSavepointedFiles(FileSlice fs, List<String> savepointedFiles) { if (fs.getBaseFile().isPresent() && savepointedFiles.contains(fs.getBaseFile().get().getFileName())) {return true; ...
3.26
hudi_CleanPlanner_hasPendingFiles_rdh
/** * Returns whether there are uncommitted data files under the given partition, * the pending files are generated by the inflight instants and maybe ready to commit, * the partition can not be deleted as a whole if any pending file exists. * * <p>IMPORTANT: {@code fsView.getAllFileGroups} does not return pending...
3.26
hudi_CleanPlanner_getDeletePaths_rdh
/** * Returns files to be cleaned for the given partitionPath based on cleaning policy. */ public Pair<Boolean, List<CleanFileInfo>> getDeletePaths(String partitionPath, Option<HoodieInstant> earliestCommitToRetain) { HoodieCleaningPolicy policy = config.getCleanerPolicy(); Pair<Boolean, List<CleanFileInfo>...
3.26
hudi_HeartbeatUtils_deleteHeartbeatFile_rdh
/** * Deletes the heartbeat file for the specified instant. * * @param fs * Hadoop FileSystem instance * @param basePath * Hoodie table base path * @param instantTime * Commit instant time * @param config * HoodieWriteConfig instance * @return Boolean indicating whether heartbeat file was deleted or ...
3.26
hudi_HeartbeatUtils_abortIfHeartbeatExpired_rdh
/** * Check if the heartbeat corresponding to instantTime has expired. If yes, abort by throwing an exception. * * @param instantTime * @param table * @param heartbeatClient * @param config */ public static void abortIfHeartbeatExpired(String instantTime, HoodieTable table, HoodieHeartbeatClient heartbeatClient,...
3.26
hudi_MetadataMigrator_migrateToVersion_rdh
/** * Migrate metadata to a specific version. * * @param metadata * Hoodie Table Meta Client * @param metadataVersion * Metadata Version * @param targetVersion * Target Version * @return Metadata conforming to the target version */ public T migrateToVersion(T metadata, int metadataVersion, int targetVer...
3.26
hudi_MetadataMigrator_upgradeToLatest_rdh
/** * Upgrade Metadata version to its latest. * * @param metadata * Metadata * @param metadataVersion * Current version of metadata * @return Metadata conforming to the latest version of this metadata */ public T upgradeToLatest(T metadata, int metadataVersion) { if (metadataVersion == latestVersion) ...
3.26
hudi_CsvDFSSource_fromFiles_rdh
/** * Reads the CSV files and parsed the lines into {@link Dataset} of {@link Row}. * * @param pathStr * The list of file paths, separated by ','. * @return {@link Dataset} of {@link Row} containing the records. */ private Option<Dataset<Row>> fromFiles(Option<String> pathStr) { if (pathStr.isPresent()) { ...
3.26
hudi_HoodieCombineHiveInputFormat_getPaths_rdh
/** * Returns all the Paths in the split. */ @Override public Path[] getPaths() { return inputSplitShim.getPaths(); }
3.26
hudi_HoodieCombineHiveInputFormat_getPath_rdh
/** * Returns the i<sup>th</sup> Path. */ @Override public Path getPath(int i) { return inputSplitShim.getPath(i); }
3.26
hudi_HoodieCombineHiveInputFormat_getLengths_rdh
/** * Returns an array containing the lengths of the files in the split. */ @Override public long[] getLengths() {return inputSplitShim.getLengths(); }
3.26
hudi_HoodieCombineHiveInputFormat_sampleSplits_rdh
/** * This function is used to sample inputs for clauses like "TABLESAMPLE(1 PERCENT)" * <p> * First, splits are grouped by alias they are for. If one split serves more than one alias or not for any sampled * alias, we just directly add it to returned list. Then we find a list of exclusive splits for every alias to...
3.26
hudi_HoodieCombineHiveInputFormat_getInputPaths_rdh
/** * MOD - Just added this for visibility. */ Path[] getInputPaths(JobConf job) throws IOException { Path[] dirs = FileInputFormat.getInputPaths(job); if (dirs.length == 0) { // on tez we're avoiding to duplicate the file info in FileInputFormat. if (HiveConf.getVar(job, ConfVars.HIVE...
3.26
hudi_HoodieCombineHiveInputFormat_readFields_rdh
/** * Writable interface. */ @Override public void readFields(DataInput in) throws IOException { inputFormatClassName = Text.readString(in); if (HoodieParquetRealtimeInputFormat.class.getName().equals(inputFormatClassName)) {String inputShimClassName = Text.readString(in); inputSplitShim = ReflectionUtils.loadClass(i...
3.26
hudi_HoodieCombineHiveInputFormat_getNumPaths_rdh
/** * Returns the number of Paths in the split. */ @Override public int getNumPaths() { return inputSplitShim.getNumPaths(); }
3.26
hudi_HoodieCombineHiveInputFormat_accept_rdh
// returns true if the specified path matches the prefix stored // in this TestFilter. @Override public boolean accept(Path path) { boolean find = false; while (path != null) { if (pStrings.contains(path.toUri().getPath())) { find = true; break; } path = path.getParent(); } return find; }
3.26
hudi_HoodieCombineHiveInputFormat_getRecordReader_rdh
/** * Create a generic Hive RecordReader than can iterate over all chunks in a CombinedFileSplit. */ @Override public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { if (!(split instanceof HoodieCombineHiveInputFormat.CombineHiveInputSplit)) { return sup...
3.26
hudi_HoodieCombineHiveInputFormat_getStartOffsets_rdh
/** * Returns an array containing the startoffsets of the files in the split. */ @Override public long[] getStartOffsets() { return inputSplitShim.getStartOffsets(); }
3.26
hudi_HoodieCombineHiveInputFormat_getLocations_rdh
/** * Returns all the Paths where this input-split resides. */ @Override public String[] getLocations() throws IOException { return inputSplitShim.getLocations(); }
3.26
hudi_HoodieCombineHiveInputFormat_inputFormatClassName_rdh
/** * Returns the inputFormat class name for the i-th chunk. */ public String inputFormatClassName() { return inputFormatClassName; }
3.26
hudi_HoodieCombineHiveInputFormat_getSplits_rdh
/** * Create Hive splits based on CombineFileSplit. */ @Override public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { PerfLogger perfLogger = SessionState.getPerfLogger(); perfLogger.PerfLogBegin(CLASS_NAME, PerfLogger.GET_SPLITS); init(job); List<InputSplit> result = new Ar...
3.26
hudi_HoodieCombineHiveInputFormat_getOffset_rdh
/** * Returns the start offset of the i<sup>th</sup> Path. */ @Override public long getOffset(int i) { return inputSplitShim.getOffset(i); }
3.26
hudi_HoodieCombineHiveInputFormat_toString_rdh
/** * Prints this object as a string. */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(inputSplitShim.toString()); sb.append("InputFormatClass: " + inputFormatClassName); sb.append("\n"); return sb.toString(); }
3.26
hudi_HoodieCombineHiveInputFormat_getLength_rdh
/** * Returns the length of the i<sup>th</sup> Path. */ @Override public long getLength(int i) { return inputSplitShim.getLength(i); }
3.26
hudi_HoodieCombineHiveInputFormat_getCombineSplits_rdh
/** * Create Hive splits based on CombineFileSplit. */ private InputSplit[] getCombineSplits(JobConf job, int numSplits, Map<Path, PartitionDesc> pathToPartitionInfo) throws IOException { init(job); Map<Path, ArrayList<String>> v0 = mrwork.getPathToAliases(); Map<String, Operat...
3.26
hudi_HoodieCombineHiveInputFormat_write_rdh
/** * Writable interface. */ @Override public void write(DataOutput out) throws IOException { if (inputFormatClassName == null) { if (pathToPartitionInfo == null) { pathToPartitionInfo = Utilities.getMapWork(getJob()).getPathToPartitionInfo(); } // extract all the inputFormatClass names for each chunk in the // Combi...
3.26
hudi_HoodieCombineHiveInputFormat_getNonCombinablePathIndices_rdh
/** * Gets all the path indices that should not be combined. */ public Set<Integer> getNonCombinablePathIndices(JobConf job, Path[] paths, int numThreads) throws ExecutionException, InterruptedException { LOG.info(((("Total number of paths: " + paths.length) + ", launching ") + numThreads) + " threads to check n...
3.26
hudi_CatalogOptions_allOptions_rdh
/** * Returns all the config options. */ public static List<ConfigOption<?>> allOptions() { return OptionsResolver.allOptions(CatalogOptions.class); }
3.26
hudi_CatalogOptions_tableCommonOptions_rdh
/** * Returns all the common table options that can be shared. * * @param catalogOptions * The catalog options */ public static Map<String, String> tableCommonOptions(Configuration catalogOptions) { Configuration copied = new Configuration(catalogOptions); copied.removeConfig(DEFAULT_DATABASE); c...
3.26
hudi_WaitStrategyFactory_build_rdh
/** * Build WaitStrategy for disruptor */ public static WaitStrategy build(String name) {DisruptorWaitStrategyType strategyType = DisruptorWaitStrategyType.valueOf(name); switch (strategyType) { case BLOCKING_WAIT : return new BlockingWaitStrategy(); cas...
3.26
hudi_HoodieSparkTable_getMetadataWriter_rdh
/** * Fetch instance of {@link HoodieTableMetadataWriter}. * * @return instance of {@link HoodieTableMetadataWriter} */ @Override protected Option<HoodieTableMetadataWriter> getMetadataWriter(String triggeringInstantTimestamp, HoodieFailedWritesCleaningPolicy failedWritesCleaningPolicy) { if (config.isMetadataTable...
3.26
hudi_HashID_byteSize_rdh
/** * Get this Hash size in bytes. * * @return Bytes needed to represent this size */ public int byteSize() { return ((this.bits - 1) / Byte.SIZE) + 1; }
3.26
hudi_HashID_bits_rdh
/** * Get this Hash size in bits. * * @return bits needed to represent the size */ public int bits() {return this.bits; }
3.26
hudi_HashID_hash_rdh
/** * Get the hash value for a byte array and for the desired @{@link Size}. * * @param messageBytes * - Byte array message to get the hash value for * @param bits * - @{@link Size} of the hash value * @return Hash value for the message as byte array */ public static byte[] hash(final byte[] messageBytes, f...
3.26
hudi_TerminationStrategyUtils_createPostWriteTerminationStrategy_rdh
/** * Create a PostWriteTerminationStrategy class via reflection, * <br> * if the class name of PostWriteTerminationStrategy is configured through the {@link HoodieStreamer.Config#postWriteTerminationStrategyClass}. */ public static Option<PostWriteTerminationStrategy> createPostWriteTerminationStrategy(TypedProper...
3.26
hudi_HoodieIndexUtils_tagAsNewRecordIfNeeded_rdh
/** * Get tagged record for the passed in {@link HoodieRecord}. * * @param record * instance of {@link HoodieRecord} for which tagging is requested * @param location * {@link HoodieRecordLocation} for the passed in {@link HoodieRecord} * @return the tagged {@link HoodieRecord} */public static <R> HoodieReco...
3.26
hudi_HoodieIndexUtils_mergeIncomingWithExistingRecord_rdh
/** * Merge the incoming record with the matching existing record loaded via {@link HoodieMergedReadHandle}. The existing record is the latest version in the table. */ private static <R> Option<HoodieRecord<R>> mergeIncomingWithExistingRecord(HoodieRecord<R> incoming, HoodieRecord<R> existing, Schema writeSchema, Hoo...
3.26
hudi_HoodieIndexUtils_mergeForPartitionUpdatesIfNeeded_rdh
/** * Merge tagged incoming records with existing records in case of partition path updated. */ public static <R> HoodieData<HoodieRecord<R>> mergeForPartitionUpdatesIfNeeded(HoodieData<Pair<HoodieRecord<R>, Option<HoodieRecordGlobalLocation>>> incomingRecordsAndLocations, HoodieWriteConfig config, HoodieTable hoodie...
3.26
hudi_HoodieIndexUtils_tagRecord_rdh
/** * Tag the record to an existing location. Not creating any new instance. */ public static <R> HoodieRecord<R> tagRecord(HoodieRecord<R> record, HoodieRecordLocation location) { record.unseal(); record.setCurrentLocation(location); record.seal(); return record; }
3.26
hudi_HoodieIndexUtils_checkIfValidCommit_rdh
/** * Check if the given commit timestamp is valid for the timeline. * * The commit timestamp is considered to be valid if: * 1. the commit timestamp is present in the timeline, or * 2. the commit timestamp is less than the first commit timestamp in the timeline * * @param commitTimeline * The timeline *...
3.26
hudi_HoodieIndexUtils_getLatestBaseFilesForPartition_rdh
/** * Fetches Pair of partition path and {@link HoodieBaseFile}s for interested partitions. * * @param partition * Partition of interest * @param hoodieTable * Instance of {@link HoodieTable} of interest * @return the list of {@link HoodieBaseFile} */ public static Li...
3.26
hudi_HoodieIndexUtils_getLatestBaseFilesForAllPartitions_rdh
/** * Fetches Pair of partition path and {@link HoodieBaseFile}s for interested partitions. * * @param partitions * list of partitions of interest * @param context * instance of {@link HoodieEngineContext} to use * @param hoodieTable * instance of {@link HoodieTable} of interest * @return the list of Pai...
3.26
hudi_HoodieIndexUtils_getLatestFileSlicesForPartition_rdh
/** * Fetches Pair of partition path and {@link FileSlice}s for interested partitions. * * @param partition * Partition of interest * @param hoodieTable * Instance of {@link HoodieTable} of interest * @return the list of {@link FileSlice} */ public static List<FileSlice> getLatestFileSlicesForPartition(fina...
3.26
hudi_InternalSchemaUtils_collectTypeChangedCols_rdh
/** * Collect all type changed cols to build a colPosition -> (newColType, oldColType) map. * only collect top level col changed. eg: a is a nest field(record(b int, d long), now a.b is changed from int to long, * only a will be collected, a.b will excluded. * * @param schema * a type changed internalSchema * ...
3.26
hudi_InternalSchemaUtils_pruneInternalSchemaByID_rdh
/** * Create project internalSchema. * support nested project. * * @param schema * a internal schema. * @param fieldIds * project col field_ids. * @return a project internalSchema. */ public static InternalSchema pruneInternalSchemaByID(InternalSchema schema, List<Integer> fieldIds, List<Integer> topPar...
3.26
hudi_InternalSchemaUtils_reBuildFilterName_rdh
/** * A helper function to help correct the colName of pushed filters. * * @param name * origin col name from pushed filters. * @param fileSchema * the real schema of avro/parquet file. * @param querySchema * the query schema which query engine produced. * @return a corrected name. */ public static Stri...
3.26
hudi_InternalSchemaUtils_m0_rdh
/** * Project hudi type by projected cols field_ids * this is auxiliary function used by pruneInternalSchema. */ private static Type m0(Type type, List<Integer> fieldIds) { switch (type.typeId()) { case RECORD : Types.RecordType record = ((Types.RecordType) (type)); List<Types.Field> fields = re...
3.26
hudi_InternalSchemaUtils_pruneInternalSchema_rdh
/** * Create project internalSchema, based on the project names which produced by query engine. * support nested project. * * @param schema * a internal schema. * @param names * project names produced by query engine. * @return a project internalSchema. */ public...
3.26
hudi_InternalSchemaUtils_searchSchema_rdh
/** * Search target internalSchema by version number. * * @param versionId * the internalSchema version to be search. * @param treeMap * internalSchemas collections to be searched. * @return a internalSchema. */ public static InternalSchema searchSchema(long versionId, TreeMap<Long, InternalSchema> treeMap)...
3.26
hudi_InternalSchemaUtils_collectRenameCols_rdh
/** * Try to find all renamed cols between oldSchema and newSchema. * * @param oldSchema * oldSchema * @param newSchema * newSchema which modified from oldSchema * @return renameCols Map. (k, v) -> (colNameFromNewSchema, colNameLastPartFromOldSchema) */ public static Map<String, String> collectRenameCols(I...
3.26
hudi_SchemaRegistryProvider_fetchSchemaFromRegistry_rdh
/** * The method takes the provided url {@code registryUrl} and gets the schema from the schema registry using that url. * If the caller provides userInfo credentials in the url (e.g "https://foo:bar@schemaregistry.org") then the credentials * are extracted the url using the Matcher and the extracted credentials are...
3.26
hudi_HoodieAvroFileReaderBase_getRecordIterator_rdh
/** * Base class for every {@link HoodieAvroFileReader} */abstract class HoodieAvroFileReaderBase implements HoodieAvroFileReader { @Override public ClosableIterator<HoodieRecord<IndexedRecord>> getRecordIterator(Schema readerSchema, Schema requestedSchema) throws IOException {ClosableIterator<IndexedRecord> iterator...
3.26
hudi_HoodieAvroDataBlock_getBlock_rdh
/** * This method is retained to provide backwards compatibility to HoodieArchivedLogs which were written using * HoodieLogFormat V1. */ @Deprecated public static HoodieAvroDataBlock getBlock(byte[] content, Schema readerSchema, InternalSchema internalSchema) throws IOException { SizeAwareDataInputStream dis = n...
3.26
hudi_HoodieAvroDataBlock_deserializeRecords_rdh
// TODO (na) - Break down content into smaller chunks of byte [] to be GC as they are used @Override protected <T> ClosableIterator<HoodieRecord<T>> deserializeRecords(byte[] content, HoodieRecordType type) throws IOException { checkState(this.readerSchema != null, "Reader's schema has to be non-null"); checkAr...
3.26
hudi_FileSlice_getLatestInstantTime_rdh
/** * Returns the latest instant time of the file slice. */ public String getLatestInstantTime() { Option<String> latestDeltaCommitTime = getLatestLogFile().map(HoodieLogFile::getDeltaCommitTime);return latestDeltaCommitTime.isPresent() ? HoodieTimeline.maxInstant(latestDeltaCommitTime.get(), getBaseInstantTime()...
3.26
hudi_FileSlice_isEmpty_rdh
/** * Returns true if there is no data file and no log files. Happens as part of pending compaction. */ public boolean isEmpty() { return (baseFile == null) && logFiles.isEmpty(); }
3.26
hudi_ArrayUtils_toPrimitive_rdh
// Long array converters // ---------------------------------------------------------------------- /** * <p>Converts an array of object Longs to primitives.</p> * * <p>This method returns {@code null} for a {@code null} input array.</p> * * @param array * a {@code Long} array...
3.26
hudi_HoodieOperation_isInsert_rdh
/** * Returns whether the operation is INSERT. */ public static boolean isInsert(HoodieOperation operation) { return operation == INSERT; }
3.26
hudi_HoodieOperation_isUpdateAfter_rdh
/** * Returns whether the operation is UPDATE_AFTER. */ public static boolean isUpdateAfter(HoodieOperation operation) { return operation == UPDATE_AFTER; }
3.26
hudi_HoodieOperation_isUpdateBefore_rdh
/** * Returns whether the operation is UPDATE_BEFORE. */ public static boolean isUpdateBefore(HoodieOperation operation) { return operation == UPDATE_BEFORE; }
3.26
hudi_HoodieOperation_isDelete_rdh
/** * Returns whether the operation is DELETE. */ public static boolean isDelete(HoodieOperation operation) {return operation == DELETE; }
3.26
hudi_HoodieReaderContext_updateSchemaAndResetOrderingValInMetadata_rdh
/** * Updates the schema and reset the ordering value in existing metadata mapping of a record. * * @param meta * Metadata in a mapping. * @param schema * New schema to set. * @return The input metadata mapping. */ public Map<String, Object> updateSchemaAndResetOrderingValInMetadata(Map<String, Object> met...
3.26
hudi_HoodieReaderContext_generateMetadataForRecord_rdh
/** * Generates metadata of the record. Only fetches record key that is necessary for merging. * * @param record * The record. * @param schema * The Avro schema of the record. * @return A mapping containing the metadata. */ public Map<String, Object> generateMetadataForRecord(T record, Schema schema) { ...
3.26
hudi_InternalSchemaChangeApplier_applyRenameChange_rdh
/** * Rename col name for hudi table. * * @param colName * col name to be renamed. if we want to rename col from a nested filed, the fullName should be specify * @param newName * new name for current col. no need to specify fullName. */ public InternalSchema applyRenameChange(String colName, String newName) ...
3.26
hudi_InternalSchemaChangeApplier_applyReOrderColPositionChange_rdh
/** * Reorder the position of col. * * @param colName * column which need to be reordered. if we want to change col from a nested filed, the fullName should be specify. * @param referColName * reference position. * @param positionType *...
3.26
hudi_InternalSchemaChangeApplier_applyColumnCommentChange_rdh
/** * Update col comment for hudi table. * * @param colName * col name to be changed. if we want to change col from a nested filed, the fullName should be specify * @param doc * . */ public InternalSchema applyColumnCommentChange(String colName, String doc) { TableChanges.ColumnUpdateChange updateChange...
3.26
hudi_InternalSchemaChangeApplier_applyColumnTypeChange_rdh
/** * Update col type for hudi table. * * @param colName * col name to be changed. if we want to change col from a nested filed, the fullName should be specify * @param newType * . */ public InternalSchema applyColumnTypeChange(String colName, Type newType) { TableChanges.ColumnUpdateChange updateChange...
3.26
hudi_InternalSchemaChangeApplier_applyDeleteChange_rdh
/** * Delete columns to table. * * @param colNames * col name to be deleted. if we want to delete col from a nested filed, the fullName should be specify */ public InternalSchema applyDeleteChange(String... colNames) { TableChanges.ColumnDeleteChange delete = TableChanges.ColumnDeleteChange.get(latestSchema)...
3.26
hudi_InternalSchemaChangeApplier_applyAddChange_rdh
/** * Add columns to table. * * @param colName * col name to be added. if we want to add col to a nested filed, the fullName should be specify * @param colType * col type to be added. * @param doc * col doc to be added. * @param position * col position to be added * @param positionType * col posit...
3.26
hudi_InternalSchemaChangeApplier_applyColumnNullabilityChange_rdh
/** * Update col nullability for hudi table. * * @param colName * col name to be changed. if we want to change col from a nested filed, the fullName should be specify * @param nullable * . */ public InternalSchema applyColumnNullabilityChange(String colName, boolean nullable) { TableChanges.ColumnUpdateC...
3.26
hudi_CopyOnWriteInputFormat_acceptFile_rdh
/** * A simple hook to filter files and directories from the input. * The method may be overridden. Hadoop's FileInputFormat has a similar mechanism and applies the * same filters by default. * * @param fileStatus * The file status to check. * @return true, if the given file or directory is accepted */ public...
3.26
hudi_CopyOnWriteInputFormat_addFilesInDir_rdh
/** * Enumerate all files in the directory and recursive if enumerateNestedFiles is true. * * @return the total length of accepted files. */ private long addFilesInDir(Path path, List<FileStatus> files, boolean logExcludedFiles) throws IOException { final Path hadoopPath = new Path(path.toUri()); final...
3.26
hudi_CopyOnWriteInputFormat_getBlockIndexForPosition_rdh
/** * Retrieves the index of the <tt>BlockLocation</tt> that contains the part of the file described by the given * offset. * * @param blocks * The different blocks of the file. Must be ordered by their offset. * @param offset * The offset of the position in the file. * @param startIndex * The earliest i...
3.26
hudi_ConsistentBucketIndexBulkInsertPartitionerWithRows_prepareRepartition_rdh
/** * Prepare consistent hashing metadata for repartition * * @param rows * input records */ private void prepareRepartition(JavaRDD<Row> rows) { this.partitionToIdentifier = initializeBucketIdentifier(rows); this.partitionToFileIdPfxIdxMap = ConsistentBucketIndexUtils.generatePartitionToFileIdPfxIdxMa...
3.26
hudi_JsonEncoder_configure_rdh
/** * Reconfigures this JsonEncoder to output to the JsonGenerator provided. * <p/> * If the JsonGenerator provided is null, a NullPointerException is thrown. * <p/> * Otherwise, this JsonEncoder will flush its current output and then * reconfigure its output to use the provided JsonGenerator. * * @param genera...
3.26
hudi_JsonEncoder_getJsonGenerator_rdh
// by default, one object per line. // with pretty option use default pretty printer with root line separator. private static JsonGenerator getJsonGenerator(OutputStream out, Set<JsonOptions> options) throws IOException { Objects.requireNonNull(out, "OutputStream cannot be null"); JsonGenerator g = n...
3.26
hudi_HoodieMetaserverBasedTimeline_getInstantFileName_rdh
/** * Completion time is essential for {@link HoodieActiveTimeline}, * TODO [HUDI-6883] We should change HoodieMetaserverBasedTimeline to store completion time as well. */ @Override protected String getInstantFileName(HoodieInstant instant) { if (instant.isCompleted()) { // Set a fake completion time. ...
3.26
hudi_HDFSParquetImporterUtils_load_rdh
/** * Imports records to Hoodie table. * * @param client * Hoodie Client * @param instantTime * Instant Time * @param hoodieRecords * Hoodie Records * @param <T> * Type ...
3.26
hudi_HDFSParquetImporterUtils_parseSchema_rdh
/** * Parse Schema from file. * * @param fs * File System * @param schemaFile * Schema File */ public static String parseSchema(FileSystem fs, String schemaFile) throws Exception { // Read schema file. Path p = new Path(schemaFile); if (!fs.exists(p)) { throw new Exception(String.format(...
3.26
hudi_HDFSParquetImporterUtils_createHoodieClient_rdh
/** * Build Hoodie write client. * * @param jsc * Java Spark Context * @param basePath * Base Path * @param schemaStr * Schema * @param parallelism * Parallelism */ public static SparkRDDWriteClient<HoodieRecordPayload> createHoodieClient(JavaSparkContext jsc, String basePath, String schemaStr, int p...
3.26
hudi_BufferedRandomAccessFile_spaceAvailableInBuffer_rdh
/** * * @return - whether space is available at the end of the buffer. */ private boolean spaceAvailableInBuffer() { return this.isEOF && (this.validLastPosition < this.endPosition()); }
3.26
hudi_BufferedRandomAccessFile_m1_rdh
/** * Given a byte array, offset in the array and length of bytes to be written, * update the buffer/file. * * @param b * - byte array of data to be written * @param off * - starting offset. * @param len * - length of bytes to be written * @return - number of bytes written * @throws IOException */ pri...
3.26
hudi_BufferedRandomAccessFile_alignDiskPositionToBufferStartIfNeeded_rdh
/** * If the diskPosition differs from the startPosition, flush the data in the buffer * and realign/fill the buffer at startPosition. * * @throws IOException */ private void alignDiskPositionToBufferStartIfNeeded() throws IOException { if (this.diskPosition != this.startPosition) { super.seek(this...
3.26
hudi_BufferedRandomAccessFile_loadNewBlockToBuffer_rdh
/** * Load a new data block. Returns false, when EOF is reached. * * @return - whether new data block was loaded or not * @throws IOException */ private boolean loadNewBlockToBuffer() throws IOException { if (this.isEOF) { return false; } // read next block into buffer this.seek(this.cur...
3.26
hudi_BufferedRandomAccessFile_flush_rdh
/** * If the file is writable, flush any bytes in the buffer that have not yet been written to disk. * * @throws IOException */ public void flush() throws IOException { this.flushBuffer(); }
3.26
hudi_BufferedRandomAccessFile_endOfBufferReached_rdh
/** * * @return whether currentPosition has reached the end of valid buffer. */ private boolean endOfBufferReached() { return this.currentPosition >= this.validLastPosition; }
3.26
hudi_BufferedRandomAccessFile_write_rdh
/** * Write specified number of bytes into buffer/file, with given starting offset and length. * * @param b * - byte array with data to be written * @param off * - starting offset. * @param len * - length of bytes to be written * @throws IOException */ @Override public void write(byte[] b, int off, int ...
3.26
hudi_BufferedRandomAccessFile_m0_rdh
/** * write an array of bytes to the buffer/file. * * @param b * - byte array with data to be written * @throws IOException */ @Override public void m0(byte[] b) throws IOException { this.write(b, 0, b.length); }
3.26
hudi_BufferedRandomAccessFile_expandBufferToCapacityIfNeeded_rdh
/** * If space is available at the end of the buffer, start using it. Otherwise, * flush the unwritten data into the file and load the buffer corresponding to startPosition. * * @throws IOException */ private void expandBufferToCapacityIfNeeded() throws IOException { if (spaceAvailableInBuffer()) { // space availa...
3.26
hudi_BufferedRandomAccessFile_close_rdh
/** * Close the file, after flushing data in the buffer. * * @throws IOException */ @Override public void close() throws IOException { if (!isClosed) { this.flush(); super.close(); this.isClosed = true; } }
3.26