name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_HoodieMergeHandle_init_rdh
/** * Load the new incoming records in a map and return partitionPath. */ protected void init(String fileId, Iterator<HoodieRecord<T>> newRecordsItr) { initializeIncomingRecordsMap(); while (newRecordsItr.hasNext()) { HoodieRecord<T> record = newRecordsItr.next(); // update the new location of...
3.26
hudi_HoodieMergeHandle_write_rdh
/** * Go through an old record. Here if we detect a newer version shows up, we write the new one to the file. */ public void write(HoodieRecord<T> oldRecord) { Schema oldSchema = (config.populateMetaFields()) ? writeSchemaWithMetaFields : writeSchema; Schema newSchema = (useWriterSchemaForCompaction) ? writeS...
3.26
hudi_HoodieMergeHandle_initializeIncomingRecordsMap_rdh
/** * Initialize a spillable map for incoming records. */ protected void initializeIncomingRecordsMap() { try { // Load the new records in a map long memoryForMerge = IOUtils.getMaxMemoryPerPartitionMerge(taskContextSupplier, config); LOG.info("MaxMemoryPerPartitionMerge => " + memoryForMe...
3.26
hudi_HoodieMergeHandle_needsUpdateLocation_rdh
/** * Whether there is need to update the record location. */ boolean needsUpdateLocation() { return true; }
3.26
hudi_HoodieGauge_getValue_rdh
/** * Returns the metric's current value. * * @return the metric's current value */@Override public T getValue() { return value; }
3.26
hudi_HoodieGauge_setValue_rdh
/** * Set the metric to a new value. */ public void setValue(T value) {this.value = value; }
3.26
hudi_BootstrapIndex_useIndex_rdh
/** * Returns true if valid metadata bootstrap is present. * * @return */ public final boolean useIndex() { if (isPresent()) { boolean validInstantTime = metaClient.getActiveTimeline().getCommitsTimeline().filterCompletedInstants().lastInstant().map(i -> HoodieTimeline.compar...
3.26
hudi_HoodieCDCLogger_getTransformer_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- private CDCTransformer getTransformer() { if (cdcSupplementalLoggingMode == DATA_BEFORE_AFTER) { return (operation, recordKey, oldRecord, new...
3.26
hudi_HoodieHeartbeatUtils_isHeartbeatExpired_rdh
/** * Whether a heartbeat is expired. * * @param instantTime * Instant time. * @param maxAllowableHeartbeatIntervalInMs * Heartbeat timeout in milliseconds. * @param fs * {@link FileSystem} instance. * @param basePath * Base path of the table. * @return {@code true} if expired; {@code false} otherwis...
3.26
hudi_HoodieHeartbeatUtils_getLastHeartbeatTime_rdh
/** * Use modification time as last heart beat time. * * @param fs * {@link FileSystem} instance. * @param basePath * Base path of the table. * @param instantTime * Instant time. * @return Last heartbeat timestamp. * @throws IOException */public static Long getLastHeartbeatTime(FileSystem fs, String ba...
3.26
hudi_DirectMarkerTransactionManager_createUpdatedLockProps_rdh
/** * Rebuilds lock related configs. Only support ZK related lock for now. * * @param writeConfig * Hudi write configs. * @param partitionPath * Relative partition path. * @param fileId * File ID. * @return Updated lock related configs. */ private static TypedProperties createUpdatedLockProps(HoodieWrit...
3.26
hudi_CompactionStrategy_captureMetrics_rdh
/** * Callback hook when a HoodieCompactionOperation is created. Individual strategies can capture the metrics they need * to decide on the priority. * * @param writeConfig * write configuration. * @param slice * fileSlice to capture metrics for. * @return Map[String, Object] - metrics captured */ public M...
3.26
hudi_CompactionStrategy_filterPartitionPaths_rdh
/** * Filter the partition paths based on compaction strategy. * * @param writeConfig * @param allPartitionPaths * @return */ public List<String> filterPartitionPaths(HoodieWriteConfig writeConfig, List<String> allPartitionPaths) { return allPartitionPaths; }
3.26
hudi_CompactionStrategy_orderAndFilter_rdh
/** * Order and Filter the list of compactions. Use the metrics captured with the captureMetrics to order and filter out * compactions * * @param writeConfig * config for this compaction is passed in * @param operations * list of compactions collected * @param pendingCompactionPlans * Pending Compaction ...
3.26
hudi_CompactionStrategy_generateCompactionPlan_rdh
/** * Generate Compaction plan. Allows clients to order and filter the list of compactions to be set. The default * implementation takes care of setting compactor Id from configuration allowing subclasses to only worry about * ordering and filtering compaction operations * * @param writeConfig * Hoodie Write Co...
3.26
hudi_FlinkMergeAndReplaceHandle_newFileNameWithRollover_rdh
/** * Use the writeToken + "-" + rollNumber as the new writeToken of a mini-batch write. */ protected String newFileNameWithRollover(int rollNumber) { return FSUtils.makeBaseFileName(instantTime, (writeToken + "-") + rollNumber, this.fileId, hoodieTable.getBaseFileExtension()); }
3.26
hudi_FlinkMergeAndReplaceHandle_deleteInvalidDataFile_rdh
/** * The flink checkpoints start in sequence and asynchronously, when one write task finish the checkpoint(A) * (thus the fs view got the written data files some of which may be invalid), * it goes on with the next round checkpoint(B) write immediately, * if it tries to reuse the last small dat...
3.26
hudi_FlinkInMemoryStateIndex_isGlobal_rdh
/** * Only looks up by recordKey. */ @Overridepublic boolean isGlobal() { return true; }
3.26
hudi_FlinkInMemoryStateIndex_isImplicitWithStorage_rdh
/** * Index needs to be explicitly updated after storage write. */ @Override public boolean isImplicitWithStorage() { return true;}
3.26
hudi_MetadataMessage_isNewFileCreation_rdh
/** * Returns true if message corresponds to new file creation, false if not. * Ref: https://cloud.google.com/storage/docs/pubsub-notifications#events */ private boolean isNewFileCreation() { return EVENT_NAME_OBJECT_FINALIZE.equals(getEventType()); }
3.26
hudi_MetadataMessage_isOverwriteOfExistingFile_rdh
/** * Whether message represents an overwrite of an existing file. * Ref: https://cloud.google.com/storage/docs/pubsub-notifications#replacing_objects */ private boolean isOverwriteOfExistingFile() { return !isNullOrEmpty(getOverwroteGeneration()); }
3.26
hudi_MetadataMessage_shouldBeProcessed_rdh
/** * Whether a message is valid to be ingested and stored by this Metadata puller. * Ref: https://cloud.google.com/storage/docs/pubsub-notifications#events */ public MessageValidity shouldBeProcessed() { if (!isNewFileCreation()) { return new MessageValidity(DO_SKIP, ("eventType: " + getEventType()) + "...
3.26
hudi_DayBasedCompactionStrategy_getPartitionPathWithoutPartitionKeys_rdh
/** * If is Hive style partition path, convert it to regular partition path. e.g. year=2019/month=11/day=24 => 2019/11/24 */ protected static String getPartitionPathWithoutPartitionKeys(String partitionPath) { if (partitionPath.contains("=")) { return partitionPath.replaceFirst(".*?=", "").replaceAll("/.*...
3.26
hudi_FlinkMergeHandle_deleteInvalidDataFile_rdh
/** * The flink checkpoints start in sequence and asynchronously, when one write task finish the checkpoint(A) * (thus the fs view got the written data files some of which may be invalid), * it goes on with the next round checkpoint(B) write immediately, * if it tries to reuse the last small data bucket(small file)...
3.26
hudi_FlinkMergeHandle_newFileNameWithRollover_rdh
/** * Use the writeToken + "-" + rollNumber as the new writeToken of a mini-batch write. */ protected String newFileNameWithRollover(int rollNumber) { return FSUtils.makeBaseFileName(instantTime, (writeToken + "-") + rollNumber, this.fileId, hoodieTable.getBaseFileExtension()); }
3.26
hudi_GcsObjectMetadataFetcher_applyFilter_rdh
/** * * @param cloudObjectMetadataDF * a Dataset that contains metadata of GCS objects. Assumed to be a persisted form * of a Cloud Storage Pubsub Notification event. * @return Dataset<Row> after apply the filtering. */ public Dataset<Row> applyFilter(Dataset<Row> cloudObjectMetadataDF) { String filter = ...
3.26
hudi_GcsObjectMetadataFetcher_createFilter_rdh
/** * Add optional filters that narrow down the list of GCS objects to fetch. */ private String createFilter() { StringBuilder filter = new StringBuilder("size > 0"); getPropVal(SELECT_RELATIVE_PATH_PREFIX).ifPresent(val -> filter.append((" and name like '" + val) + "%'")); getPropVal(IGNORE_RELATIVE_PATH_PRE...
3.26
hudi_GcsObjectMetadataFetcher_getGcsObjectMetadata_rdh
/** * * @param cloudObjectMetadataDF * a Dataset that contains metadata of GCS objects. Assumed to be a persisted form * of a Cloud Storage Pubsub Notification event. * @param checkIfExists * Check if each file exists, before returning its full path * @return A {@link List} of {@link CloudObjectMetadata} c...
3.26
hudi_SparkDataSourceContinuousIngestTool_readConfigFromFileSystem_rdh
/** * Reads config from the file system. * * @param jsc * {@link JavaSparkContext} instance. * @param cfg * {@link HoodieRepairTool.Config} instance. * @return the {@link TypedProperties} instance. */ private TypedProperties readConfigFromFileSystem(JavaSparkContext jsc, Config cfg) { return UtilHelpers...
3.26
hudi_DagScheduler_execute_rdh
/** * Method to start executing the nodes in workflow DAGs. * * @param service * ExecutorService * @param workflowDag * instance of workflow dag that needs to be executed * @throws Exception * will be thrown if ant error occurred */ private void execute(ExecutorService service, WorkflowDag workflowDag) t...
3.26
hudi_DagScheduler_executeNode_rdh
/** * Execute the given node. * * @param node * The node to be executed */ protected void executeNode(DagNode node, int curRound) { if (node.isCompleted()) { throw new RuntimeException("DagNode already completed! Cannot re-execute"); } try { int repeatCount = node.getConfig().getRep...
3.26
hudi_DagScheduler_schedule_rdh
/** * Method to start executing workflow DAGs. * * @throws Exception * Thrown if schedule failed. */ public void schedule() throws Exception { ExecutorService service = Executors.newFixedThreadPool(2); try { execute(service, workflowDag); service.shutdown(); } finally { if (!...
3.26
hudi_LogReaderUtils_decodeRecordPositionsHeader_rdh
/** * Decodes the {@link HeaderMetadataType#RECORD_POSITIONS} block header into record positions. * * @param content * A string of Base64-encoded bytes ({@link java.util.Base64} in Java * implementation) generated from serializing {@link Roaring64NavigableMap} * bitmap using the portable format. * @return ...
3.26
hudi_ColumnStatsIndices_getColStatsTargetPos_rdh
// the column schema: // |- file_name: string // |- min_val: row // |- max_val: row // |- null_cnt: long // |- val_cnt: long // |- column_name: string private static int[] getColStatsTargetPos() { RowType v35 = ((RowType) (COL_STATS_DATA_TYPE.getLogicalType())); return Stream.of(HoodieMetadataPayload.COLUMN_STATS_FIELD...
3.26
hudi_ColumnStatsIndices_getMetadataDataType_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- private static DataType getMetadataDataType() { return AvroSchemaConverter.convertToDataType(HoodieMetadataRecord.SCHEMA$); }
3.26
hudi_ColumnStatsIndices_transposeColumnStatsIndex_rdh
/** * Transposes and converts the raw table format of the Column Stats Index representation, * where each row/record corresponds to individual (column, file) pair, into the table format * where each row corresponds to single file with statistic for individual columns collated * w/in such row: ...
3.26
hudi_ConfigurationHotUpdateStrategyUtils_createConfigurationHotUpdateStrategy_rdh
/** * Creates a {@link ConfigurationHotUpdateStrategy} class via reflection. * * <p>If the class name of {@link ConfigurationHotUpdateStrategy} is configured * through the {@link HoodieStreamer.Config#configHotUpdateStrategyClass}. */ public static Option<ConfigurationHotUpdateStrategy> createConfigurationHotUpdat...
3.26
hudi_HoodieLogFormatReader_m0_rdh
/** * Note : In lazy mode, clients must ensure close() should be called only after processing all log-blocks as the * underlying inputstream will be closed. TODO: We can introduce invalidate() API at HoodieLogBlock and this object * can call invalidate on all returned log-blocks so that we check this scenario specif...
3.26
hudi_ErrorTableUtils_validate_rdh
/** * validates for constraints on ErrorRecordColumn when ErrorTable enabled configs are set. * * @param dataset */ public static void validate(Dataset<Row> dataset) { if (!isErrorTableCorruptRecordColumnPresent(dataset)) { throw new HoodieValidationException(String.format(("Invalid condition, columnNam...
3.26
hudi_GenericRecordFullPayloadGenerator_getNewPayload_rdh
/** * Create a new {@link GenericRecord} with random value according to given schema. * * Long fields which are specified within partitionPathFieldNames are constrained to the value of the partition for which records are being generated. * * @return {@link GenericRecord} with random value */ public GenericRecord ...
3.26
hudi_GenericRecordFullPayloadGenerator_getUpdatePayload_rdh
/** * Update a given {@link GenericRecord} with random value. The fields in {@code blacklistFields} will not be updated. * * @param record * GenericRecord to update * @param blacklistFields * Fields whose value should not be touched * @return The updated {@link GenericRecord} */ public GenericRecord getUpda...
3.26
hudi_GenericRecordFullPayloadGenerator_isPartialLongField_rdh
/** * Return true if this is a partition field of type long which should be set to the partition index. */ private boolean isPartialLongField(Schema.Field field, Set<String> partitionPathFieldNames) { if ((partitionPathFieldNames == null) || (!partitionPathFieldNames.contains(field.name()))) { return fa...
3.26
hudi_GenericRecordFullPayloadGenerator_isOption_rdh
/** * Check whether a schema is option. return true if it match the follows: 1. Its type is Type.UNION 2. Has two types 3. Has a NULL type. */ protected boolean isOption(Schema schema) { return (schema.getType().equals(Type.UNION) && (schema.getTypes().size() == 2)) && (schema.getTypes().get(0).getType().eq...
3.26
hudi_GenericRecordFullPayloadGenerator_typeConvert_rdh
/** * Generate random value according to their type. */ private Object typeConvert(Schema.Field field) { Schema fieldSchema = field.schema(); if (isOption(fieldSchema)) { fieldSchema = getNonNull(fieldSchema); } if (fieldSchema.getName().equals(DEFAULT_HOODIE_IS_DELETED_COL)) { retur...
3.26
hudi_GenericRecordFullPayloadGenerator_generateDeleteRecord_rdh
/** * Set _hoodie_is_deleted column value to true. * * @param record * GenericRecord to delete. * @return GenericRecord representing deleted record. */ protected GenericRecord generateDeleteRecord(GenericRecord record) { record.put(DEFAULT_HOODIE_IS_DELETED_COL, true); return record; }
3.26
hudi_GenericRecordFullPayloadGenerator_convertPartial_rdh
/** * Create a new {@link GenericRecord} with random values. Not all the fields have value, it is random, and its value is random too. * * @param schema * Schema to create with. * @return A {@link GenericRecord} with random value. */ protected Gene...
3.26
hudi_GenericRecordFullPayloadGenerator_updateTimestamp_rdh
/** * Generates a sequential timestamp (daily increment), and updates the timestamp field of the record. * Note: When generating records, number of records to be generated must be more than numDatePartitions * parallelism, * to guarantee that at least numDatePartitions are created. * * @VisibleForTesting */ publi...
3.26
hudi_GenericRecordFullPayloadGenerator_determineExtraEntriesRequired_rdh
/** * Method help to calculate the number of entries to add. * * @return Number of entries to add */ private void determineExtraEntriesRequired(int numberOfComplexFields, int numberOfBytesToAdd) { for (Schema.Field f : baseSchema.getFields()) { Schema elementSchema = f.schema(); // Find the size of the pri...
3.26
hudi_GenericRecordFullPayloadGenerator_validate_rdh
/** * Validate whether the record match schema. * * @param record * Record to validate. * @return True if matches. */ public boolean validate(GenericRecord record) { return genericData.validate(baseSchema, record); }
3.26
hudi_TimeWait_waitFor_rdh
/** * Wait for an interval time. */ public void waitFor() { try { if (waitingTime > timeout) { throw new HoodieException((("Timeout(" + waitingTime) + "ms) while waiting for ") + action); } TimeUnit.MILLISECONDS.sleep(interval);waitingTime += interval; } catch (Interrupted...
3.26
hudi_CompactionOperation_convertFromAvroRecordInstance_rdh
/** * Convert Avro generated Compaction operation to POJO for Spark RDD operation. * * @param operation * Hoodie Compaction Operation * @return */ public static CompactionOperation convertFromAvroRecordInstance(HoodieCompactionOperation operation) { CompactionOperation op = new CompactionOperation(); ...
3.26
hudi_InternalBloomFilter_getVectorSize_rdh
/** * * @return size of the the bloomfilter */public int getVectorSize() { return this.vectorSize; }
3.26
hudi_InternalBloomFilter_m0_rdh
/** * Adds a key to <i>this</i> filter. * * @param key * The key to add. */ @Override public void m0(Key key) { if (key == null) { throw new NullPointerException("key cannot be null"); } int[] h = hash.hash(key); hash.clear(); for (int i = 0; i < nbHash; i++) { bits.set...
3.26
hudi_InternalBloomFilter_getNBytes_rdh
/* @return number of bytes needed to hold bit vector */ private int getNBytes() { return ((int) ((((long) (vectorSize)) + 7) / 8)); }
3.26
hudi_BaseFileUtils_m1_rdh
/** * Read the min and max record key from the metadata of the given data file. * * @param configuration * Configuration * @param filePath * The data file path * @return A array of two string where the first is min record key and the second is max record key */ public String[] m1(Configuration configuration...
3.26
hudi_BaseFileUtils_readRowKeys_rdh
/** * Read the rowKey list from the given data file. * * @param filePath * The data file path * @param configuration * configuration to build fs object * @return Set Set of row keys */ public Set<String> readRowKeys(Configuration configuration, Path filePath) { return filterRowKeys(configuration, file...
3.26
hudi_HoodieStreamer_shutdownAsyncServices_rdh
/** * Shutdown async services like compaction/clustering as DeltaSync is shutdown. */ private void shutdownAsyncServices(boolean error) { LOG.info("Delta Sync shutdown. Error ?" + error); if (f4.isPresent()) { LOG.warn("Gracefully shutting down compactor"); f4.get().shutdown(false); } ...
3.26
hudi_HoodieStreamer_onInitializingWriteClient_rdh
/** * Callback to initialize write client and start compaction service if required. * * @param writeClient * HoodieWriteClient * @return */ protected Boolean onInitializingWriteClient(SparkRDDWriteClient writeClient) { if (cfg.isAsyncCompactionEnabled()) { if (f4....
3.26
hudi_HoodieStreamer_sync_rdh
/** * Main method to start syncing. */ public void sync() throws Exception { if (f0.isPresent()) { LOG.info("Performing bootstrap. Source=" + f0.get().getBootstrapConfig().getBootstrapSourceBasePath()); f0.get().execute(); } else { ingestionService.ifPresent(HoodieIngestionService::st...
3.26
hudi_KeyGenerator_getRecordKeyFieldNames_rdh
/** * Used during bootstrap, to project out only the record key fields from bootstrap source dataset. * * @return list of field names, when concatenated make up the record key. */ @PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING) public List<String> getRecordKeyFieldNames() { throw new UnsupportedOper...
3.26
hudi_SerDeHelper_inheritSchemas_rdh
/** * Add the new schema to the historical schemas. * use string operations to reduce overhead. * * @param newSchema * a new internalSchema * @param oldSchemas * historical schemas string. * @return a string. */ public static String inheritSchemas(InternalSchema newSchema, String oldSchemas) { if (newS...
3.26
hudi_SerDeHelper_parseSchemas_rdh
/** * Convert json string to history internalSchemas. * TreeMap is used to hold history internalSchemas. * * @param json * a json string * @return a TreeMap */ public static TreeMap<Long, InternalSchema> parseSchemas(String json) { TreeMap<Long, InternalSchema> result = new TreeMap<>(); try { J...
3.26
hudi_SerDeHelper_toJson_rdh
/** * Convert internalSchemas to json. * * @param internalSchema * a internal schema * @return a string */ public static String toJson(InternalSchema internalSchema) { if ((internalSchema == null) || internalSchema.isEmptySchema()) { return ""; } try { StringWriter writer = new S...
3.26
hudi_SerDeHelper_fromJson_rdh
/** * Convert string to internalSchema. * * @param json * a json string. * @return a internalSchema. */ public static Option<InternalSchema> fromJson(String json) { if ((json == null) || json.isEmpty()) { return Option.empty(); } try {return Option.of(fromJson(new ObjectMapper(new JsonFacto...
3.26
hudi_JmxReporterServer_forRegistry_rdh
/** * Returns a new {@link JmxReporterServer.Builder} for {@link JmxReporterServer}. * * @param registry * the registry to report * @return a {@link JmxReporterServer.Builder} instance for a {@link JmxReporterServer} */ public static JmxReporterServer.Builder forRegistry(MetricRegistry registry) { return n...
3.26
hudi_HoodieWriteCommitKafkaCallback_validateKafkaConfig_rdh
/** * Validate whether both {@code ProducerConfig.BOOTSTRAP_SERVERS_CONFIG} and kafka topic are configured. * Exception will be thrown if anyone of them is not configured. */ private void validateKafkaConfig() { ValidationUtils.checkArgument(!StringUtils.isNullOrEmpty(bootstrapServers), String.format("Config %s...
3.26
hudi_HoodieWriteCommitKafkaCallback_buildProducerRecord_rdh
/** * Method helps to create a {@link ProducerRecord}. To ensure the order of the callback messages, we should guarantee * that the callback message of the same table will goes to the same partition. Therefore, if user does not specify * the partition, we can use the table name as {@link ProducerRecord} key. * * @...
3.26
hudi_HoodieWriteCommitKafkaCallback_createProducer_rdh
/** * Method helps to create {@link KafkaProducer}. Here we set acks = all and retries = 3 by default to ensure no data * loss. * * @param hoodieConfig * Kafka configs * @return A {@link KafkaProducer} */ public KafkaProducer<String, String> createProducer(HoodieConfig hoodi...
3.26
hudi_SparkBasedReader_readAvro_rdh
// Spark anyways globs the path and gets all the paths in memory so take the List<filePaths> as an argument. // https://github.com/apache/spark/.../org/apache/spark/sql/execution/datasources/DataSource.scala#L251 public static JavaRDD<GenericRecord> readAvro(SparkSession sparkSession, String schemaStr, List<String> lis...
3.26
hudi_DFSHoodieDatasetInputReader_iteratorSize_rdh
/** * Returns the number of elements remaining in {@code iterator}. The iterator will be left exhausted: its {@code hasNext()} method will return {@code false}. */ private static int iteratorSize(Iterator<?> iterator) { int count = 0; while (iterator.hasNext()) { iterator.next(); count++; ...
3.26
hudi_DFSHoodieDatasetInputReader_iteratorLimit_rdh
/** * Creates an iterator returning the first {@code limitSize} elements of the given iterator. If the original iterator does not contain that many elements, the returned iterator will have the same * behavior as the original iterator. The returned iterator supports {@code remove()} if the original iterator does. * ...
3.26
hudi_FileBasedInternalSchemaStorageManager_getMetaClient_rdh
// make metaClient build lazy private HoodieTableMetaClient getMetaClient() { if (metaClient == null) { metaClient = HoodieTableMetaClient.builder().setBasePath(baseSchemaPath.getParent().getParent().toString()).setConf(conf).setTimeGeneratorConfig(HoodieTimeGeneratorConfig.defaultConfig(baseSchemaP...
3.26
hudi_Hash_parseHashType_rdh
/** * This utility method converts String representation of hash function name * to a symbolic constant. Currently two function types are supported, * "jenkins" and "murmur". * * @param name * hash function name * @return one of the predefined constants */ public static int parseHashType(String name) { if...
3.26
hudi_Hash_hash_rdh
/** * Calculate a hash using all bytes from the input argument, * and a provided seed value. * * @param bytes * input bytes * @param initval * seed value * @return hash value */ public int hash(byte[] bytes, int initval) { return hash(bytes, bytes.length, initval); }
3.26
hudi_Hash_m0_rdh
/** * Get a singleton instance of hash function of a given type. * * @param type * predefined hash type * @return hash function instance, or null if type is invalid */ public static Hash m0(int type) { switch (type) { case JENKINS_HASH : return JenkinsHash.getInstance(); case M...
3.26
hudi_KafkaAvroSchemaDeserializer_deserialize_rdh
/** * We need to inject sourceSchema instead of reader schema during deserialization or later stages of the pipeline. * * @param includeSchemaAndVersion * @param topic * @param isKey * @param payload * @param readerSchema * @return * @throws SerializationException */ @Override protected Object deserialize(boo...
3.26
hudi_DiskMap_addShutDownHook_rdh
/** * Register shutdown hook to force flush contents of the data written to FileOutputStream from OS page cache * (typically 4 KB) to disk. */ private void addShutDownHook() { shutdownThread = new Thread(this::cleanup); Runtime.getRuntime().addShutdownHook(shutdownThread); }
3.26
hudi_DiskMap_cleanup_rdh
/** * Cleanup all resources, files and folders. */ private void cleanup(boolean isTriggeredFromShutdownHook) { try { FileIOUtils.deleteDirectory(diskMapPathFile); } catch (IOException exception) { LOG.warn("Error while deleting the disk map directory=" + diskMapPath, exception); } if (...
3.26
hudi_DiskMap_close_rdh
/** * Close and cleanup the Map. */ public void close() { cleanup(false); }
3.26
hudi_DFSDeltaInputReader_analyzeSingleFile_rdh
/** * Implementation of {@link DeltaInputReader}s to provide a way to read a single file on DFS and provide an * average number of records across N files. */ protected long analyzeSingleFile(String filePath) { throw new UnsupportedOperationException("No implementation found"); }
3.26
hudi_HoodieCatalog_listDatabases_rdh
// ------ databases ------ @Override public List<String> listDatabases() throws CatalogException { try { FileStatus[] fileStatuses = fs.listStatus(catalogPath); return Arrays.stream(fileStatuses).filter(FileStatus::isDirectory).map(fileStatus -> fileStatus.getPath().getName()).collect(Collectors.toL...
3.26
hudi_HoodieCatalog_listTables_rdh
// ------ tables ------ @Override public List<String> listTables(String databaseName) throws DatabaseNotExistException, CatalogException { if (!databaseExists(databaseName)) { throw new DatabaseNotExistException(getName(), databaseName); } Path dbPath = new Path(catalogPath, databaseName); try {...
3.26
hudi_ConsistencyGuard_waitTill_rdh
/** * Wait Till target visibility is reached. * * @param dirPath * Directory Path * @param files * Files * @param targetVisibility * Target Visibility * @throws IOException * @throws TimeoutException */ default void waitTill(String dirPath, List<String> files, FileVisibility targetVisibility) throws IO...
3.26
hudi_HoodieSparkConsistentBucketIndex_updateLocation_rdh
/** * Persist hashing metadata to storage. Only clustering operations will modify the metadata. * For example, splitting & merging buckets, or just sorting and producing a new bucket. */ @Override public HoodieData<WriteStatus> updateLocation(HoodieData<WriteStatus> writeStatuses, HoodieEngineContext context, Hoodie...
3.26
hudi_Type_equals_rdh
/** * We need to override equals because the check {@code intType1 == intType2} can return {@code false}. * Despite the fact that most subclasses look like singleton with static field {@code INSTANCE}, * they can still be created by deserializer. */ @Override ...
3.26
hudi_Table_sortAndLimit_rdh
/** * Prepares for rendering. Rows are sorted and limited */private void sortAndLimit() { this.renderRows = new ArrayList<>();final int limit = this.limitOptional.orElse(rawRows.size()); // Row number is added here if enabled final List<List<Comparable>> rawOrderedRows = orderRows(); final List<List<C...
3.26
hudi_Table_add_rdh
/** * Main API to add row to the table. * * @param row * Row */ public Table add(List<Comparable> row) { if (finishedAdding) { throw new IllegalStateException("Container already marked done for adding. No more entries can be added."); } if (rowHeader.getFieldNames().size() != row.size()) { ...
3.26
hudi_Table_flip_rdh
/** * API to let the table know writing is over and reading is going to start. */ public Table flip() { this.finishedAdding = true; sortAndLimit(); return this;}
3.26
hudi_Table_addAllRows_rdh
/** * Add all rows. * * @param rows * Rows to be added * @return */ public Table addAllRows(List<Comparable[]> rows) { rows.forEach(r -> add(Arrays.asList(r))); return this; }
3.26
hudi_Table_addAll_rdh
/** * Add all rows. * * @param rows * Rows to be added * @return */ public Table addAll(List<List<Comparable>> rows) { rows.forEach(this::add); return this; }
3.26
hudi_HoodieBloomFilterWriteSupport_dereference_rdh
/** * This method allows to dereference the key object (t/h cloning, for ex) that might be * pointing at a shared mutable buffer, to make sure that we're not keeping references * to mutable objects */ protected T dereference(T key) { return key;}
3.26
hudi_CompactionUtils_getAllPendingCompactionOperationsInPendingCompactionPlans_rdh
/** * Get all partition + file Ids with pending Log Compaction operations and their target log compaction instant time. */ public static Map<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>> getAllPendingCompactionOperationsInPendingCompactionPlans(List<Pair<HoodieInstant, HoodieCompactionPlan>> pendingLogC...
3.26
hudi_CompactionUtils_getEarliestInstantToRetainForCompaction_rdh
/** * Gets the earliest instant to retain for MOR compaction. * If there is no completed compaction, * num delta commits >= "hoodie.compact.inline.max.delta.commits" * If there is a completed compaction, * num delta commits after latest completed compaction >= "hoodie.compact.inline.max.delta.commits" * * @param...
3.26
hudi_CompactionUtils_buildFromFileSlices_rdh
/** * Generate compaction plan from file-slices. * * @param partitionFileSlicePairs * list of partition file-slice pairs * @param extraMetadata * Extra Metadata * @param metricsCaptureFunction * Metrics Capture function */ public static HoodieCompactionPlan buildFromFileSlices(List<Pair<String, FileSlice...
3.26
hudi_CompactionUtils_getAllPendingCompactionOperations_rdh
/** * Get all PartitionPath + file-ids with pending Compaction operations and their target compaction instant time. * * @param metaClient * Hoodie Table Meta Client */ public static Map<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>> getAllPendingCompactionOperations(HoodieTableMetaClient metaClient)...
3.26
hudi_CompactionUtils_getAllPendingLogCompactionOperations_rdh
/** * Get all partition + file Ids with pending Log Compaction operations and their target log compaction instant time. */ public static Map<HoodieFileGroupId, Pair<String, HoodieCompactionOperation>> getAllPendingLogCompactionOperations(HoodieTableMetaClient metaClient) { List<Pair<HoodieInstant, HoodieCompactionPla...
3.26
hudi_CompactionUtils_getDeltaCommitsSinceLatestCompaction_rdh
/** * Returns a pair of (timeline containing the delta commits after the latest completed * compaction commit, the completed compaction commit instant), if the latest completed * compaction commit is present; a pair of (timeline containing all the delta commits, * the first delta commit instant), if there is no com...
3.26
hudi_CompactionUtils_buildCompactionOperation_rdh
/** * Build Compaction operation payload from Avro version for using in Spark executors. * * @param hc * HoodieCompactionOperation */ public static CompactionOperation buildCompactionOperation(HoodieCompactionOperation hc) { return CompactionOperation.convertFromAvroRecordInstance(hc); }
3.26
hudi_CompactionUtils_getPendingCompactionInstantTimes_rdh
/** * Return all pending compaction instant times. * * @return */ public static List<HoodieInstant> getPendingCompactionInstantTimes(HoodieTableMetaClient metaClient) { return metaClient.getActiveTimeline().filterPendingCompactionTimeline().getInstants(); }
3.26
hudi_CompactionUtils_buildHoodieCompactionOperation_rdh
/** * Build Avro generated Compaction operation payload from compaction operation POJO for serialization. */ public static HoodieCompactionOperation buildHoodieCompactionOperation(CompactionOperation op) { return HoodieCompactionOperation.newBuilder().setFileId(op.getFileId()).setBaseInstantTime(op.getBaseInstan...
3.26