name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hudi_StreamWriteFunction_preWrite_rdh | /**
* Sets up before flush: patch up the first record with correct partition path and fileID.
*
* <p>Note: the method may modify the given records {@code records}.
*/
public void preWrite(List<HoodieRecord> records) {
// rewrite the first record with expected fileID
HoodieRecord<?> first = records.get(0)... | 3.26 |
hudi_ClusteringUtil_m0_rdh | /**
* Schedules clustering plan by condition.
*
* @param conf
* The configuration
* @param writeClient
* The write client
* @param committed
* Whether the instant was committed
*/
public static void m0(Configuration conf, HoodieFlinkWriteClient writeClient, boolean committed) {
validateClusteringSche... | 3.26 |
hudi_ClusteringUtil_rollbackClustering_rdh | /**
* Force rolls back the inflight clustering instant, for handling failure case.
*
* @param table
* The hoodie table
* @param writeClient
* The write client
* @param instantTime
* The instant time
*/
public static void rollbackClustering(HoodieFlinkTable<?> t... | 3.26 |
hudi_ClusteringUtil_m1_rdh | /**
* Returns whether the given instant {@code instant} is with clustering operation.
*/
public static boolean m1(HoodieInstant instant, HoodieTimeline timeline) {
if (!instant.getAction().equals(HoodieTimeline.REPLACE_COMMIT_ACTION)) {
return false;
}try {
return TimelineUtils.getCommitMetada... | 3.26 |
hudi_HoodieSimpleIndex_fetchRecordLocationsForAffectedPartitions_rdh | /**
* Fetch record locations for passed in {@link HoodieKey}s.
*
* @param hoodieKeys
* {@link HoodieData} of {@link HoodieKey}s for which locations are fetched
* @param context
* instance of {@link HoodieEngineContext} to use
* @param hoodieTable
* instance of {@link HoodieTable} of interest
* @param par... | 3.26 |
hudi_HoodieSimpleIndex_tagLocationInternal_rdh | /**
* Tags records location for incoming records.
*
* @param inputRecords
* {@link HoodieData} of incoming records
* @param context
* instance of {@link HoodieEngineContext} to use
* @param hoodieTable
* instance of {@link HoodieTable} to use
* @return {@link HoodieData} of records with record locations ... | 3.26 |
hudi_RequestHandler_registerTimelineAPI_rdh | /**
* Register Timeline API calls.
*/
private void registerTimelineAPI() {
app.get(RemoteHoodieTableFileSystemView.LAST_INSTANT, new ViewHandler(ctx -> {
metricsRegistry.add("LAST_INSTANT", 1);
List<InstantDTO> dtos = instantHandler.getLastInstant(ctx.queryParamAsClass(RemoteHoodieTableFileSystemV... | 3.26 |
hudi_RequestHandler_shouldThrowExceptionIfLocalViewBehind_rdh | /**
* Determine whether to throw an exception when local view of table's timeline is behind that of client's view.
*/
private boolean shouldThrowExceptionIfLocalViewBehind(HoodieTimeline localTimeline, String timelineHashFromClient) {Option<HoodieInstant> lastInstant = localTimeline.lastInstant();
// When perfor... | 3.26 |
hudi_RequestHandler_registerDataFilesAPI_rdh | /**
* Register Data-Files API calls.
*/
private void registerDataFilesAPI() {
app.get(RemoteHoodieTableFileSystemView.LATEST_PARTITION_DATA_FILES_URL, new ViewHandler(ctx -> {
metricsRegistry.add("LATEST_PARTITION_DATA_FILES", 1);
List<BaseFi... | 3.26 |
hudi_RequestHandler_isLocalViewBehind_rdh | /**
* Determines if local view of table's timeline is behind that of client's view.
*/
private boolean isLocalViewBehind(Context ctx) {
String basePath = ctx.queryParam(RemoteHoodieTableFileSystemView.BASEPATH_PARAM);
String v5 = ctx.queryParamAsClass(RemoteHoodieTableFileSystemView.LAST_INSTANT_TS, String.c... | 3.26 |
hudi_RequestHandler_registerFileSlicesAPI_rdh | /**
* Register File Slices API calls.
*/
private void registerFileSlicesAPI() {
app.get(RemoteHoodieTableFileSystemView.LATEST_PARTITION_SLICES_URL, new ViewHandler(ctx -> {
metricsRegistry.add("LATEST_PARTITION_SLICES", 1);
List<FileSliceDTO> dtos = sliceHandler.getLatestFileSlices(ctx.queryParam... | 3.26 |
hudi_RequestHandler_jsonifyResult_rdh | /**
* Serializes the result into JSON String.
*
* @param ctx
* Javalin context
* @param obj
* object to serialize
* @param metricsRegistry
* {@code Registry} instance for storing metrics
* @param objectMapper
* JSON object mapper
* @param logger
* {@code Logger} instance
* @return JSON String fro... | 3.26 |
hudi_RequestHandler_syncIfLocalViewBehind_rdh | /**
* Syncs data-set view if local view is behind.
*/
private boolean syncIfLocalViewBehind(Context ctx) {
String basePath = ctx.queryParam(RemoteHoodieTableFileSystemView.BASEPATH_PARAM);
SyncableFileSystemView view = viewManager.getFileSystemView(basePath);
synchronized(view) {
if (isLocalViewBe... | 3.26 |
hudi_GcsEventsSource_processMessages_rdh | /**
* Convert Pubsub messages into a batch of GCS file MetadataMsg objects, skipping those that
* don't need to be processed.
*
* @param receivedMessages
* Pubsub messages
* @return A batch of GCS file metadata messages
*/
private MessageBatch processMessages(List<ReceivedMessage> receivedMessages) {
List<... | 3.26 |
hudi_HoodieTableMetaserverClient_getTableType_rdh | /**
*
* @return Hoodie Table Type
*/
public HoodieTableType getTableType()
{
return HoodieTableType.valueOf(table.getTableType());
} | 3.26 |
hudi_HoodieTableMetaserverClient_getActiveTimeline_rdh | /**
* Get the active instants as a timeline.
*
* @return Active instants timeline
*/
public synchronized HoodieActiveTimeline getActiveTimeline() {
if (activeTimeline == null) {activeTimeline = new HoodieMetaserverBasedTimeline(this, metaserverConfig);
}
return activeTimeline;} | 3.26 |
hudi_HoodieTableMetaserverClient_reloadActiveTimeline_rdh | /**
* Reload ActiveTimeline.
*
* @return Active instants timeline
*/
public synchronized HoodieActiveTimeline reloadActiveTimeline() {
activeTimeline = new HoodieMetaserverBasedTimeline(this,
metaserverConfig);
return activeTimeline;
} | 3.26 |
hudi_HoodieKeyLookupHandle_getLookupResult_rdh | /**
* Of all the keys, that were added, return a list of keys that were actually found in the file group.
*/
public HoodieKeyLookupResult getLookupResult() {
if (LOG.isDebugEnabled()) {
LOG.debug((("#The candidate row keys for " + partitionPathFileIDPair) + " => ") + candidateRecordKeys);
}
Hoodi... | 3.26 |
hudi_HoodieKeyLookupHandle_addKey_rdh | /**
* Adds the key for look up.
*/
public void addKey(String recordKey) {
// check record key against bloom filter of current file & add to possible keys if needed
if (bloomFilter.mightContain(recordKey)) {
if (LOG.isDebugEnabled()) {
LOG.debug((("Record key " + recordKey) + " matches bloo... | 3.26 |
hudi_WriteMarkersFactory_get_rdh | /**
*
* @param markerType
* the type of markers to use
* @param table
* {@code HoodieTable} instance
* @param instantTime
* current instant time
* @return {@code WriteMarkers} instance based on the {@code MarkerType}
*/
public static WriteMarkers get(MarkerType markerType, HoodieTable table, String insta... | 3.26 |
hudi_HoodieRealtimeRecordReaderUtils_arrayWritableToString_rdh | /**
* Prints a JSON representation of the ArrayWritable for easier debuggability.
*/
public static String arrayWritableToString(ArrayWritable writable) {
if (writable == null) {
return "null";
}
Random random = new
Random(2);
StringBuilder builder = new
StringBuilder();
Writable[] ... | 3.26 |
hudi_HoodieRealtimeRecordReaderUtils_avroToArrayWritable_rdh | /**
* Convert the projected read from delta record into an array writable.
*/
public static Writable avroToArrayWritable(Object value, Schema schema) {
return avroToArrayWritable(value, schema, false);
} | 3.26 |
hudi_HoodieRealtimeRecordReaderUtils_generateProjectionSchema_rdh | /**
* Generate a reader schema off the provided writeSchema, to just project out the provided columns.
*/
public static Schema generateProjectionSchema(Schema writeSchema, Map<String, Schema.Field> schemaFieldsMap, List<String> fieldNames) {
/**
* Avro & Presto field names seems to be case sensitive (suppor... | 3.26 |
hudi_HoodieRealtimeRecordReaderUtils_m0_rdh | /**
* get the max compaction memory in bytes from JobConf.
*/
public static long m0(JobConf jobConf) {
// jobConf.getMemoryForMapTask() returns in MB
return ((long) (Math.ceil(((Double.parseDouble(ConfigUtils.getRawValueWithAltKeys(jobConf, HoodieMemoryConfig.MAX_MEMORY_FRACTION_FOR_COMPACTION).orElse(Hoodie... | 3.26 |
hudi_HoodieRealtimeRecordReaderUtils_addPartitionFields_rdh | /**
* Hive implementation of ParquetRecordReader results in partition columns not present in the original parquet file to
* also be part of the projected schema. Hive expects the record reader implementation to return the row in its
* entirety (with un-projected column having null values). As we use writerSchema for... | 3.26 |
hudi_FileSystemViewCommand_buildFileSystemView_rdh | /**
* Build File System View.
*
* @param globRegex
* Path Regex
* @param maxInstant
* Max Instants to be used for displaying file-instants
* @param basefileOnly
* Include only base file view
* @param includeMaxInstant
* Include Max instant
* @param includeInflight
* Include inflight instants
* @p... | 3.26 |
hudi_CollectionUtils_zipToMap_rdh | /**
* Zip two lists into a Map. Will throw Exception if the size is different between these two lists.
*/
public static <K, V> Map<K, V> zipToMap(List<K> keys, List<V> values) {
checkArgument(keys.size() == values.size(), "keys' size must be equal with the values' size");
return IntStream.range(0, keys.size(... | 3.26 |
hudi_CollectionUtils_elementsEqual_rdh | /**
* Determines whether two iterators contain equal elements in the same order. More specifically,
* this method returns {@code true} if {@code iterator1} and {@code iterator2} contain the same
* number of elements and every element of {@code iterator1} is equal to the corresponding element
* of {@code iterator2}.... | 3.26 |
hudi_CollectionUtils_toStream_rdh | /**
* Collects provided {@link Iterator} to a {@link Stream}
*/
public static <T> Stream<T> toStream(Iterator<T> iterator) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false);
} | 3.26 |
hudi_CollectionUtils_combine_rdh | /**
* Combines provided {@link Map}s into one, returning new instance of {@link HashMap}.
*
* NOTE: That values associated with overlapping keys from the second map, will override
* values from the first one
*/
public static <K, V> HashMap<K, V> combine(Map<K, V> one, Map<K, V>
another, BiFunction<V, V, V> m... | 3.26 |
hudi_CollectionUtils_m0_rdh | /**
* Combines provided array and an element into a new array
*/
@SuppressWarnings("unchecked")
public static <T> T[] m0(T[] array, T elem) {
T[] combined = ((T[]) (Array.newInstance(array.getClass().getComponentType(), array.length + 1)));
System.arraycopy(array, 0, combined, 0, array.length);
combined[a... | 3.26 |
hudi_CollectionUtils_copy_rdh | /**
* Makes a copy of provided {@link Properties} object
*/
public static Properties copy(Properties props) {Properties copy = new Properties();
copy.putAll(props);
return copy;
} | 3.26 |
hudi_CollectionUtils_reduce_rdh | /**
* Reduces provided {@link Collection} using provided {@code reducer} applied to
* every element of the collection like following
*
* {@code reduce(reduce(reduce(identity, e1), e2), ...)}
*
* @param c
* target collection to be reduced
* @param identity
* element for reducing to start from
* @param redu... | 3.26 |
hudi_CollectionUtils_emptyProps_rdh | /**
* Returns an empty {@code Properties} instance. The props instance is a singleton,
* it should not be modified in any case.
*/
public static Properties emptyProps() {
return EMPTY_PROPERTIES;
} | 3.26 |
hudi_CollectionUtils_tail_rdh | /**
* Returns last element of the array of {@code T}
*/
public static <T>
T tail(T[] ts) {
checkArgument(ts.length > 0);
return ts[ts.length - 1];
} | 3.26 |
hudi_CollectionUtils_diff_rdh | /**
* Returns difference b/w {@code one} {@link List} of elements and {@code another}
*
* NOTE: This is less optimal counterpart to {@link #diff(Collection, Collection)}, accepting {@link List}
* as a holding collection to support duplicate elements use-cases
*/
public static <E> List<E> diff(Collection<E> ... | 3.26 |
hudi_CollectionUtils_diffSet_rdh | /**
* Returns difference b/w {@code one} {@link Collection} of elements and {@code another}
* The elements in collection {@code one} are also duplicated and returned as a {@link Set}.
*/public static <E> Set<E> diffSet(Collection<E> one, Set<E> another) {
Set<E> diff = new HashSet<>(one);
diff.removeAll(ano... | 3.26 |
hudi_WriteOperationType_m0_rdh | /**
* Whether the operation changes the dataset.
*/public
static boolean m0(WriteOperationType operation) {
return (((((((((operation == WriteOperationType.INSERT) || (operation == WriteOperationType.UPSERT)) || (operation == WriteOperationType.UPSERT_PREPPED)) || (operation == WriteOperationType.DELETE)) || (... | 3.26 |
hudi_WriteOperationType_fromValue_rdh | /**
* Convert string value to WriteOperationType.
*/
public static WriteOperationType fromValue(String value) {
switch (value.toLowerCase(Locale.ROOT)) {
case "insert" :
return INSERT;
case "insert_prepped" :
return INSERT_PREPPED;
case "upsert" :
return... | 3.26 |
hudi_WriteOperationType_value_rdh | /**
* Getter for value.
*
* @return string form of WriteOperationType
*/
public String value() {
return value;
} | 3.26 |
hudi_KafkaConnectHdfsProvider_buildCheckpointStr_rdh | /**
* Convert map contains max offset of each partition to string.
*
* @param topic
* Topic name
* @param checkpoint
* Map with partition as key and max offset as value
* @return Checkpoint string
*/
private static String buildCheckpointStr(final String
topic, final HashMap<Integer, Integer> checkpoint) {
... | 3.26 |
hudi_KafkaConnectHdfsProvider_listAllFileStatus_rdh | /**
* List file status recursively.
*
* @param curPath
* Current Path
* @param filter
* PathFilter
* @return All file status match kafka connect naming convention
* @throws IOException
*/
private ArrayList<FileStatus> listAllFileStatus(Path curPath, KafkaConnectP... | 3.26 |
hudi_HoodieRecordUtils_createRecordMerger_rdh | /**
* Instantiate a given class with a record merge.
*/
public static HoodieRecordMerger createRecordMerger(String basePath, EngineType engineType, List<String> mergerClassList, String recordMergerStrategy) {
if (mergerClassList.isEmpty() || HoodieTableMetadata.isMetadataTable(basePath)) {
... | 3.26 |
hudi_HoodieRecordUtils_loadRecordMerger_rdh | /**
* Instantiate a given class with a record merge.
*/
public static HoodieRecordMerger loadRecordMerger(String mergerClass) {
try {
HoodieRecordMerger recordMerger = ((HoodieRecordMerger) (INSTANCE_CACHE.get(mergerClass)));
if (null == recordMerger) {synchronized(HoodieRecordMerger.class) {
... | 3.26 |
hudi_S3EventsSource_fetchNextBatch_rdh | /**
* Fetches next events from the queue.
*
* @param lastCkptStr
* The last checkpoint instant string, empty if first run.
* @param sourceLimit
* Limit on the size of data to fetch. For {@link S3EventsSource},
* {@link S3SourceConfig#S3_SOURCE_QUEUE_MAX_MESSAGES_PER_BATCH} is used.
* @return A pair of dat... | 3.26 |
hudi_HoodieTableFileSystemView_fetchLatestFileSlicesIncludingInflight_rdh | /**
* Get the latest file slices for a given partition including the inflight ones.
*
* @param partitionPath
* @return Stream of latest {@link FileSlice} in the partition path.
*/public Stream<FileSlice> fetchLatestFileSlicesIncludingInflight(String partitionPath) {
return fetchAllStoredFileGroups(partitionPa... | 3.26 |
hudi_HoodieTableFileSystemView_readObject_rdh | /**
* This method is only used when this object is deserialized in a spark executor.
*
* @deprecated */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
} | 3.26 |
hudi_JdbcSource_m0_rdh | /**
* Does a full scan on the RDBMS data source.
*
* @return The {@link Dataset} after running full scan.
*/
private Dataset<Row> m0(long sourceLimit) {
final String ppdQuery = "(%s) rdbms_table";
final SqlQueryBuilder queryBuilder = SqlQueryBuilder.select("*").from(getStringWithAltKeys(props, JdbcSourceCon... | 3.26 |
hudi_JdbcSource_fetch_rdh | /**
* Decide to do a full RDBMS table scan or an incremental scan based on the lastCkptStr. If previous checkpoint
* value exists then we do an incremental scan with a PPD query or else we do a full scan. In certain cases where the
* incremental query fails, we fallback to a full scan.
*
* @param lastCkptStr
* ... | 3.26 |
hudi_JdbcSource_addExtraJdbcOptions_rdh | /**
* Accepts spark JDBC options from the user in terms of EXTRA_OPTIONS adds them to {@link DataFrameReader} Example: In
* a normal spark code you would do something like: session.read.format('jdbc') .option(fetchSize,1000)
* .option(timestampFormat,"yyyy-mm-dd hh:mm:ss")
* <p>
* The way to pass these properties ... | 3.26 |
hudi_JdbcSource_incrementalFetch_rdh | /**
* Does an incremental scan with PPQ query prepared on the bases of previous checkpoint.
*
* @param lastCheckpoint
* Last checkpoint.
* Note that the records fetched will be exclusive of the last checkpoint (i.e. incremental column value > lastCheckpoint).
* @return The {@link Dataset} after incremental fe... | 3.26 |
hudi_SimpleExecutor_execute_rdh | /**
* Consuming records from input iterator directly without any producers and inner message queue.
*/
@Override
public E execute() {
try {
LOG.info("Starting consumer, consuming records from the records iterator directly");
while (itr.hasNext()) {
O payload = transformFunction.apply(... | 3.26 |
hudi_BloomIndexFileInfo_isKeyInRange_rdh | /**
* Does the given key fall within the range (inclusive).
*/
public boolean isKeyInRange(String recordKey) {
return (Objects.requireNonNull(f0).compareTo(recordKey) <= 0) && (Objects.requireNonNull(maxRecordKey).compareTo(recordKey) >= 0);
} | 3.26 |
hudi_HoodieCDCLogRecordIterator_closeReader_rdh | // -------------------------------------------------------------------------
// Utilities
// -------------------------------------------------------------------------
private void closeReader() throws IOException {
if (reader != null) {
reader.close();
reader = null;
}
} | 3.26 |
hudi_SanitizationUtils_parseSanitizedAvroSchemaNoThrow_rdh | /**
* Sanitizes illegal field names in the schema using recursive calls to transformMap and transformList
*/
private static Option<Schema>
parseSanitizedAvroSchemaNoThrow(String schemaStr, String invalidCharMask) {
try {
OM.enable(JsonParser.Feature.ALLOW_COMMENTS);
Map<String, Object> objMap = OM.readValue(s... | 3.26 |
hudi_SanitizationUtils_sanitizeStructTypeForAvro_rdh | // TODO(HUDI-5256): Refactor this to use InternalSchema when it is ready.
private static StructType sanitizeStructTypeForAvro(StructType structType, String invalidCharMask) {
StructType sanitizedStructType = new StructType();
StructField[] structFields = structType.fields();
for (StructField s : structFields) {
Da... | 3.26 |
hudi_SanitizationUtils_transformList_rdh | /**
* Parse list for sanitizing
*
* @param src
* - deserialized schema
* @param invalidCharMask
* - mask to replace invalid characters with
*/
private static List<Object> transformList(List<Object> src, String invalidCharMask)
{
return src.stream().map(obj -> {
if (obj instanceof List) {
retur... | 3.26 |
hudi_SanitizationUtils_transformMap_rdh | /**
* Parse map for sanitizing. If we have a string in the map, and it is an avro field name key, then we sanitize the name.
* Otherwise, we keep recursively going through the schema.
*
* @param src
* - deserialized schema
* @param invalidCharMask
* - mask to replace invalid characters with
*/
private stati... | 3.26 |
hudi_HiveMetastoreBasedLockProvider_acquireLock_rdh | // This API is exposed for tests and not intended to be used elsewhere
public boolean acquireLock(long time, TimeUnit unit, final LockComponent component) throws InterruptedException, ExecutionException, TimeoutException, TException {
ValidationUtils.checkArgument(this.lock == null, ALREADY_ACQUIRED.name());
acquireLo... | 3.26 |
hudi_HiveMetastoreBasedLockProvider_close_rdh | // NOTE: HiveMetastoreClient does not implement AutoCloseable. Additionally, we cannot call close() after unlock()
// because if there are multiple operations started from the same WriteClient (via multiple threads), closing the
// hive client causes all other threads who may have already initiated the tryLock() to fai... | 3.26 |
hudi_HoodieCatalogUtil_inferPartitionPath_rdh | /**
* Returns the partition path with given {@link CatalogPartitionSpec}.
*/
public static String inferPartitionPath(boolean hiveStylePartitioning, CatalogPartitionSpec
catalogPartitionSpec) {
return catalogPartitionSpec.getPartitionSpec().entrySet().stream().map(entry -> hiveStylePartitioning ? String.format("%s... | 3.26 |
hudi_HoodieCatalogUtil_createHiveConf_rdh | /**
* Returns a new {@code HiveConf}.
*
* @param hiveConfDir
* Hive conf directory path.
* @return A HiveConf instance.
*/
public static HiveConf createHiveConf(@Nullable
String hiveConfDir, Configuration flinkConf) {
// create HiveConf from hadoop configuration with hadoop conf directory configured.
C... | 3.26 |
hudi_HoodieCatalogUtil_isEmbeddedMetastore_rdh | /**
* Check whether the hive.metastore.uris is empty
*/
public static boolean isEmbeddedMetastore(HiveConf hiveConf) {
return isNullOrWhitespaceOnly(hiveConf.getVar(ConfVars.METASTOREURIS));
} | 3.26 |
hudi_HoodieCatalogUtil_getPartitionKeys_rdh | /**
* Returns the partition key list with given table.
*/
public static List<String> getPartitionKeys(CatalogTable table) {
// the PARTITIONED BY syntax always has higher priority than option FlinkOptions#PARTITION_PATH_FIELD
if
(table.isPartitioned()) {return table.getPartitionKeys();
} else if (ta... | 3.26 |
hudi_HoodieCatalogUtil_getOrderedPartitionValues_rdh | /**
* Returns a list of ordered partition values by re-arranging them based on the given list of
* partition keys. If the partition value is null, it'll be converted into default partition
* name.
*
* @param partitionSpec
* The partition spec
* @param partitionKeys
* The partition keys
* @param tablePath
... | 3.26 |
hudi_OpenJ9MemoryLayoutSpecification64bitCompressed_getArrayHeaderSize_rdh | /**
* Implementation of {@link MemoryLayoutSpecification} based on
* OpenJ9 Memory Layout Specification on 64-bit compressed.
*/public class OpenJ9MemoryLayoutSpecification64bitCompressed implements MemoryLayoutSpecification {
@Override
public int getArrayHeaderSize() {
return 16;
} | 3.26 |
hudi_HoodieRealtimeInputFormatUtils_addProjectionField_rdh | /**
* Add a field to the existing fields projected.
*/
private static Configuration addProjectionField(Configuration conf, String fieldName, int fieldIndex) {
String readColNames = conf.get(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR, "");
String readColIds = conf.get(ColumnProjectionUtils.READ_COLUMN_I... | 3.26 |
hudi_HoodieRealtimeInputFormatUtils_cleanProjectionColumnIds_rdh | /**
* Hive will append read columns' ids to old columns' ids during getRecordReader. In some cases, e.g. SELECT COUNT(*),
* the read columns' id is an empty string and Hive will combine it with Hoodie required projection ids and becomes
* e.g. ",2,0,3" and will cause an error. Actually this method is a temporary sol... | 3.26 |
hudi_RocksDbBasedFileSystemView_applyDeltaFileSlicesToPartitionView_rdh | /* This is overridden to incrementally apply file-slices to rocks DB */
@Override
protected void applyDeltaFileSlicesToPartitionView(String partition, List<HoodieFileGroup> deltaFileGroups, DeltaApplyMode mode) {
rocksDB.writeBatch(batch -> deltaFileGroups.forEach(fg -> fg.getAllRawFileSlices().map... | 3.26 |
hudi_HoodieCompactor_validateRunningMode_rdh | // make sure that cfg.runningMode couldn't be null
private static void validateRunningMode(Config cfg) {
// --mode has a higher priority than --schedule
// If we remove --schedule option in the future we need to change runningMode default value to EXECUTE
if (StringUtils.isNullOrEmpty(cfg.runningMode)) {
... | 3.26 |
hudi_AvroInternalSchemaConverter_nullableSchema_rdh | /**
* Returns schema with nullable true.
*/
public static Schema nullableSchema(Schema schema) {
if (schema.getType()
== UNION) {if (!isOptional(schema)) {
throw new HoodieSchemaException(String.format("Union schemas are not supported: %s", schema));
}
return schema;
} else {... | 3.26 |
hudi_AvroInternalSchemaConverter_visitInternalPrimitiveToBuildAvroPrimitiveType_rdh | /**
* Converts hudi PrimitiveType to Avro PrimitiveType.
* this is auxiliary function used by visitInternalSchemaToBuildAvroSchema
*/
private static Schema visitInternalPrimitiveToBuildAvroPrimitiveType(Type.PrimitiveType primitive, String recordName) {
switch (primitive.typeId()) {
case BOOLEAN :
return... | 3.26 |
hudi_AvroInternalSchemaConverter_computeMinBytesForPrecision_rdh | /**
* Return the minimum number of bytes needed to store a decimal with a give 'precision'.
* reference from Spark release 3.1 .
*/
private static int computeMinBytesForPrecision(int precision) {
int numBytes = 1;
while (Math.pow(2.0, (8 * numBytes) - 1) < Math.pow(10.0, precision)) {
numBytes += 1;
}
... | 3.26 |
hudi_AvroInternalSchemaConverter_buildAvroSchemaFromType_rdh | /**
* Converts hudi type into an Avro Schema.
*
* @param type
* a hudi type.
* @param recordName
* the record name
* @return a Avro schema match this type
*/
public static Schema buildAvroSchemaFromType(Type type, String recordName)
{
Map<Type, Schema> cache
= new HashMap<>(); return visitInternalSchemaToB... | 3.26 |
hudi_AvroInternalSchemaConverter_visitInternalMapToBuildAvroMap_rdh | /**
* Converts hudi MapType to Avro MapType.
* this is auxiliary function used by visitInternalSchemaToBuildAvroSchema
*/
private static Schema visitInternalMapToBuildAvroMap(Types.MapType map, Schema keySchema, Schema valueSchema) { Schema
mapSchema;
if (keySchema.getType() == Type.STRING) {
mapSchema = Schema... | 3.26 |
hudi_AvroInternalSchemaConverter_visitInternalSchemaToBuildAvroSchema_rdh | /**
* Converts hudi type into an Avro Schema.
*
* @param type
* a hudi type.
* @param cache
* use to cache intermediate convert result to save cost.
* @param recordName
* auto-generated record name used as a fallback, in case
* {@link org.apache.hudi.internal.schema.Types.RecordType} doesn't bear origi... | 3.26 |
hudi_AvroInternalSchemaConverter_buildAvroSchemaFromInternalSchema_rdh | /**
* Converts hudi internal Schema into an Avro Schema.
*
* @param schema
* a hudi internal Schema.
* @param recordName
* the record name
* @return a Avro schema match hudi internal schema.
*/
public static Schema buildAvroSchemaFromInternalSchema(InternalSchema schema, String recordName) {
Map<Type, Sch... | 3.26 |
hudi_AvroInternalSchemaConverter_visitInternalRecordToBuildAvroRecord_rdh | /**
* Converts hudi RecordType to Avro RecordType.
* this is auxiliary function used by visitInternalSchemaToBuildAvroSchema
*/
private static Schema visitInternalRecordToBuildAvroRecord(Types.RecordType recordType, List<Schema> fieldSchemas, String recordNameFallback)
{
List<Types.Field> fields = recordType.fields(... | 3.26 |
hudi_AvroInternalSchemaConverter_isOptional_rdh | /**
* Check whether current avro schema is optional?.
*/
public static boolean isOptional(Schema schema) {
if ((schema.getType() == UNION) && (schema.getTypes().size() == 2)) {
return (schema.getTypes().get(0).getType() == Type.NULL) || (schema.getTypes().get(1).getType() == Type.NULL);
}
ret... | 3.26 |
hudi_AvroInternalSchemaConverter_convert_rdh | /**
* Convert an avro schema into internalSchema.
*/
public static InternalSchema convert(Schema schema) {
return new InternalSchema(((Types.RecordType) (convertToField(schema))));
} | 3.26 |
hudi_AvroInternalSchemaConverter_visitInternalArrayToBuildAvroArray_rdh | /**
* Converts hudi ArrayType to Avro ArrayType.
* this is auxiliary function used by visitInternalSchemaToBuildAvroSchema
*/
private static Schema visitInternalArrayToBuildAvroArray(Types.ArrayType array, Schema elementSchema) {
Schema result;
if (array.isElementOptional()) {
result = Schema.createArray(AvroInt... | 3.26 |
hudi_AvroInternalSchemaConverter_fixNullOrdering_rdh | /**
* Converting from avro -> internal schema -> avro
* causes null to always be first in unions.
* if we compare a schema that has not been converted to internal schema
* at any stage, the difference in ordering can cause issues. To resolve this,
* we order null to be first for any avro schema that enters into hu... | 3.26 |
hudi_AvroInternalSchemaConverter_convertToField_rdh | /**
* Convert an avro schema into internal type.
*/
public static Type convertToField(Schema schema) {
return buildTypeFromAvroSchema(schema);
} | 3.26 |
hudi_JenkinsHash_main_rdh | /**
* Compute the hash of the specified file
*
* @param args
* name of file to compute hash of.
* @throws IOException
*/
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: JenkinsHash filename");
System.exit(-1);
}
try (Fi... | 3.26 |
hudi_HoodieConfig_setDefaultValue_rdh | /**
* Sets the default value of a config if user does not set it already.
* The default value can only be set if the config property has a built-in
* default value or an infer function. When the infer function is present,
* the infer function is used first to derive the config value based on other
* configs. If ... | 3.26 |
hudi_HoodieTablePreCommitFileSystemView_getLatestBaseFiles_rdh | /**
* Combine committed base files + new files created/replaced for given partition.
*/
public final Stream<HoodieBaseFile> getLatestBaseFiles(String partitionStr) {
// get fileIds replaced by current inflight commit
List<String> replacedFileIdsForPartition = partitionToReplaceFileIds.getOrDefault(partitionS... | 3.26 |
hudi_FileStatusUtils_safeReadAndSetMetadata_rdh | /**
* Used to safely handle FileStatus calls which might fail on some FileSystem implementation.
* (DeprecatedLocalFileSystem)
*/
private static void safeReadAndSetMetadata(HoodieFileStatus fStatus, FileStatus fileStatus) {
try {
fStatus.setOwner(fileStatus.getOwner());
fStatus.setGroup(fileStatu... | 3.26 |
hudi_BaseRollbackPlanActionExecutor_requestRollback_rdh | /**
* Creates a Rollback plan if there are files to be rolled back and stores them in instant file.
* Rollback Plan contains absolute file paths.
*
* @param startRollbackTime
* Rollback Instant Time
* @return Rollback Plan if generated
*/
protected Option<HoodieRollbackPlan> requestRollback(String startRollba... | 3.26 |
hudi_BaseRollbackPlanActionExecutor_getRollbackStrategy_rdh | /**
* Fetch the Rollback strategy used.
*
* @return */
private BaseRollbackPlanActionExecutor.RollbackStrategy getRollbackStrategy() {
if (shouldRollbackUsingMarkers) {
return new
MarkerBasedRollbackStrategy(table, context, config, instantTime);
} else {
return new ListingBasedRollba... | 3.26 |
hudi_ValidateNode_execute_rdh | /**
* Method to start the validate operation. Exceptions will be thrown if its parent nodes exist and WAIT_FOR_PARENTS
* was set to true or default, but the parent nodes have not completed yet.
*
* @param executionContext
* Context to execute this node
* @param curItrCount
* current iteration count.
*/
@Ove... | 3.26 |
hudi_KeyRangeNode_addFiles_rdh | /**
* Adds a new file name list to existing list of file names.
*
* @param newFiles
* {@link List} of file names to be added
*/
void addFiles(List<String> newFiles) {
this.fileNameList.addAll(newFiles);
} | 3.26 |
hudi_HoodieConsistentBucketIndex_rollbackCommit_rdh | /**
* Do nothing.
* A failed write may create a hashing metadata for a partition. In this case, we still do nothing when rolling back
* the failed write. Because the hashing metadata created by a writer must have 00000000000000 timestamp and can be viewed
* as the initialization of a partition rather than as a part... | 3.26 |
hudi_HoodieSortedMergeHandle_write_rdh | /**
* Go through an old record. Here if we detect a newer version shows up, we write the new one to the file.
*/
@Override
public void write(HoodieRecord oldRecord) {
Schema oldSchema = (config.populateMetaFields()) ?
writeSchemaWithMetaFields : writeSchema;
Schema newSchema = (useWriterSchemaForCompactio... | 3.26 |
hudi_HoodieLogFileReader_getFSDataInputStreamForGCS_rdh | /**
* GCS FileSystem needs some special handling for seek and hence this method assists to fetch the right {@link FSDataInputStream} to be
* used by wrapping with required input streams.
*
* @param fsDataInputStream
* original instance of {@link FSDataInputStream}.
* @param bufferSize
* buffer size to be use... | 3.26 |
hudi_HoodieLogFileReader_hasPrev_rdh | /**
* hasPrev is not idempotent.
*/
@Override
public boolean hasPrev() {
try {
if (!this.reverseReader) {
throw new HoodieNotSupportedException("Reverse log reader has not been enabled");
}
reverseLogFilePosition = lastReverseLogFilePosition;
reverseLogFilePosition -=
... | 3.26 |
hudi_HoodieLogFileReader_readBlock_rdh | // TODO : convert content and block length to long by using ByteBuffer, raw byte [] allows
// for max of Integer size
private HoodieLogBlock readBlock() throws IOException {
int blockSize;
long blockStartPos = inputStream.getPos();
try {
// 1 Read the total size of the block
blockSize = ((int) (inputStream.r... | 3.26 |
hudi_HoodieLogFileReader_readVersion_rdh | /**
* Read log format version from log file.
*/
private LogFormatVersion readVersion() throws IOException {
return new HoodieLogFormatVersion(inputStream.readInt());
} | 3.26 |
hudi_HoodieLogFileReader_addShutDownHook_rdh | /**
* Close the inputstream if not closed when the JVM exits.
*/
private void addShutDownHook() {
shutdownThread = new Thread(() -> {
try {
close();
} catch (Exception e) {
LOG.warn("unable to close input stream for log file " + logFile, e);
// fail sil... | 3.26 |
hudi_HoodieLogFileReader_moveToPrev_rdh | /**
* Reverse pointer, does not read the block. Return the current position of the log file (in reverse) If the pointer
* (inputstream) is moved in any way, it is the job of the client of this class to seek/reset it back to the file
* position returned from the method to expect correct results
*/
public long moveTo... | 3.26 |
hudi_HoodieLogFileReader_hasNext_rdh | /* hasNext is not idempotent. TODO - Fix this. It is okay for now - PR */
@Override
public boolean hasNext() {
try {
return readMagic();
} catch (IOException e) {
throw new HoodieIOException("IOException when reading logfile " + logFile, e);
}
} | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.