name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
hudi_ZeroToOneUpgradeHandler_getFileNameForMarkerFromLogFile_rdh
/** * Curates file name for marker from existing log file path. * log file format : partitionpath/.fileid_baseInstant.log.writetoken * marker file format : partitionpath/fileId_writetoken_baseinstant.basefileExtn.marker.APPEND * * @param logFilePath * log file path for which marker file name needs to be ge...
3.26
hudi_ZeroToOneUpgradeHandler_recreateMarkers_rdh
/** * Recreate markers in new format. * Step1: Delete existing markers * Step2: Collect all rollback file info. * Step3: recreate markers for all interested files. * * @param commitInstantTime * instant of interest for which markers need to be recreated. * @param table * instance of {@link HoodieTable} to ...
3.26
hudi_HoodieWriteHandle_createMarkerFile_rdh
/** * Creates an empty marker file corresponding to storage writer path. * * @param partitionPath * Partition path */ protected void createMarkerFile(String partitionPath, String dataFileName) { WriteMarkersFactory.get(config.getMarkersType(), hoodieTable, instantTime).create(partitionPath, dataFileName, get...
3.26
hudi_HoodieWriteHandle_doWrite_rdh
/** * Perform the actual writing of the given record into the backing file. */ protected void doWrite(HoodieRecord record, Schema schema, TypedProperties props) { // NO_OP }
3.26
hudi_HoodieWriteHandle_canWrite_rdh
/** * Determines whether we can accept the incoming records, into the current file. Depending on * <p> * - Whether it belongs to the same partitionPath as existing records - Whether the current file written bytes lt max * file size */ public boolean canWrite(HoodieRecord record) { return false; }
3.26
hudi_HoodieWriteHandle_makeNewFilePath_rdh
/** * Make new file path with given file name. */ protected Path makeNewFilePath(String partitionPath, String fileName) { String relativePath = new Path((partitionPath.isEmpty() ? "" : partitionPath + "/") + fileName).toString(); return new Path(config.getBasePath(), relativePath); }
3.26
hudi_HoodieWriteHandle_write_rdh
/** * Perform the actual writing of the given record into the backing file. */ public void write(HoodieRecord record, Schema schema, TypedProperties props) { doWrite(record, schema, props); }
3.26
hudi_HoodieWriteHandle_makeWriteToken_rdh
/** * Generate a write token based on the currently running spark task and its place in the spark dag. */ private String makeWriteToken() { return FSUtils.makeWriteToken(getPartitionId(), getStageId(), getAttemptId()); }
3.26
hudi_HoodieWriteHandle_getLogCreationCallback_rdh
/** * Returns a log creation hook impl. */ protected LogFileCreationCallback getLogCreationCallback() { return new LogFileCreationCallback() { @Override public boolean preFileCreation(HoodieLogFile logFile) { WriteMarkers writeMarkers = WriteMarkersFactory.get(config.getMarkersType(), hoodieTable, ins...
3.26
hudi_BootstrapExecutor_syncHive_rdh
/** * Sync to Hive. */ private void syncHive() { if (cfg.enableHiveSync || cfg.enableMetaSync) { TypedProperties metaProps = new TypedProperties(); metaProps.putAll(props); metaProps.put(META_SYNC_BASE_PATH.key(), cfg.targetBasePath); metaProps.put(META_SYNC_BASE_FILE_FORMAT.key(),...
3.26
hudi_RollbackNode_execute_rdh
/** * Method helps to rollback the last commit instant in the timeline, if it has one. * * @param executionContext * Execution context to perform this rollback * @param curItrCount * current iteration count. * @throws Exception * will be thrown if any error occurred */ @Override public void execute(Exec...
3.26
hudi_OptionsResolver_isInsertOperation_rdh
/** * Returns whether the table operation is 'insert'. */ public static boolean isInsertOperation(Configuration conf) { WriteOperationType operationType = WriteOperationType.fromValue(conf.getString(FlinkOptions.OPERATION)); return operationType == WriteOperationType.INSERT; }
3.26
hudi_OptionsResolver_isSchemaEvolutionEnabled_rdh
/** * Returns whether comprehensive schema evolution enabled. */ public static boolean isSchemaEvolutionEnabled(Configuration conf) { return conf.getBoolean(HoodieCommonConfig.SCHEMA_EVOLUTION_ENABLE.key(), HoodieCommonConfig.SCHEMA_EVOLUTION_ENABLE.defaultValue()); }
3.26
hudi_OptionsResolver_insertClustering_rdh
/** * Returns whether insert clustering is allowed with given configuration {@code conf}. */ public static boolean insertClustering(Configuration conf) { return (isCowTable(conf) && isInsertOperation(conf)) && conf.getBoolean(FlinkOptions.INSERT_CLUSTER); }
3.26
hudi_OptionsResolver_m2_rdh
/** * Returns whether the query is incremental. */public static boolean m2(Configuration conf) { return conf.getOptional(FlinkOptions.READ_START_COMMIT).isPresent() || conf.getOptional(FlinkOptions.READ_END_COMMIT).isPresent(); }
3.26
hudi_OptionsResolver_needsAsyncCompaction_rdh
/** * Returns whether there is need to schedule the async compaction. * * @param conf * The flink configuration. */ public static boolean needsAsyncCompaction(Configuration conf) { return OptionsResolver.isMorTable(conf) && conf.getBoolean(FlinkOptions.COMPACTION_ASYNC_ENABLED); }
3.26
hudi_OptionsResolver_isMorTable_rdh
/** * Returns whether it is a MERGE_ON_READ table. */ public static boolean isMorTable(Map<String, String> options) { return options.getOrDefault(FlinkOptions.TABLE_TYPE.key(), FlinkOptions.TABLE_TYPE.defaultValue()).equalsIgnoreCase(FlinkOptions.TABLE_TYPE_MERGE_ON_READ); }
3.26
hudi_OptionsResolver_needsScheduleCompaction_rdh
/** * Returns whether there is need to schedule the compaction plan. * * @param conf * The flink configuration. */ public static boolean needsScheduleCompaction(Configuration conf) { return OptionsResolver.isMorTable(conf) && conf.getBoolean(FlinkOptions.COMPACTION_SCHEDULE_ENABLED); }
3.26
hudi_OptionsResolver_hasReadCommitsLimit_rdh
/** * Returns whether the read commits limit is specified. */ public static boolean hasReadCommitsLimit(Configuration conf) { return conf.contains(FlinkOptions.READ_COMMITS_LIMIT); }
3.26
hudi_OptionsResolver_allOptions_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- /** * Returns all the config options with the given class {@code clazz}. */ public static List<ConfigOption<?>> allOptions(Class<?> clazz) { Field[...
3.26
hudi_OptionsResolver_isReadByTxnCompletionTime_rdh
/** * Returns whether to read the instants using completion time. * * <p>A Hudi instant contains both the txn start time and completion time, for incremental subscription * of the source reader, using completion time to filter the candidate instants can avoid data loss * in scenarios like multiple writers. */ pub...
3.26
hudi_OptionsResolver_isSimpleBucketIndexType_rdh
/** * Returns whether the table index is simple bucket index. */ public static boolean isSimpleBucketIndexType(Configuration conf) { return isBucketIndexType(conf) && getBucketEngineType(conf).equals(BucketIndexEngineType.SIMPLE); }
3.26
hudi_OptionsResolver_isNonBlockingConcurrencyControl_rdh
/** * Returns whether this is non-blocking concurrency control. */ public static boolean isNonBlockingConcurrencyControl(Configuration config) { return WriteConcurrencyMode.isNonBlockingConcurrencyControl(config.getString(HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key(), HoodieWriteConfig.WRITE_CONCURRENCY_MODE.d...
3.26
hudi_OptionsResolver_isPartitionedTable_rdh
/** * Returns whether the table is partitioned. */ public static boolean isPartitionedTable(Configuration conf) { return FilePathUtils.extractPartitionKeys(conf).length > 0; }
3.26
hudi_OptionsResolver_isInsertOverwrite_rdh
/** * Returns whether the operation is INSERT OVERWRITE (table or partition). */ public static boolean isInsertOverwrite(Configuration conf) { return conf.getString(FlinkOptions.OPERATION).equalsIgnoreCase(WriteOperationType.INSERT_OVERWRITE_TABLE.value()) || conf.getString(FlinkOptions.OPERATION).equalsIgnoreCas...
3.26
hudi_OptionsResolver_isDeltaTimeCompaction_rdh
/** * Returns whether the compaction strategy is based on elapsed delta time. */ public static boolean isDeltaTimeCompaction(Configuration conf) { final String strategy = conf.getString(FlinkOptions.COMPACTION_TRIGGER_STRATEGY).toLowerCase(Locale.ROOT); return FlinkOptions.TIME_ELAPSED.equals(strategy) || Fl...
3.26
hudi_OptionsResolver_getIndexType_rdh
/** * Returns the index type. */ public static IndexType getIndexType(Configuration conf) { return HoodieIndex.IndexType.valueOf(conf.getString(FlinkOptions.INDEX_TYPE)); }
3.26
hudi_OptionsResolver_needsAsyncClustering_rdh
/** * Returns whether there is need to schedule the async clustering. * * @param conf * The flink configuration. */ public static boolean needsAsyncClustering(Configuration conf) { return isInsertOperation(conf) && conf.getBoolean(FlinkOptions.CLUSTERING_ASYNC_ENABLED); }
3.26
hudi_OptionsResolver_getIndexKeys_rdh
/** * Returns the index key field values. */ public static String[] getIndexKeys(Configuration conf) { return getIndexKeyField(conf).split(","); }
3.26
hudi_OptionsResolver_getDefaultPlanStrategyClassName_rdh
/** * Returns the default plan strategy class. */ public static String getDefaultPlanStrategyClassName(Configuration conf) { return OptionsResolver.m1(conf) ? FlinkConsistentBucketClusteringPlanStrategy.class.getName() : FlinkOptions.CLUSTERING_PLAN_STRATEGY_CLASS.defaultValue(); }
3.26
hudi_OptionsResolver_getConflictResolutionStrategy_rdh
/** * Returns the conflict resolution strategy. */ public static ConflictResolutionStrategy getConflictResolutionStrategy(Configuration conf) { return isBucketIndexType(conf) ? new BucketIndexConcurrentFileWritesConflictResolutionStrategy() : new SimpleConcurrentFileWritesConflictResolutionStrategy(); }
3.26
hudi_OptionsResolver_getIndexKeyField_rdh
/** * Returns the index key field. */ public static String getIndexKeyField(Configuration conf) { return conf.getString(FlinkOptions.INDEX_KEY_FIELD, conf.getString(FlinkOptions.RECORD_KEY_FIELD)); }
3.26
hudi_OptionsResolver_isBulkInsertOperation_rdh
/** * Returns whether the table operation is 'bulk_insert'. */ public static boolean isBulkInsertOperation(Configuration conf) { WriteOperationType operationType = WriteOperationType.fromValue(conf.getString(FlinkOptions.OPERATION)); return operationType == WriteOperationType.BULK_INSERT; }
3.26
hudi_OptionsResolver_sortClusteringEnabled_rdh
/** * Returns whether the clustering sort is enabled. */ public static boolean sortClusteringEnabled(Configuration conf) { return !StringUtils.isNullOrEmpty(conf.getString(FlinkOptions.CLUSTERING_SORT_COLUMNS)); }
3.26
hudi_OptionsResolver_getCDCSupplementalLoggingMode_rdh
/** * Returns the supplemental logging mode. */ public static HoodieCDCSupplementalLoggingMode getCDCSupplementalLoggingMode(Configuration conf) { String mode = conf.getString(FlinkOptions.SUPPLEMEN...
3.26
hudi_OptionsResolver_overwriteDynamicPartition_rdh
/** * Returns whether the operation is INSERT OVERWRITE dynamic partition. */ public static boolean overwriteDynamicPartition(Configuration conf) { return conf.getString(FlinkOptions.OPERATION).equalsIgnoreCase(WriteOperationType.INSERT_OVERWRITE.value()) || conf.getString(FlinkOptions.WRITE_PARTITION_OVERWRITE_M...
3.26
hudi_OptionsResolver_emitChangelog_rdh
/** * Returns whether the source should emit changelog. * * @return true if the source is read as streaming with changelog mode enabled */public static boolean emitChangelog(Configuration conf) { return ((conf.getBoolean(FlinkOptions.READ_AS_STREAMING) && conf.getBoolean(FlinkOptions.CHANGELOG_ENABLED)) || (co...
3.26
hudi_OptionsResolver_isCowTable_rdh
/** * Returns whether it is a COPY_ON_WRITE table. */ public static boolean isCowTable(Configuration conf) { return conf.getString(FlinkOptions.TABLE_TYPE).toUpperCase(Locale.ROOT).equals(FlinkOptions.TABLE_TYPE_COPY_ON_WRITE); }
3.26
hudi_OptionsResolver_isMultiWriter_rdh
/** * Returns whether multi-writer is enabled. */ public static boolean isMultiWriter(Configuration conf) { return WriteConcurrencyMode.supportsMultiWriter(conf.getString(HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key(), HoodieWriteConfig.WRITE_CONCURRENCY_MODE.defaultValue())); }
3.26
hudi_OptionsResolver_m1_rdh
/** * Returns whether the table index is consistent bucket index. */ public static boolean m1(Configuration conf) { return isBucketIndexType(conf) && getBucketEngineType(conf).equals(BucketIndexEngineType.CONSISTENT_HASHING); }
3.26
hudi_OptionsResolver_isLockRequired_rdh
/** * Returns whether the writer txn should be guarded by lock. */ public static boolean isLockRequired(Configuration conf) { return conf.getBoolean(FlinkOptions.METADATA_ENABLED) || isMultiWriter(conf); }
3.26
hudi_OptionsResolver_getPreCombineField_rdh
/** * Returns the preCombine field * or null if the value is set as {@link FlinkOptions#NO_PRE_COMBINE}. */ public static String getPreCombineField(Configuration conf) { final String preCombineField = conf.getString(FlinkOptions.PRECOMBINE_FIELD); return preCombineField.equals(FlinkOptions.NO_PRE_COMBINE...
3.26
hudi_OptionsResolver_isAppendMode_rdh
/** * Returns whether the insert is clustering disabled with given configuration {@code conf}. */public static boolean isAppendMode(Configuration conf) { // 1. inline clustering is supported for COW table; // 2. async clustering is supported for both COW and MOR table return isInsertOperation(conf) && ((i...
3.26
hudi_OptionsResolver_m0_rdh
/** * Returns whether the payload clazz is {@link DefaultHoodieRecordPayload}. */ public static boolean m0(Configuration conf) { return conf.getString(FlinkOptions.PAYLOAD_CLASS_NAME).contains(DefaultHoodieRecordPayload.class.getSimpleName()); }
3.26
hudi_OptionsResolver_isConsistentLogicalTimestampEnabled_rdh
/** * Returns whether consistent value will be generated for a logical timestamp type column. */ public static boolean isConsistentLogicalTimestampEnabled(Configuration conf) { return conf.getBoolean(KeyGeneratorOptions.KEYGENERATOR_CONSISTENT_LOGICAL_TIMESTAMP_ENABLED.key(), Boolean.parseBoolean(KeyGeneratorOpti...
3.26
hudi_HoodieMergedLogRecordScanner_newBuilder_rdh
/** * Returns the builder for {@code HoodieMergedLogRecordScanner}. */ public static HoodieMergedLogRecordScanner.Builder newBuilder() { return new Builder(); }
3.26
hudi_HoodieMergedLogRecordScanner_scanByKeyPrefixes_rdh
/** * Provides incremental scanning capability where only keys matching provided key-prefixes * will be looked up in the delta-log files, scanned and subsequently materialized into * the internal cache * * @param keyPrefixes * to be looked up */ public void scanByKeyPrefixes(List<String> keyPrefixes) { // ...
3.26
hudi_HoodieMergedLogRecordScanner_scanByFullKeys_rdh
/** * Provides incremental scanning capability where only provided keys will be looked * up in the delta-log files, scanned and subsequently materialized into the internal * cache * * @param keys * to be looked up */ public void scanByFullKeys(List<String> keys) { // We can skip scanning in case reader is ...
3.26
hudi_HoodieMergedLogRecordScanner_scan_rdh
/** * Scans delta-log files processing blocks */ public final void scan() { scan(false); }
3.26
hudi_HoodieMetadataFileSystemView_listPartition_rdh
/** * Return all the files in the partition by reading from the Metadata Table. * * @param partitionPath * The absolute path of the partition * @throws IOException */ @Override protected FileStatus[] listPartition(Path partitionPath) throws IOException { return tableMetadata.getAllFilesInPartition(partition...
3.26
hudi_ManifestFileWriter_writeManifestFile_rdh
/** * Write all the latest base file names to the manifest file. */ public synchronized void writeManifestFile(boolean useAbsolutePath) { try { List<String> baseFiles = fetchLatestBaseFilesForAllPartitions(metaClient, useFileListingFromMetadata, useAbsolutePath).collect(Collectors.toList()); if (b...
3.26
hudi_RowDataToHoodieFunction_toHoodieRecord_rdh
/** * Converts the give record to a {@link HoodieRecord}. * * @param record * The input record * @return HoodieRecord based on the configuration * @throws IOException * if error occurs */ @SuppressWarnings("rawtypes") private HoodieRecord toHoodieRecord(I record) ...
3.26
hudi_BaseRollbackHelper_deleteFiles_rdh
/** * Common method used for cleaning out files during rollback. */ protected List<HoodieRollbackStat> deleteFiles(HoodieTableMetaClient metaClient, List<String> filesToBeDeleted, boolean doDelete) throws IOException { return filesToBeDeleted.stream().map(fileToDelete -> { String basePath = metaClient.getBasePat...
3.26
hudi_BaseRollbackHelper_maybeDeleteAndCollectStats_rdh
/** * May be delete interested files and collect stats or collect stats only. * * @param context * instance of {@link HoodieEngineContext} to use. * @param instantToRollback * {@link HoodieInstant} of interest for which deletion or collect stats is requested. * @param rollback...
3.26
hudi_BaseRollbackHelper_collectRollbackStats_rdh
/** * Collect all file info that needs to be rolled back. */ public List<HoodieRollbackStat> collectRollbackStats(HoodieEngineContext context, HoodieInstant instantToRollback, List<HoodieRollbackRequest> rollbackRequests) { int parallelism = Math.max(Math.min(rollbackRequests.size(), config.getRollbackParallelism...
3.26
hudi_HoodieBackedTableMetadata_getOrCreateReaders_rdh
/** * Create a file reader and the record scanner for a given partition and file slice * if readers are not already available. * * @param partitionName * - Partition name * @param slice * - The file slice to open readers for * @return File reader and the record scanner pair for the requested file slice */ ...
3.26
hudi_HoodieBackedTableMetadata_closePartitionReaders_rdh
/** * Close and clear all the partitions readers. */ private void closePartitionReaders() { for (Pair<String, String> partitionFileSlicePair : partitionReaders.get().keySet()) { close(partitionFileSlicePair); } partitionReaders.get().clear(); }
3.26
hudi_HoodieBackedTableMetadata_lookupKeysFromFileSlice_rdh
/** * Lookup list of keys from a single file slice. * * @param partitionName * Name of the partition * @param keys * The list of keys to lookup * @param fileSlice * The file slice to read * @return A {@code Map} of key name to {@code HoodieRecord} for the keys which were found in the file slice */ priva...
3.26
hudi_HoodieBackedTableMetadata_close_rdh
/** * Close the file reader and the record scanner for the given file slice. * * @param partitionFileSlicePair * - Partition and FileSlice */private synchronized void close(Pair<String, String> partitionFileSlicePair) { Pair<HoodieSeekingFileReader<?>, HoodieMetadataLogRecordRead...
3.26
hudi_HiveQueryDDLExecutor_getTableSchema_rdh
// TODO Duplicating it here from HMSDLExecutor as HiveQueryQL has no way of doing it on its own currently. Need to refactor it @Override public Map<String, String> getTableSchema(String tableName) { try { // HiveMetastoreClient returns partition keys separate from Columns, hence get both and merge to ...
3.26
hudi_SparkHoodieMetadataBulkInsertPartitioner_repartitionRecords_rdh
/** * Partition the records by their location. The number of partitions is determined by the number of MDT fileGroups being udpated rather than the * specific value of outputSparkPartitions. */ @Override public JavaRDD<HoodieRecord> repartitionRecords(JavaRDD<HoodieRecord> records, int outputSparkPartitions) { Comp...
3.26
hudi_BloomFilterUtils_getBitSize_rdh
/** * * @return the bitsize given the total number of entries and error rate. */ static int getBitSize(int numEntries, double errorRate) { return ((int) (Math.ceil(numEntries * ((-Math.log(errorRate)) / LOG2_SQUARED)))); }
3.26
hudi_BloomFilterUtils_m0_rdh
/** * * @return the number of hashes given the bitsize and total number of entries. */ static int m0(int bitSize, int numEntries) { // Number of the hash functions return ((int) (Math.ceil((Math.log(2) * bitSize) / numEntries))); }
3.26
hudi_MercifulJsonConverter_getFieldTypeProcessors_rdh
/** * Build type processor map for each avro type. */ private static Map<Schema.Type, JsonToAvroFieldProcessor> getFieldTypeProcessors() { return Collections.unmodifiableMap(new HashMap<Schema.Type, JsonToAvroFieldProcessor>() { { put(Type.STRING, generateStringTypeHandler()); ...
3.26
hudi_MercifulJsonConverter_convert_rdh
/** * Converts json to Avro generic record. * NOTE: if sanitization is needed for avro conversion, the schema input to this method is already sanitized. * During the conversion here, we sanitize the fields in the data * * @param json * Json record * @param schema * Schema */ public GenericRecord conv...
3.26
hudi_HoodieBootstrapSchemaProvider_getBootstrapSchema_rdh
/** * Main API to select avro schema for bootstrapping. * * @param context * HoodieEngineContext * @param partitions * List of partitions with files within them * @return Avro Schema */ public final Schema getBootstrapSchema(HoodieEngineContext context, List<Pair<String, List<HoodieFileStatus>>> partitions)...
3.26
hudi_TypedProperties_fromMap_rdh
/** * This method is introduced to get rid of the scala compile error: * <pre> * <code> * ambiguous reference to overloaded definition, * both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit * and method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Obje...
3.26
hudi_TypedProperties_putAll_rdh
/** * This method is introduced to get rid of the scala compile error: * <pre> * <code> * ambiguous reference to overloaded definition, * both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit * and method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Obje...
3.26
hudi_UtilHelpers_parseSchema_rdh
/** * Parse Schema from file. * * @param fs * File System * @param schemaFile * Schema File */ public static String parseSchema(FileSystem fs, String schemaFile) throws Exception { // Read schema file. Path p = new Path(schemaFile); if (!fs.exists(p)) { throw new Exception(String.forma...
3.26
hudi_UtilHelpers_createHoodieClient_rdh
/** * Build Hoodie write client. * * @param jsc * Java Spark Context * @param basePath * Base Path * @param schemaStr * Schema * @param parallelism * Parallelism */ public static SparkRDDWriteClient<HoodieRecordPayload> createHoodieClient(JavaSparkContext jsc, String basePath, String schemaStr, int p...
3.26
hudi_UtilHelpers_getJDBCSchema_rdh
/** * * * call spark function get the schema through jdbc. * The code logic implementation refers to spark 2.4.x and spark 3.x. * * @param options * @return * @throws Exception */public static Schema getJDBCSchema(Map<String, String> options) { Connection conn; ...
3.26
hudi_UtilHelpers_tableExists_rdh
/** * Returns true if the table already exists in the JDBC database. */ private static Boolean tableExists(Connection conn, Map<String, String> options) throws SQLException { JdbcDialect dialect = JdbcDialects.get(options.get(JDBCOptions.JDBC_URL())); try (PreparedStatement statement = conn.prepareStatement(...
3.26
hudi_UtilHelpers_createConnectionFactory_rdh
/** * Returns a factory for creating connections to the given JDBC URL. * * @param options * - JDBC options that contains url, table and other information. * @return * @throws SQLException * if the driver could not open a JDBC connection. */private static Connection createConnectionFactory(Map<String, Strin...
3.26
hudi_HoodieFlinkTable_getMetadataWriter_rdh
/** * Fetch instance of {@link HoodieTableMetadataWriter}. * * @return instance of {@link HoodieTableMetadataWriter} */ @Override protected Option<HoodieTableMetadataWriter> getMetadataWriter(String triggeringInstantTimestamp, HoodieFailedWritesCleaningPolicy failedWritesCleaningPolicy) { if (config.isMetadata...
3.26
hudi_HoodieUnMergedLogRecordScanner_newBuilder_rdh
/** * Returns the builder for {@code HoodieUnMergedLogRecordScanner}. */ public static HoodieUnMergedLogRecordScanner.Builder newBuilder() { return new Builder(); }
3.26
hudi_HoodieUnMergedLogRecordScanner_scan_rdh
/** * Scans delta-log files processing blocks */ public final void scan() { scan(false); }
3.26
hudi_LockManager_unlock_rdh
/** * We need to take care of the scenarios that current thread may not be the holder of this lock * and tries to call unlock() */ public void unlock() { getLockProvider().unlock(); metrics.updateLockHeldTimerMetrics(); close(); }
3.26
hudi_HoodiePipeline_sink_rdh
/** * Returns the data stream sink with given catalog table. * * @param input * The input datastream * @param tablePath * The table path to the hoodie table in the catalog * @param catalogTable * The hoodie catalog table * @param isBounded * A flag indicating whether the input data stream is bounded ...
3.26
hudi_HoodiePipeline_builder_rdh
/** * Returns the builder for hoodie pipeline construction. */ public static Builder builder(String tableName) { return new Builder(tableName); }
3.26
hudi_HoodiePipeline_pk_rdh
/** * Add primary keys. */ public Builder pk(String... pks) { this.pk = String.join(",", pks); return this;}
3.26
hudi_HoodiePipeline_source_rdh
/** * Returns the data stream source with given catalog table. * * @param execEnv * The execution environment * @param tablePath * The table path to the hoodie table in the catalog * @param catalogTable * The hoodie catalog table */ private static DataStream<RowData> source(StreamExecutionEnvironment exe...
3.26
hudi_HoodiePipeline_schema_rdh
/** * Add table schema. */ public Builder schema(Schema schema) { for (Schema.UnresolvedColumn column : schema.getColumns()) { column(column.toString()); } if (schema.getPrimaryKey().isPresent()) { pk(schema.getPrimaryKey().get().getColumnNames().stream().map(EncodingUtils::escapeIdentifie...
3.26
hudi_HoodiePipeline_partition_rdh
/** * Add partition fields. */ public Builder partition(String... partitions) { this.partitions = new ArrayList<>(Arrays.asList(partitions)); return this; }
3.26
hudi_HoodiePipeline_column_rdh
/** * Add a table column definition. * * @param column * the column format should be in the form like 'f0 int' */ public Builder column(String column) { this.columns.add(column); return this; }
3.26
hudi_ProtoConversionUtil_getMessageSchema_rdh
/** * Translates a Proto Message descriptor into an Avro Schema * * @param descriptor * the descriptor for the proto message * @param recursionDepths * a map of the descriptor to the number of times it has been encountered in this depth first traversal of the schema. * This is used to cap the number of tim...
3.26
hudi_ProtoConversionUtil_convertToAvro_rdh
/** * Converts the provided {@link Message} into an avro {@link GenericRecord} with the provided schema. * * @param schema * target schema to convert into * @param message * the source message to convert * @return an Avro GenericRecord */ public static GenericRecord convertToAvro(Schema schema, Message mess...
3.26
hudi_ProtoConversionUtil_getWrappedValue_rdh
/** * Returns the wrapped field, assumes all wrapped fields have a single value * * @param value * wrapper message like {@link Int32Value} or {@link StringValue} * @return the wrapped object */ private static Object getWrappedValue(Object value) { Message valueAsMessage = ((Message) (value)); return valueAsMess...
3.26
hudi_ProtoConversionUtil_getAvroSchemaForMessageClass_rdh
/** * Creates an Avro {@link Schema} for the provided class. Assumes that the class is a protobuf {@link Message}. * * @param clazz * The protobuf class * @param schemaConfig * configuration used to determine how to handle particular cases when converting from the proto schema * @return An Avro schema */ pu...
3.26
hudi_HoodieCopyOnWriteTableInputFormat_listStatusForNonHoodiePaths_rdh
/** * return non hoodie paths * * @param job * @return * @throws IOException */ public FileStatus[] listStatusForNonHoodiePaths(JobConf job) throws IOException { return doListStatus(job); }
3.26
hudi_HoodieCopyOnWriteTableInputFormat_listStatusForIncrementalMode_rdh
/** * Achieves listStatus functionality for an incrementally queried table. Instead of listing all * partitions and then filtering based on the commits of interest, this logic first extracts the * partitions touched by the desired commits and then lists only those partitions. */ protected List<FileStatus> listStatu...
3.26
hudi_Lazy_eagerly_rdh
/** * Instantiates {@link Lazy} in an "eagerly" fashion setting it w/ the provided value of * type {@link T} directly, bypassing lazy initialization sequence */ public static <T> Lazy<T> eagerly(T ref) { return new Lazy<>(ref); }
3.26
hudi_Lazy_lazily_rdh
/** * Executes provided {@code initializer} lazily, while providing for "exactly once" semantic, * to instantiate value of type {@link T} being subsequently held by the returned instance of * {@link Lazy} */ public static <T> Lazy<T> lazily(Supplier<T> initializer) { return new Lazy<>(initializer); }
3.26
hudi_DistributedRegistry_getAllCounts_rdh
/** * Get all Counter type metrics. */ @Override public Map<String, Long> getAllCounts(boolean prefixWithRegistryName) { HashMap<String, Long> countersMap = new HashMap<>(); counters.forEach((k, v) -> { String key = (prefixWithRegistryName) ? (name + ".") + k : k; countersMap.put(...
3.26
hudi_StreamWriteFunction_trace_rdh
/** * Trace the given record size {@code recordSize}. * * @param recordSize * The record size * @return true if the buffer size exceeds the maximum buffer size */ boolean trace(long recordSize) { this.bufferSize += recordSize; return this.bufferSize > this.maxBufferSize; }
3.26
hudi_StreamWriteFunction_m0_rdh
// ------------------------------------------------------------------------- // Getter/Setter // ------------------------------------------------------------------------- @VisibleForTesting @SuppressWarnings("rawtypes") public Map<String, List<HoodieRecord>> m0() { Map<String, List<HoodieRecord>> ret = new HashMap<...
3.26
hudi_StreamWriteFunction_endInput_rdh
/** * End input action for batch source. */ public void endInput() { super.endInput(); m2(true); this.writeClient.cleanHandles(); this.writeStatuses.clear(); }
3.26
hudi_StreamWriteFunction_initBuffer_rdh
// ------------------------------------------------------------------------- // Utilities // ------------------------------------------------------------------------- private void initBuffer() { this.buckets = new LinkedHashMap<>(); }
3.26
hudi_StreamWriteFunction_getBucketID_rdh
/** * Returns the bucket ID with the given value {@code value}. */private String getBucketID(HoodieRecord<?> record) { final String fileId = record.getCurrentLocation().getFileId(); return StreamerUtil.generateBucketKey(record.getPartitionPath(), fileId); }
3.26
hudi_StreamWriteFunction_bufferRecord_rdh
/** * Buffers the given record. * * <p>Flush the data bucket first if the bucket records size is greater than * the configured value {@link FlinkOptions#WRITE_BATCH_SIZE}. * * <p>Flush the max size data bucket if the total buffer size exceeds the configured * threshold {@link FlinkOptions#WRITE_TASK_MAX_SIZE}. ...
3.26
hudi_StreamWriteFunction_writeBuffer_rdh
/** * Prepare the write data buffer: patch up all the records with correct partition path. */ public List<HoodieRecord> writeBuffer() { // rewrite all the records with new record key return records.stream().map(record -> record.toHoodieRecord(partitionPath)).collect(Collectors.toList()); }
3.26