name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_HoodieDefaultTimeline_getCommitsAndCompactionTimeline_rdh
/** * Get all instants (commits, delta commits, replace, compaction) that produce new data or merge file, in the active timeline. */ public HoodieTimeline getCommitsAndCompactionTimeline() { return getTimelineOfActions(CollectionUtils.createSet(COMMIT_ACTION, DELTA_COMMIT_ACTION, REPLACE_COMMIT_ACTION, COMPACTION_A...
3.26
hudi_HoodieDefaultTimeline_getCleanerTimeline_rdh
/** * Get only the cleaner action (inflight and completed) in the active timeline. */ public HoodieTimeline getCleanerTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(CLEAN_ACTION), ((Function) (this::getInstantDetails))); }
3.26
hudi_HoodieDefaultTimeline_getCommitTimeline_rdh
/** * Get only pure commits (inflight and completed) in the active timeline. */ public HoodieTimeline getCommitTimeline() { // TODO: Make sure this change does not break existing functionality. return getTimelineOfActions(CollectionUtils.createSet(COMMIT_ACTION, REPLACE_COMMIT_ACTION)); }
3.26
hudi_HoodieDefaultTimeline_getRestoreTimeline_rdh
/** * Get only the restore action (inflight and completed) in the active timeline. */ public HoodieTimeline getRestoreTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(RESTORE_ACTION), ((Function) (this::getInstantDetails))); }
3.26
hudi_HoodieDefaultTimeline_mergeTimeline_rdh
/** * Merge this timeline with the given timeline. */ public HoodieDefaultTimeline mergeTimeline(HoodieDefaultTimeline timeline) { Stream<HoodieInstant> instantStream = Stream.concat(getInstantsAsStream(), timeline.getInstantsAsStream()).sorted(); Function<HoodieInstant, Option<byte[]>> details = instant -> { if (get...
3.26
hudi_HoodieDefaultTimeline_getTimelineOfActions_rdh
/** * Get a timeline of a specific set of actions. useful to create a merged timeline of multiple actions. * * @param actions * actions allowed in the timeline */ public HoodieTimeline getTimelineOfActions(Set<String> actions) { return new HoodieDefaultTimeline(getInstantsAsStream().filter(s -> actions.contains(...
3.26
hudi_HoodieDefaultTimeline_getSavePointTimeline_rdh
/** * Get only the save point action (inflight and completed) in the active timeline. */ public HoodieTimeline getSavePointTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(SAVEPOINT_ACTION), ((Function) (this::getInstantDetails))); }
3.26
hudi_HoodieDefaultTimeline_getDeltaCommitTimeline_rdh
/** * Get only the delta commits (inflight and completed) in the active timeline. */ public HoodieTimeline getDeltaCommitTimeline() { return new HoodieDefaultTimeline(filterInstantsByAction(DELTA_COMMIT_ACTION), ((Function) (this::getInstantDetails))); }
3.26
hudi_HoodieDefaultTimeline_filterPendingExcludingMajorAndMinorCompaction_rdh
// TODO: Use a better naming convention for this. @Override public HoodieTimeline filterPendingExcludingMajorAndMinorCompaction() { return new HoodieDefaultTimeline(getInstantsAsStream().filter(instant -> (!instant.isCompleted()) && ((!instant.getAction().equals(HoodieTimeline.COMPACTION_ACTION)) || (!instant.getActio...
3.26
hudi_HoodieDefaultTimeline_findFirstNonSavepointCommit_rdh
/** * Returns the first non savepoint commit on the timeline. */ private static Option<HoodieInstant> findFirstNonSavepointCommit(List<HoodieInstant> instants) { Set<String> savepointTimestamps = instants.stream().filter(entry -> entry.getAction().equals(HoodieTimeline.SAVEPOINT_ACTION)).map(HoodieInstant::getTimesta...
3.26
hudi_HoodieDefaultTimeline_filterPendingMajorOrMinorCompactionTimeline_rdh
/** * Compaction and logcompaction operation on MOR table is called major and minor compaction respectively. */ @Override public HoodieTimeline filterPendingMajorOrMinorCompactionTimeline() { return new HoodieDefaultTimeline(getInstantsAsStream().filter(s -> s.getAction().equals(HoodieTimeline.COMPACTION_ACTION) |...
3.26
hudi_HoodieDefaultTimeline_m1_rdh
/** * Get only the rollback and restore action (inflight and completed) in the active timeline. */ public HoodieTimeline m1() { return getTimelineOfActions(CollectionUtils.createSet(ROLLBACK_ACTION, RESTORE_ACTION)); }
3.26
hudi_HoodieDefaultTimeline_getRollbackTimeline_rdh
/** * Get only the rollback action (inflight and completed) in the active timeline. */ public HoodieTimeline getRollbackTimeline() {return new HoodieDefaultTimeline(filterInstantsByAction(ROLLBACK_ACTION), ((Function) (this::getInstantDetails))); }
3.26
hudi_OrcUtils_fetchRecordKeysWithPositions_rdh
/** * Fetch {@link HoodieKey}s from the given ORC file. * * @param filePath * The ORC file path. * @param configuration * configuration to build fs object * @return {@link List} of {@link HoodieKey}s fetched from the ORC file */ @Override public List<Pair<HoodieKey, Long>> fetchRecordKeysWithPositions(Confi...
3.26
hudi_OrcUtils_getHoodieKeyIterator_rdh
/** * Provides a closable iterator for reading the given ORC file. * * @param configuration * configuration to build fs object * @param filePath * The ORC file path * @return {@link ClosableIterator} of {@link HoodieKey}s for reading the ORC file */ @Override publ...
3.26
hudi_OrcUtils_readAvroRecords_rdh
/** * NOTE: This literally reads the entire file contents, thus should be used with caution. */ @Override public List<GenericRecord> readAvroRecords(Configuration configuration, Path filePath, Schema avroSchema) { List<GenericRecord> records = new ArrayList<>(); try (Reader reader = OrcFile.createReader(filePath, Orc...
3.26
hudi_OrcUtils_filterRowKeys_rdh
/** * Read the rowKey list matching the given filter, from the given ORC file. If the filter is empty, then this will * return all the rowkeys. * * @param conf * configuration to build fs object. * @param filePath * The ORC file path. * @param filter * record keys filter * @return Set Set of pairs of ro...
3.26
hudi_SerializableSchema_readObjectFrom_rdh
// create a public read method for unit test public void readObjectFrom(ObjectInputStream in) throws IOException { try { schema = new Schema.Parser().parse(in.readObject().toString()); } catch (ClassNotFoundException e) { throw new IOException("unable to parse schema", e); ...
3.26
hudi_SerializableSchema_writeObjectTo_rdh
// create a public write method for unit test public void writeObjectTo(ObjectOutputStream out) throws IOException { // Note: writeUTF cannot support string length > 64K. So use writeObject which has small overhead (relatively). out.writeObject(schema.toString()); }
3.26
hudi_BootstrapOperator_preLoadIndexRecords_rdh
/** * Load the index records before {@link #processElement}. */ protected void preLoadIndexRecords() throws Exception { String basePath = hoodieTable.getMetaClient().getBasePath(); int taskID = getRuntimeContext().getIndexOfThisSubtask(); LOG.info("Start loading records in table {} into the index stat...
3.26
hudi_BootstrapOperator_waitForBootstrapReady_rdh
/** * Wait for other bootstrap tasks to finish the index bootstrap. */ private void waitForBootstrapReady(int taskID) { int taskNum = getRuntimeContext().getNumberOfParallelSubtasks(); int readyTaskNum = 1; while (taskNum != readyTaskNum) { try { readyTaskNum = aggregateManager.upd...
3.26
hudi_BootstrapOperator_loadRecords_rdh
/** * Loads all the indices of give partition path into the backup state. * * @param partitionPath * The partition path */ @SuppressWarnings("unchecked") protected void loadRecords(String partitionPath) throws Exception { long start = System.currentTimeMillis(); final int parallelism = getRuntimeContex...
3.26
hudi_MarkerHandler_getCreateAndMergeMarkers_rdh
/** * * @param markerDir * marker directory path * @return all marker paths of write IO type "CREATE" and "MERGE" */ public Set<String> getCreateAndMergeMarkers(String markerDir) { return getAllMarkers(markerDir).stream().filter(markerName -> !markerName.endsWith(IOType.APPEND.name())).collect(Collectors.toS...
3.26
hudi_MarkerHandler_stop_rdh
/** * Stops the dispatching of marker creation requests. */ public void stop() { if (dispatchingThreadFuture != null) { dispatchingThreadFuture.cancel(true); } dispatchingExecutorService.shutdown(); batchingExecutorService.shutdown(); }
3.26
hudi_MarkerHandler_deleteMarkers_rdh
/** * Deletes markers in the directory. * * @param markerDir * marker directory path * @return {@code true} if successful; {@code false} otherwise. */ public Boolean deleteMarkers(String markerDir) { boolean result = getMarkerDirState(markerDir).deleteAllMarkers(); markerDirStateMap.remove(markerDir...
3.26
hudi_MarkerHandler_m0_rdh
/** * * @param markerDir * marker directory path. * @return Pending markers from the requests to process. */ public Set<String> m0(String markerDir) { if (markerDirStateMap.containsKey(markerDir)) { MarkerDirState markerDirState = getMarkerDirState(markerDir);return markerDirState.getPendingMarkerC...
3.26
hudi_MarkerHandler_doesMarkerDirExist_rdh
/** * * @param markerDir * marker directory path * @return {@code true} if the marker directory exists; {@code false} otherwise. */ public boolean doesMarkerDirExist(String markerDir) { MarkerDirState markerDirState = getMarkerDirState(markerDir); return markerDirState.exists(); }
3.26
hudi_MarkerHandler_createMarker_rdh
/** * Generates a future for an async marker creation request * * The future is added to the marker creation future list and waits for the next batch processing * of marker creation requests. * * @param context * Javalin app context * @param markerDir * marker directory path * @param markerName * marke...
3.26
hudi_ClusteringUtils_getAllPendingClusteringPlans_rdh
/** * Get all pending clustering plans along with their instants. */ public static Stream<Pair<HoodieInstant, HoodieClusteringPlan>> getAllPendingClusteringPlans(HoodieTableMetaClient metaClient) { List<HoodieInstant> v0 = metaClient.getActiveTimeline().filterPendingReplaceTimeline().getInstants(); return v0...
3.26
hudi_ClusteringUtils_getClusteringPlan_rdh
/** * Get Clustering plan from timeline. * * @param metaClient * @param pendingReplaceInstant * @return */ public static Option<Pair<HoodieInstant, HoodieClusteringPlan>> getClusteringPlan(HoodieTableMetaClient metaClient, HoodieInstant pendingReplaceInstant) { try { Option<HoodieRequestedReplaceMetad...
3.26
hudi_ClusteringUtils_isClusteringCommit_rdh
/** * Checks if the replacecommit is clustering commit. */ public static boolean isClusteringCommit(HoodieTableMetaClient metaClient, HoodieInstant pendingReplaceInstant) { return getClusteringPlan(metaClient, pendingReplaceInstant).isPresent(); }
3.26
hudi_ClusteringUtils_m0_rdh
/** * Get filegroups to pending clustering instant mapping for all pending clustering plans. * This includes all clustering operations in 'requested' and 'inflight' states. */ public static Map<HoodieFileGroupId, HoodieInstant> m0(HoodieTableMetaClient metaClient) { Stream<Pair<HoodieInstant, HoodieClusteringPla...
3.26
hudi_ClusteringUtils_getRequestedReplaceMetadata_rdh
/** * Get requested replace metadata from timeline. * * @param metaClient * @param pendingReplaceInstant * @return * @throws IOException */ private static Option<HoodieRequestedReplaceMetadata> getRequestedReplaceMetadata(HoodieTableMetaClient metaClient, HoodieInstant pendingReplaceInstant) throws IOException ...
3.26
hudi_ClusteringUtils_createClusteringPlan_rdh
/** * Create clustering plan from input fileSliceGroups. */ public static HoodieClusteringPlan createClusteringPlan(String strategyClassName, Map<String, String> strategyParams, List<FileSlice>[] fileSliceGroups, Map<String, String> extraMetadata) { List<HoodieClusteringGroup> clusteringGroups = Arrays.stream(fil...
3.26
hudi_RealtimeCompactedRecordReader_getMergedLogRecordScanner_rdh
/** * Goes through the log files and populates a map with latest version of each key logged, since the base split was * written. */ private HoodieMergedLogRecordScanner getMergedLogRecordScanner() throws IOException { // NOTE: HoodieCompactedLogRecordScanner will not return records for an in-...
3.26
hudi_HoodieWriteCommitCallbackUtil_convertToJsonString_rdh
/** * Convert data to json string format. */ public static String convertToJsonString(Object obj) { try { return mapper.writeValueAsString(obj); } catch (IOException e) { throw new HoodieCommitCallbackException("Callback service convert data to json failed", e); } }
3.26
hudi_LogFileCreationCallback_preFileCreation_rdh
/** * Executes action right before log file is created. * * @param logFile * The log file. * @return true if the action executes successfully. */ default boolean preFileCreation(HoodieLogFile logFile) { return true; }
3.26
hudi_AvroOrcUtils_addToVector_rdh
/** * Add an object (of a given ORC type) to the column vector at a given position. * * @param type * ORC schema of the value Object. * @param colVector * The column vector to store the value Object. * @param avroSchema * Avro schema of the value Object. * Only used to check logical types for timestamp...
3.26
hudi_AvroOrcUtils_readFromVector_rdh
/** * Read the Column vector at a given position conforming to a given ORC schema. * * @param type * ORC schema of the object to read. * @param colVector * The column vector to read. * @param avroSchema * Avro schema of the object to read. * Only used to check logical types for timestamp unit conversio...
3.26
hudi_AvroOrcUtils_addUnionValue_rdh
/** * Match value with its ORC type and add to the union vector at a given position. * * @param unionVector * The vector to store value. * @param unionChildTypes * All possible types for the value Object. * @param avroSchema * Avro union schema for the value Object. * @param value * Object to be added...
3.26
hudi_AvroOrcUtils_getActualSchemaType_rdh
/** * Returns the actual schema of a field. * * All types in ORC is nullable whereas Avro uses a union that contains the NULL type to imply * the nullability of an Avro type. To achieve consistency between the Avro and ORC schema, * non-NULL types are extracted from the union type. * * @param unionSchema * A ...
3.26
hudi_Triple_compareTo_rdh
// ----------------------------------------------------------------------- /** * <p> * Compares the triple based on the left element, followed by the middle element, finally the right element. The types * must be {@code Comparable}. * </p> * * @param other * the other triple, not null * @return negative if th...
3.26
hudi_Triple_toString_rdh
/** * <p> * Formats the receiver using the given format. * </p> * * <p> * This uses {@link java.util.Formattable} to perform the formatting. Three variables may be used to embed the left * and right elements. Use {@code %1$s} for the left element, {@code %2$s} for the middle and {@code %3$s} for the * right ele...
3.26
hudi_Triple_equals_rdh
/** * <p> * Compares this triple to another based on the three elements. * </p> * * @param obj * the object to compare to, null returns false * @return true if the elements of the triple are equal */ // ObjectUtils.equals(Object, Object) has been deprecated in 3.2 @SuppressWarnings("deprecation") @Override pu...
3.26
hudi_Triple_of_rdh
/** * <p> * Obtains an immutable triple of from three objects inferring the generic types. * </p> * * <p> * This factory allows the triple to be created using inference to obtain the generic types. * </p> * * @param <L> * the left element type * @param <M> * the middle element type * @param <R> * th...
3.26
hudi_Triple_hashCode_rdh
/** * <p> * Returns a suitable hash code. * </p> * * @return the hash code */ @Override public int hashCode() { return ((getLeft() == null ? 0 : getLeft().hashCode()) ^ (getMiddle() == null ? 0 : getMiddle().hashCode())) ^ (getRight() == null ? 0 : getRight().hashCode()); }
3.26
hudi_HivePartitionUtil_getPartitionClauseForDrop_rdh
/** * Build String, example as year=2021/month=06/day=25 */ public static String getPartitionClauseForDrop(String partition, PartitionValueExtractor partitionValueExtractor, HiveSyncConfig config) { List<String> partitionValues = partitionValueExtractor.extractPartitionValuesInPath(partition); Validat...
3.26
hudi_RecordIterators_getParquetRecordIterator_rdh
/** * Factory clazz for record iterators. */ public abstract class RecordIterators {public static ClosableIterator<RowData> getParquetRecordIterator(InternalSchemaManager internalSchemaManager, boolean utcTimestamp, boolean caseSensitive, Configuration conf, String[] fieldNames, DataType[] fieldTypes, Map<String, Ob...
3.26
hudi_Option_fromJavaOptional_rdh
/** * Convert from java.util.Optional. * * @param v * java.util.Optional object * @param <T> * type of the value stored in java.util.Optional object * @return Option */ public static <T> Option<T> fromJavaOptional(Optional<T> v) { return Option.ofNullable(v.orElse(null));}
3.26
hudi_Option_orElseGet_rdh
/** * Identical to {@code Optional.orElseGet} */ public T orElseGet(Supplier<? extends T> other) { return val != null ? val : other.get(); }
3.26
hudi_Option_toJavaOptional_rdh
/** * Convert to java Optional. */ public Optional<T> toJavaOptional() { return Optional.ofNullable(val); }
3.26
hudi_Option_orElseThrow_rdh
/** * Identical to {@code Optional.orElseThrow} */ public <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X { if (val != null) { return val; } else { throw exceptionSupplier.get(); } }
3.26
hudi_Option_or_rdh
/** * Returns this {@link Option} if not empty, otherwise evaluates provided supplier * and returns its result */ public Option<T> or(Supplier<? extends Option<T>> other) { return val != null ? this : other.get(); } /** * Identical to {@code Optional.orElse}
3.26
hudi_MarkerCreationDispatchingRunnable_run_rdh
/** * Dispatches the marker creation requests that can be process to a worker thread of batch * processing the requests. * * For each marker directory, goes through the following steps: * (1) find the next available file index for writing. If no file index is available, * skip the processing of this marker dir...
3.26
hudi_SparkMain_upgradeOrDowngradeTable_rdh
/** * Upgrade or downgrade table. * * @param jsc * instance of {@link JavaSparkContext} to use. * @param basePath * base path of the dataset. * @param toVersion * version to which upgrade/downgrade to be done. * @return 0 if success, else -1. * @throws Exception */ protected static int upgradeOrDowngra...
3.26
hudi_QuickstartUtils_generateUniqueUpdates_rdh
/** * Generates new updates, one for each of the keys above * list * * @param n * Number of updates (must be no more than number of existing keys) * @return list of hoodie record updates */ public List<HoodieRecord> generateUniqueUpdates(Integer n) { if (numExistingKeys < n) { throw new Hood...
3.26
hudi_QuickstartUtils_generateRangeRandomTimestamp_rdh
/** * Generate timestamp range from {@param daysTillNow} before to now. */ private static long generateRangeRandomTimestamp(int daysTillNow) { long maxIntervalMillis = (((daysTillNow * 24) * 60) * 60) * 1000L; return System.currentTimeMillis() - ((long) (Math.random() * maxIntervalMillis)); }
3.26
hudi_QuickstartUtils_generateInsertsStream_rdh
/** * Generates new inserts, uniformly across the partition paths above. It also updates the list of existing keys. */ public Stream<HoodieRecord> generateInsertsStream(String randomString, Integer n) { int currSize = getNumExistingKeys(); return IntStream.rang...
3.26
hudi_QuickstartUtils_generateUpdates_rdh
/** * Generates new updates, randomly distributed across the keys above. There can be duplicates within the returned * list * * @param n * Number of updates (including dups) * @return list of hoodie record updates */ public List<HoodieRecord> generateUpdates(Integer n) { if (numExistingKeys == 0) { ...
3.26
hudi_QuickstartUtils_generateRandomValue_rdh
/** * Generates a new avro record of the above schema format, retaining the key if optionally provided. The * riderDriverSuffix string is a random String to simulate updates by changing the rider driver fields for records * belonging to the same commit. It is purely used for demo purposes. In real world, the actual ...
3.26
hudi_QuickstartUtils_generateDeletes_rdh
/** * Generates delete records for the passed in rows. * * @param rows * List of {@link Row}s for which delete record need to be generated * @return list of hoodie records to delete */ public List<String> generateDeletes(List<Row> rows) { // if row.length() == 2, then the record contains "uuid" and "partiti...
3.26
hudi_QuickstartUtils_generateInserts_rdh
/** * Generates new inserts, uniformly across the partition paths above. It also updates the list of existing keys. */ public List<HoodieRecord> generateInserts(Integer n) throws IOException { String randomString = generateRandomString(); return generateInsertsStream(randomString, n).collect(Collectors.toList...
3.26
hudi_CachingPath_resolveRelativePath_rdh
// are already normalized private static String resolveRelativePath(String basePath, String relativePath) { StringBuffer sb = new StringBuffer(basePath); if (basePath.endsWith("/")) { if (relativePath.startsWith("/")) { sb.append(relativePath.substring(1)); } else { sb....
3.26
hudi_CachingPath_concatPathUnsafe_rdh
// TODO java-doc public static CachingPath concatPathUnsafe(Path basePath, String relativePath) {try { URI baseURI = basePath.toUri(); // NOTE: {@code normalize} is going to be invoked by {@code Path} ctor, so there's no // point in invoking it here String v2 = resolveRelativePath(baseURI.getPath(), relativePath); UR...
3.26
hudi_CachingPath_createRelativePathUnsafe_rdh
/** * Creates path based on the provided *relative* path * * NOTE: This is an unsafe version that is relying on the fact that the caller is aware * what they are doing this is not going to work with paths having scheme (which require * parsing) and is only meant to work w/ relative paths in a few speci...
3.26
hudi_CachingPath_getPathWithoutSchemeAndAuthority_rdh
/** * This is {@link Path#getPathWithoutSchemeAndAuthority(Path)} counterpart, instantiating * {@link CachingPath} */ public static Path getPathWithoutSchemeAndAuthority(Path path) { // This code depends on Path.toString() to remove the leading slash before // the drive specification on Windows. return ...
3.26
hudi_BaseSparkUpdateStrategy_getGroupIdsWithUpdate_rdh
/** * Get records matched file group ids. * * @param inputRecords * the records to write, tagged with target file id * @return the records matched file group ids */ protected List<HoodieFileGroupId> getGroupIdsWithUpdate(HoodieData<HoodieRecord<T>> inputRecords) { return inputRecords.filter(record -> record...
3.26
hudi_RDDConsistentBucketBulkInsertPartitioner_initializeBucketIdentifier_rdh
/** * Initialize hashing metadata of input records. The metadata of all related partitions will be loaded, and * the mapping from partition to its bucket identifier is constructed. */ private Map<String, ConsistentBucketIdentifier> initializeBucketIdentifier(JavaRDD<HoodieRecord<T>> records) { return records.m...
3.26
hudi_RDDConsistentBucketBulkInsertPartitioner_repartitionRecords_rdh
/** * Repartition the records to conform the bucket index storage layout constraints. * Specifically, partition the records based on consistent bucket index, which is computed * using hashing metadata and records' key. * * @param records * Input Hoodie records * @param outputSparkPartitions * Not used, the ...
3.26
hudi_RDDConsistentBucketBulkInsertPartitioner_m0_rdh
/** * Initialize fileIdPfx for each data partition. Specifically, the following fields is constructed: * - fileIdPfxList: the Nth element corresponds to the Nth data partition, indicating its fileIdPfx * - partitionToFileIdPfxIdxMap (return value): (table partition) -> (fileIdPfx -> idx) mapping * - doAppend: repre...
3.26
hudi_RDDConsistentBucketBulkInsertPartitioner_getBucketIdentifier_rdh
/** * Get (construct) the bucket identifier of the given partition */ private ConsistentBucketIdentifier getBucketIdentifier(String partition) { HoodieSparkConsistentBucketIndex index = ((HoodieSparkConsistentBucketIndex) (table.getIndex())); HoodieConsistentHashingMetadata metadata = ConsistentBucketIndex...
3.26
hudi_ValidationUtils_checkArgument_rdh
/** * Ensures the truth of an expression, throwing the custom errorMessage otherwise. */ public static void checkArgument(final boolean expression, final Supplier<String> errorMessageSupplier) { checkArgument(expression, errorMessageSupplier.get()); }
3.26
hudi_ValidationUtils_checkState_rdh
/** * Ensures the truth of an expression involving the state of the calling instance, but not * involving any parameters to the calling method. * * @param expression * a boolean expression * @param errorMessage * - error message * @throws IllegalStateException * if {@code expression} is false */ public ...
3.26
hudi_BaseJavaCommitActionExecutor_getInsertPartitioner_rdh
/** * Provides a partitioner to perform the insert operation, based on the workload profile. */ public Partitioner getInsertPartitioner(WorkloadProfile profile) { return getUpsertPartitioner(profile); }
3.26
hudi_BaseJavaCommitActionExecutor_getUpsertPartitioner_rdh
/** * Provides a partitioner to perform the upsert operation, based on the workload profile. */ public Partitioner getUpsertPartitioner(WorkloadProfile profile) { if (profile == null) { throw new HoodieUpsertException("Need workload profile to construct the upsert partitioner."); } return new JavaUpsertPartitione...
3.26
hudi_HoodieHiveCatalog_isHoodieTable_rdh
// ------ tables ------ private Table isHoodieTable(Table hiveTable) { if ((!hiveTable.getParameters().getOrDefault(SPARK_SOURCE_PROVIDER, "").equalsIgnoreCase("hudi")) && (!isFlinkHoodieTable(hiveTable))) { throw new HoodieCatalogException(String.format("the %s is not hoodie table", hiveTable.getTableName())); } ...
3.26
hudi_HoodieHiveCatalog_listDatabases_rdh
// ------ databases ------ @Override public List<String> listDatabases() throws CatalogException { try { return client.getAllDatabases(); } catch (TException e) { throw new HoodieCatalogException(String.format("Failed to list all databases in %s", getName()), e); } }
3.26
hudi_CompactionTask_newBuilder_rdh
/** * Utility to create builder for {@link CompactionTask}. * * @return Builder for {@link CompactionTask}. */ public static Builder newBuilder() { return new Builder(); }
3.26
hudi_HoodieIndex_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). */ @Deprecated @PublicAPIMethod(maturity = ApiMaturityLevel.DEPRECATED) public I tagLocation(I records, HoodieEngineContext context, HoodieTable hoodieTable) throws HoodieIndexExcepti...
3.26
hudi_HoodieIndex_requiresTagging_rdh
/** * To indicate if an operation type requires location tagging before writing */ @PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING) public boolean requiresTagging(WriteOperationType operationType) { switch (operationType) {case DELETE : case DELETE_PREPPED...
3.26
hudi_HoodieIndex_updateLocation_rdh
/** * Extracts the location of written records, and updates the index. */ @PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING) public HoodieData<WriteStatus> updateLocation(HoodieData<WriteStatus> writeStatuses, HoodieEngineContext context, HoodieTable hoodieTable, String instant) throws HoodieIndexException { ...
3.26
hudi_HoodieBaseParquetWriter_handleParquetBloomFilters_rdh
/** * Once we get parquet version >= 1.12 among all engines we can cleanup the reflexion hack. * * @param parquetWriterbuilder * @param hadoopConf */ protected void handleParquetBloomFilters(ParquetWriter.Builder parquetWriterbuilder, Configuration hadoopConf) { // inspired from https://github.com/apache/parq...
3.26
hudi_PartialBindVisitor_visitNameReference_rdh
/** * If the attribute cannot find from the schema, directly return null, visitPredicate * will handle it. */ @Override public Expression visitNameReference(NameReference attribute) { Types.Field field = (caseSensitive) ? recordType.fieldByName(attribute.getName()) : recordType.fieldByNameCaseInsensitive(attrib...
3.26
hudi_PartialBindVisitor_visitPredicate_rdh
/** * If an expression is null after accept method, which means it cannot be bounded from * schema, we'll directly return {@link Predicates.TrueExpression}. */ @Override public Expression visitPredicate(Predicate predicate) { if (predicate instanceof Predicates.BinaryComparison) { Predicates.BinaryCompar...
3.26
hudi_HoodieWriteMetadata_clone_rdh
/** * Clones the write metadata with transformed write statuses. * * @param transformedWriteStatuses * transformed write statuses * @param <T> * type of transformed write statuses * @return Cloned {@link HoodieWriteMetadata<T>} instance */ public <T> HoodieWriteMetadata<T> clone(T transformedWriteStatuses) ...
3.26
hudi_HoodieRowCreateHandle_close_rdh
/** * Closes the {@link HoodieRowCreateHandle} and returns an instance of {@link WriteStatus} containing the stats and * status of the writes to this handle. * * @return the {@link WriteStatus} containing the stats and status of the writes to this handle. */ public WriteStatus close() throws IOException { file...
3.26
hudi_HoodieRowCreateHandle_canWrite_rdh
/** * Returns {@code true} if this handle can take in more writes. else {@code false}. */ public boolean canWrite() { return fileWriter.canWrite(); }
3.26
hudi_HoodieRowCreateHandle_createMarkerFile_rdh
/** * Creates an empty marker file corresponding to storage writer path. * * @param partitionPath * Partition path */ private static void createMarkerFile(String partitionPath, String dataFileName, String instantTime, HoodieTable<?, ?, ?, ?> table, HoodieWriteConfig writeConfig) {...
3.26
hudi_HoodieRowCreateHandle_getWriteToken_rdh
// TODO extract to utils private static String getWriteToken(int taskPartitionId, long taskId, long taskEpochId) { return (((taskPartitionId + "-") + taskId) + "-") + taskEpochId; }
3.26
hudi_HoodieRowCreateHandle_write_rdh
/** * Writes an {@link InternalRow} to the underlying HoodieInternalRowFileWriter. Before writing, value for meta columns are computed as required * and wrapped in {@link HoodieInternalRow}. {@link HoodieInternalRow} is what gets written to HoodieInternalRowFileWriter. * * @param row * instance of {@link Interna...
3.26
hudi_HoodieAppendHandle_appendDataAndDeleteBlocks_rdh
/** * Appends data and delete blocks. When appendDeleteBlocks value is false, only data blocks are appended. * This is done so that all the data blocks are created first and then a single delete block is added. * Otherwise what can end up happening is creation of multiple small delete blocks get added after each dat...
3.26
hudi_HoodieAppendHandle_isUpdateRecord_rdh
/** * Returns whether the hoodie record is an UPDATE. */ protected boolean isUpdateRecord(HoodieRecord<T> hoodieRecord) { // If currentLocation is present, then this is an update return hoodieRecord.getCurrentLocation() != null; }
3.26
hudi_HoodieAppendHandle_flushToDiskIfRequired_rdh
/** * Checks if the number of records have reached the set threshold and then flushes the records to disk. */ private void flushToDiskIfRequired(HoodieRecord record, boolean appendDeleteBlocks) { if ((numberOfRecords >= ((int) (maxBlockSize / averageRecordSize))) || ((numberOfRecords % NUMBER_OF_RECORDS_TO_ESTIMA...
3.26
hudi_HoodieAppendHandle_needsUpdateLocation_rdh
/** * Whether there is need to update the record location. */ protected boolean needsUpdateLocation() { return true; }
3.26
hudi_HoodieAppendHandle_getFileInstant_rdh
/** * Returns the instant time to use in the log file name. */ private String getFileInstant(HoodieRecord<?> record) { if (config.isConsistentHashingEnabled()) { // Handle log file only case. This is necessary for the concurrent clustering and writer case (e.g., consistent hashing bucket index). // NOTE: flin...
3.26
hudi_HoodieSyncClient_getDroppedPartitionsSince_rdh
/** * Get the set of dropped partitions since the last synced commit. * If last sync time is not known then consider only active timeline. * Going through archive timeline is a costly operation, and it should be avoided unless some start time is given. */ public Set<String> getDroppedPartitionsSince(Option<String> ...
3.26
hudi_HoodieSyncClient_getPartitionEvents_rdh
/** * Iterate over the storage partitions and find if there are any new partitions that need to be added or updated. * Generate a list of PartitionEvent based on the changes required. */ public List<PartitionEvent> getPartitionEvents(List<Partition> partitionsInMetastore, List<String> writtenPartitionsOnStorage, S...
3.26
hudi_HoodieSyncClient_getAllPartitionPathsOnStorage_rdh
/** * Gets all relative partitions paths in the Hudi table on storage. * * @return All relative partitions paths. */ public List<String> getAllPartitionPathsOnStorage() { HoodieLocalEngineContext engineContext = new HoodieLocalEngineContext(metaClient.getHadoopConf()); return FSUtils.getAllPartitionPaths(en...
3.26
hudi_HoodieFunctionalIndexMetadata_fromJson_rdh
/** * Deserialize from JSON string to create an instance of this class. * * @param json * Input JSON string. * @return Deserialized instance of HoodieFunctionalIndexMetadata. * @throws IOException * If any deserialization errors occur. */ public static HoodieFunctionalIndexMetadata fromJson(String json) thr...
3.26
hudi_HoodieFunctionalIndexMetadata_toJson_rdh
/** * Serialize this object to JSON string. * * @return Serialized JSON string. * @throws JsonProcessingException * If any serialization errors occur. */ public String toJson() throws JsonProcessingException { if (f0.containsKey(null)) { LOG.info("null index name for the index definition " + f0.get(...
3.26