name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
hudi_TableSchemaResolver_m0_rdh | /**
* Fetches the schema for a table from any the table's data files
*/
private Option<MessageType> m0() {
Option<Pair<HoodieInstant, HoodieCommitMetadata>> instantAndCommitMetadata = m1();
try {
switch (metaClient.getTableType()) {
case COPY_ON_WRITE :case... | 3.26 |
hudi_TableSchemaResolver_readSchemaFromLastCompaction_rdh | /**
* Read schema from a data file from the last compaction commit done.
*
* @deprecated please use {@link #getTableAvroSchema(HoodieInstant, boolean)} instead
*/
public MessageType readSchemaFromLastCompaction(Option<HoodieInstant> lastCompactionCommitOpt) throws Exception {
HoodieActiveTimeline activeTimeline = m... | 3.26 |
hudi_TableSchemaResolver_getTableInternalSchemaFromCommitMetadata_rdh | /**
* Gets the InternalSchema for a hoodie table from the HoodieCommitMetadata of the instant.
*
* @return InternalSchema for this table
*/
private Option<InternalSchema> getTableInternalSchemaFromCommitMetadata(HoodieInstant instant) {
try {
HoodieCommitMetadata metadata = getCachedCommitMetadata(instant);
String ... | 3.26 |
hudi_TableSchemaResolver_getTableParquetSchema_rdh | /**
* Gets users data schema for a hoodie table in Parquet format.
*
* @return Parquet schema for the table
*/
public MessageType getTableParquetSchema(boolean includeMetadataField) throws Exception {
return convertAvroSchemaToParquet(getTableAvroSchema(includeMetadataField));
} | 3.26 |
hudi_TableSchemaResolver_getTableAvroSchemaFromLatestCommit_rdh | /**
* Returns table's latest Avro {@link Schema} iff table is non-empty (ie there's at least
* a single commit)
*
* This method differs from {@link #getTableAvroSchema(boolean)} in that it won't fallback
* to use table's schema used at creation
*/
public Option<Schema> getTableAvroSchemaFromLatestCommit(boolean i... | 3.26 |
hudi_TableSchemaResolver_hasOperationField_rdh | /**
* NOTE: This method could only be used in tests
*
* @VisibleForTesting */
public boolean hasOperationField() {
try {
Schema tableAvroSchema = getTableAvroSchemaFromDataFile();
return
tableAvroSchema.getField(HoodieRecord.OPERATION_METADATA_FIELD) != null;
} catch (Exception e) {
LOG.info(String.format("Failed t... | 3.26 |
hudi_TableSchemaResolver_readSchemaFromLogFile_rdh | /**
* Read the schema from the log file on path.
*
* @return */
public static MessageType readSchemaFromLogFile(FileSystem fs, Path path) throws IOException {
try (Reader reader = HoodieLogFormat.newReader(fs, new HoodieLogFile(path), null)) {
HoodieDataBlock lastBlock = null;
while (reader.hasNext()) {
... | 3.26 |
hudi_TableSchemaResolver_getTableAvroSchemaWithoutMetadataFields_rdh | /**
* Gets users data schema for a hoodie table in Avro format.
*
* @return Avro user data schema
* @throws Exception
* @deprecated use {@link #getTableAvroSchema(boolean)} instead
*/
@Deprecated
public Schema getTableAvroSchemaWithoutMetadataFields() throws Exception {
return getTableAvroSchemaInternal(false... | 3.26 |
hudi_TableSchemaResolver_getTableHistorySchemaStrFromCommitMetadata_rdh | /**
* Gets the history schemas as String for a hoodie table from the HoodieCommitMetadata of the instant.
*
* @return history schemas string for this table
*/
public Option<String> getTableHistorySchemaStrFromCommitMetadata() {
// now we only support FileBaseInternalSchemaManager
FileBasedInternalSchemaStorageManag... | 3.26 |
hudi_WriteStatus_markFailure_rdh | /**
* Used by native write handles like HoodieRowCreateHandle and HoodieRowDataCreateHandle.
*
* @see WriteStatus#markFailure(HoodieRecord, Throwable, Option)
*/
@PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING)
public void markFailure(String recordKey, String partitionPath, Throwable t) {
if (failedRecord... | 3.26 |
hudi_WriteStatus_markSuccess_rdh | /**
* Used by native write handles like HoodieRowCreateHandle and HoodieRowDataCreateHandle.
*
* @see WriteStatus#markSuccess(HoodieRecord, Option)
*/
@PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING)
public void markSuccess(HoodieRecordDelegate recordDelegate, Option<Map<String, String>> optionalRecordMetadat... | 3.26 |
hudi_FlinkWriteClients_createWriteClientV2_rdh | /**
* Creates the Flink write client.
*
* <p>This expects to be used by the driver, the client can then send requests for files view.
*
* <p>The task context supplier is a constant: the write token is always '0-1-0'.
*
* <p>Note: different with {@link #createWriteClient}, the fs view storage options are set into... | 3.26 |
hudi_FlinkWriteClients_getHoodieClientConfig_rdh | /**
* Mainly used for tests.
*/
public static HoodieWriteConfig getHoodieClientConfig(Configuration conf) {
return getHoodieClientConfig(conf, false, false);
} | 3.26 |
hudi_FlinkWriteClients_createWriteClient_rdh | /**
* Creates the Flink write client.
*
* <p>This expects to be used by client, the driver should start an embedded timeline server.
*/
@SuppressWarnings("rawtypes")
public static HoodieFlinkWriteClient createWriteClient(Configuration conf, RuntimeContext runtimeContext) {
return createWriteClient(conf, runtime... | 3.26 |
hudi_CkpMetadata_bootstrap_rdh | // -------------------------------------------------------------------------
// WRITE METHODS
// -------------------------------------------------------------------------
/**
* Initialize the message bus, would clean all the messages
*
* <p>This expects to be called by the driver.
*/
public void bootstrap() throws ... | 3.26 |
hudi_CkpMetadata_load_rdh | // -------------------------------------------------------------------------
// READ METHODS
// -------------------------------------------------------------------------
private void load() {
try {
this.messages = m1(this.path);
} catch (IOException e) {
throw new HoodieException("Exception whil... | 3.26 |
hudi_CkpMetadata_commitInstant_rdh | /**
* Add a checkpoint commit message.
*
* @param instant
* The committed instant
*/
public void commitInstant(String instant) {
Path path = fullPath(CkpMessage.getFileName(instant, State.COMPLETED));
try {
fs.createNewFile(path);
} catch (IOException e) {
throw new HoodieException("E... | 3.26 |
hudi_CkpMetadata_ckpMetaPath_rdh | // -------------------------------------------------------------------------
// Utilities
// -------------------------------------------------------------------------
protected static String ckpMetaPath(String basePath, String uniqueId) {
// .hoodie/.aux/ckp_meta
String metaPath = (((basePath + Path.SEPARATOR) ... | 3.26 |
hudi_StreamerUtil_generateBucketKey_rdh | /**
* Generates the bucket ID using format {partition path}_{fileID}.
*/
public static String generateBucketKey(String partitionPath, String fileId) {
return String.format("%s_%s", partitionPath, fileId);
} | 3.26 |
hudi_StreamerUtil_getTimeGeneratorConfig_rdh | /**
* Returns the timeGenerator config with given configuration.
*/
public static HoodieTimeGeneratorConfig getTimeGeneratorConfig(Configuration conf) {
TypedProperties properties = flinkConf2TypedProperties(conf);
// Set lock configure, which is needed in TimeGenerator.
Option<HoodieLockConfig> lockC... | 3.26 |
hudi_StreamerUtil_readConfig_rdh | /**
* Read config from properties file (`--props` option) and cmd line (`--hoodie-conf` option).
*/
public static DFSPropertiesConfiguration readConfig(Configuration hadoopConfig, Path cfgPath, List<String> overriddenProps) {
DFSPropertiesConfiguration conf = new DFSPropertiesConfiguration(hadoopConfig, cfg... | 3.26 |
hudi_StreamerUtil_getPayloadConfig_rdh | /**
* Returns the payload config with given configuration.
*/
public static HoodiePayloadConfig getPayloadConfig(Configuration conf) {
return HoodiePayloadConfig.newBuilder().withPayloadClass(conf.getString(FlinkOptions.PAYLOAD_CLASS_NAME)).withPayloadOrderingField(conf.getString(FlinkOptions.PRECOMBINE_FIELD)).w... | 3.26 |
hudi_StreamerUtil_instantTimeDiffSeconds_rdh | /**
* Returns the time interval in seconds between the given instant time.
*/
public static long instantTimeDiffSeconds(String newInstantTime, String oldInstantTime) {
try {long newTimestamp = HoodieActiveTimeline.parseDateFromInstantTime(newInstantTime).getTime();
long oldTimestamp = HoodieActiveTimel... | 3.26 |
hudi_StreamerUtil_createMetaClient_rdh | /**
* Creates the meta client.
*/public static HoodieTableMetaClient
createMetaClient(Configuration conf, Configuration hadoopConf) {
return HoodieTableMetaClient.builder().setBasePath(conf.getString(FlinkOptions.PATH)).setConf(hadoopConf).setTimeGeneratorConfig(getTimeGeneratorConfig(conf)).build();
} | 3.26 |
hudi_StreamerUtil_getMaxCompactionMemoryInBytes_rdh | /**
* Returns the max compaction memory in bytes with given conf.
*/ public static long getMaxCompactionMemoryInBytes(Configuration conf) {
return (((long) (conf.getInteger(FlinkOptions.COMPACTION_MAX_MEMORY))) * 1024) * 1024;
} | 3.26 |
hudi_StreamerUtil_partitionExists_rdh | /**
* Returns whether the hoodie partition exists under given table path {@code tablePath} and partition path {@code partitionPath}.
*
* @param tablePath
* Base path of the table.
* @param partitionPath
* The path of the partition.
* @param hadoopConf
* The hadoop configuration.
*/
public static boolean ... | 3.26 |
hudi_StreamerUtil_medianInstantTime_rdh | /**
* Returns the median instant time between the given two instant time.
*/
public static Option<String> medianInstantTime(String highVal, String lowVal) {
try {
long high = HoodieActiveTimeline.parseDateFromInstantTime(highVal).getTime();
long
low = HoodieActiveTimeline.parseDateFromInst... | 3.26 |
hudi_StreamerUtil_getLockConfig_rdh | /**
* Get the lockConfig if required, empty {@link Option} otherwise.
*/
public static Option<HoodieLockConfig> getLockConfig(Configuration conf) {
if (OptionsResolver.isLockRequired(conf) && (!conf.containsKey(HoodieLockConfig.LOCK_PROVIDER_CLASS_NAME.key()))) {
// configure the fs lock provider by defa... | 3.26 |
hudi_StreamerUtil_isWriteCommit_rdh | /**
* Returns whether the given instant is a data writing commit.
*
* @param tableType
* The table type
* @param instant
* The instant
* @param timeline
* The timeline
*/
public static boolean
isWriteCommit(HoodieTableType tableType, HoodieInstant instant, HoodieTimeline timeline) {
return tableType ... | 3.26 |
hudi_StreamerUtil_metaClientForReader_rdh | /**
* Creates the meta client for reader.
*
* <p>The streaming pipeline process is long-running, so empty table path is allowed,
* the reader would then check and refresh the meta client.
*
* @see org.apache.hudi.source.StreamReadMonitoringFunction
*/
public static HoodieTableMetaClient metaClientForReader(Confi... | 3.26 |
hudi_StreamerUtil_isValidFile_rdh | /**
* Returns whether the give file is in valid hoodie format.
* For example, filtering out the empty or corrupt files.
*/
public static boolean isValidFile(FileStatus fileStatus) {
final String extension =
FSUtils.getFileExtension(fileStatus.getPath().toString());
if (PARQUET.getFileExtension().equals(e... | 3.26 |
hudi_StreamerUtil_flinkConf2TypedProperties_rdh | /**
* Converts the give {@link Configuration} to {@link TypedProperties}.
* The default values are also set up.
*
* @param conf
* The flink configuration
* @return a TypedProperties instance
*/
public static TypedProperties flinkConf2TypedProperties(Configuration conf) {
Configuration flatConf = FlinkOpti... | 3.26 |
hudi_StreamerUtil_initTableIfNotExists_rdh | /**
* Initialize the table if it does not exist.
*
* @param conf
* the configuration
* @throws IOException
* if errors happens when writing metadata
*/
public static HoodieTableMetaClient initTableIfNotExists(Configuration conf, Configuration hadoopConf) throws IOException {
final String basePath = conf.ge... | 3.26 |
hudi_StreamerUtil_getTableConfig_rdh | /**
* Returns the table config or empty if the table does not exist.
*/
public static Option<HoodieTableConfig> getTableConfig(String basePath, Configuration hadoopConf) {
FileSystem fs = FSUtils.getFs(basePath, hadoopConf);
Path metaPath = new Path(basePath, HoodieTableMetaClient.METAFOLDER_NAME);
try {... | 3.26 |
hudi_StreamerUtil_haveSuccessfulCommits_rdh | /**
* Returns whether there are successful commits on the timeline.
*
* @param metaClient
* The meta client
* @return true if there is any successful commit
*/
public static boolean haveSuccessfulCommits(HoodieTableMetaClient metaClient) {
return !metaClient.getCommitsTimeline().filterCompletedInstants().... | 3.26 |
hudi_SparkDataSourceTableUtils_getSparkTableProperties_rdh | /**
* Get Spark Sql related table properties. This is used for spark datasource table.
*
* @param schema
* The schema to write to the table.
* @return A new parameters added the spark's table properties.
*/
public static Map<String, String> getSparkTableProperties(List<String> pa... | 3.26 |
hudi_DataPruner_test_rdh | /**
* Filters the index row with specific data filters and query fields.
*
* @param indexRow
* The index row
* @param queryFields
* The query fields referenced by the filters
* @return true if the index row should be considered as a candidate
*/
public boolean test(RowData indexRow, RowType[] queryFields) {... | 3.26 |
hudi_DataPruner_getValAsJavaObj_rdh | /**
* Returns the value as Java object at position {@code pos} of row {@code indexRow}.
*/
private static Object getValAsJavaObj(RowData indexRow, int pos, LogicalType colType) {
switch (colType.getTypeRoot()) {
// NOTE: Since we can't rely on Avro's "date", and "timestamp-micros" logical-types, we're
... | 3.26 |
hudi_PartitionAwareClusteringPlanStrategy_buildClusteringGroupsForPartition_rdh | /**
* Create Clustering group based on files eligible for clustering in the partition.
*/
protected Stream<HoodieClusteringGroup> buildClusteringGroupsForPartition(String partitionPath, List<FileSlice> fileSlices) {
HoodieWriteConfig writeConfig = getWriteConfig();
List<Pair<List<FileSlice>, Integer>> fileSli... | 3.26 |
hudi_PartitionAwareClusteringPlanStrategy_filterPartitionPaths_rdh | /**
* Return list of partition paths to be considered for clustering.
*/protected List<String> filterPartitionPaths(List<String> partitionPaths) {
List<String> filteredPartitions = ClusteringPlanPartitionFilter.filter(partitionPaths, getWriteConfig());
LOG.debug("Filtered to the following partitions: " + fi... | 3.26 |
hudi_SingleSparkJobExecutionStrategy_readRecordsForGroupBaseFiles_rdh | /**
* Read records from baseFiles and get iterator.
*/
private Iterator<HoodieRecord<T>> readRecordsForGroupBaseFiles(List<ClusteringOperation> clusteringOps) {
List<Iterator<HoodieRecord<T>>> iteratorsForPartition = clusteringOps.stream().map(clusteringOp -> {
Schema readerSchema = HoodieAvroUtils.addMet... | 3.26 |
hudi_DatePartitionPathSelector_pruneDatePartitionPaths_rdh | /**
* Prunes date level partitions to last few days configured by 'NUM_PREV_DAYS_TO_LIST' from
* 'CURRENT_DATE'. Parallelizes listing by leveraging HoodieSparkEngineContext's methods.
*/
public List<String> pruneDatePartitionPaths(HoodieSparkEngineContext context, FileSystem fs, String
rootPath, LocalDate currentDat... | 3.26 |
hudi_FlinkCompactionConfig_toFlinkConfig_rdh | /**
* Transforms a {@code HoodieFlinkCompaction.config} into {@code Configuration}.
* The latter is more suitable for the table APIs. It reads all the properties
* in the properties file (set by `--props` option) and cmd line options
* (set by `--hoodie-conf` option).
*/
public static Configuration toFlinkConfig(F... | 3.26 |
hudi_ListBasedIndexFileFilter_shouldCompareWithFile_rdh | /**
* if we don't have key ranges, then also we need to compare against the file. no other choice if we do, then only
* compare the file if the record key falls in range.
*/
protected boolean shouldCompareWithFile(BloomIndexFileInfo indexInfo, String recordKey) {
return (!indexInfo.hasKeyRanges()) || indexInfo.i... | 3.26 |
hudi_RunLengthDecoder_readDictionaryIds_rdh | /**
* Decoding for dictionary ids. The IDs are populated into `values` and the nullability is
* populated into `nulls`.
*/
void readDictionaryIds(int total, WritableIntVector values, WritableColumnVector nulls, int rowId, int level, RunLengthDecoder data) {
int left = total;
while (left > 0) {
if ... | 3.26 |
hudi_RunLengthDecoder_initFromStream_rdh | /**
* Init from input stream.
*/
void initFromStream(int valueCount, ByteBufferInputStream in) throws IOException {
this.in =
in;
if (fixedWidth) {// initialize for repetition and definition levels
if (readLength) {
int length = readIntLittleEndian();
this.in = in.sliceStr... | 3.26 |
hudi_RunLengthDecoder_initWidthAndPacker_rdh | /**
* Initializes the internal state for decoding ints of `bitWidth`.
*/
private void initWidthAndPacker(int bitWidth) {
Preconditions.checkArgument((bitWidth >= 0) && (bitWidth <= 32), "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWi... | 3.26 |
hudi_RunLengthDecoder_readNextGroup_rdh | /**
* Reads the next group.
*/
void readNextGroup() {
try {
int header = m0();
this.mode = ((header & 1) == 0) ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE :
this.currentCount = header >>> 1;
this.currentValue = readIntLittleEndianPaddedOnBitWidth();
return;
case PACKED
:
... | 3.26 |
hudi_RunLengthDecoder_readIntLittleEndianPaddedOnBitWidth_rdh | /**
* Reads the next byteWidth little endian int.
*/
private int readIntLittleEndianPaddedOnBitWidth() throws IOException {
switch (bytesWidth) {
case 0 :
return 0;
case 1 :
return in.read();
case 2 :
{
int ch2 = in.read();
int ch1 = in.read();
retur... | 3.26 |
hudi_RunLengthDecoder_readDictionaryIdData_rdh | /**
* It is used to decode dictionary IDs.
*/
private void readDictionaryIdData(int total, WritableIntVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) {this.readNextGroup();
}
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE :
... | 3.26 |
hudi_RunLengthDecoder_m0_rdh | /**
* Reads the next varint encoded int.
*/
private int m0() throws IOException {
int value = 0;
int shift = 0;
int b;
do {
b = in.read();
value |= (b & 0x7f) << shift;
shift += 7;
} while ((b & 0x80) != 0 );
return value;
} | 3.26 |
hudi_RunLengthDecoder_readIntLittleEndian_rdh | /**
* Reads the next 4 byte little endian int.
*/
private int readIntLittleEndian()
throws IOException {
int ch4 = in.read();
int ch3 = in.read();
int ch2 = in.read();
int ch1
= in.read();
return (((ch1 << 24) + (ch2 << 16)) + (ch3 << 8)) + ch4;
} | 3.26 |
hudi_BucketAssigners_create_rdh | /**
* Creates a {@code BucketAssigner}.
*
* @param taskID
* The task ID
* @param maxParallelism
* The max parallelism
* @param numTasks
* The number of tasks
* @param ignoreSmallFiles
* Whether to ignore the small files
* @param tableType
* The table type
* @param context
* The engine context
... | 3.26 |
hudi_SchemaEvolutionContext_doEvolutionForRealtimeInputFormat_rdh | /**
* Do schema evolution for RealtimeInputFormat.
*
* @param realtimeRecordReader
* recordReader for RealtimeInputFormat.
* @return */
public void doEvolutionForRealtimeInputFormat(AbstractRealtimeRecordReader realtimeRecordReader) throws Exception {
if (!(split instanceof R... | 3.26 |
hudi_SchemaEvolutionContext_doEvolutionForParquetFormat_rdh | /**
* Do schema evolution for ParquetFormat.
*/
public void doEvolutionForParquetFormat() {
if (internalSchemaOption.isPresent()) {
// reading hoodie schema evolution table
job.setBoolean(HIVE_EVOLUTION_ENABLE, true);Path finalPath = ((FileSplit) (split)).getPath();
InternalSchema pruned... | 3.26 |
hudi_DateTimeUtils_parseDuration_rdh | /**
* Parse the given string to a java {@link Duration}. The string is in format "{length
* value}{time unit label}", e.g. "123ms", "321 s". If no time unit label is specified, it will
* be considered as milliseconds.
*
* <p>Supported time unit labels are:
*... | 3.26 |
hudi_DateTimeUtils_microsToInstant_rdh | /**
* Converts provided microseconds (from epoch) to {@link Instant}
*/
public static Instant microsToInstant(long microsFromEpoch) {
long epochSeconds = microsFromEpoch / 1000000L;
long nanoAdjustment = (microsFromEpoch % 1000000L) * 1000L;
return Instant.ofEpochSecond(epochSeconds, nanoAdjustment);
} | 3.26 |
hudi_DateTimeUtils_instantToMicros_rdh | /**
* Converts provided {@link Instant} to microseconds (from epoch)
*/
public static long instantToMicros(Instant instant) {
long seconds = instant.getEpochSecond();
int v3 = instant.getNano();
if ((seconds < 0) && (v3 > 0)) {
long micros = Math.multiplyExact(seconds + 1, 1000000L);
... | 3.26 |
hudi_DateTimeUtils_formatUnixTimestamp_rdh | /**
* Convert UNIX_TIMESTAMP to string in given format.
*
* @param unixTimestamp
* UNIX_TIMESTAMP
* @param timeFormat
* string time format
*/
public static String formatUnixTimestamp(long unixTimestamp, String timeFormat) {
ValidationUtils.checkArgument(!StringUtils.isNullOrEmpty(timeFormat));
DateTi... | 3.26 |
hudi_DateTimeUtils_plural_rdh | /**
*
* @param label
* the original label
* @return both the singular format and plural format of the original label
*/
private static String[] plural(String label) {
return new String[]{ label, label + PLURAL_SUFFIX };
} | 3.26 |
hudi_DateTimeUtils_singular_rdh | /**
*
* @param label
* the original label
* @return the singular format of the original label
*/
private static String[] singular(String label) {return new String[]{ label };
} | 3.26 |
hudi_HoodieFileGroupReader_hasNext_rdh | /**
*
* @return {@code true} if the next record exists; {@code false} otherwise.
* @throws IOException
* on reader error.
*/public boolean hasNext() throws IOException {
return recordBuffer.hasNext();
}
/**
*
* @return The next record after calling {@link #hasNext} | 3.26 |
hudi_SyncUtilHelpers_runHoodieMetaSync_rdh | /**
* Create an instance of an implementation of {@link HoodieSyncTool} that will sync all the relevant meta information
* with an external metastore such as Hive etc. to ensure Hoodie tables can be queried or read via external systems.
*
* @param syncToolClassName
* Class name of the {@link HoodieSyncTool} impl... | 3.26 |
hudi_SpillableMapUtils_convertToHoodieRecordPayload_rdh | /**
* Utility method to convert bytes to HoodieRecord using schema and payload class.
*/
public static <R> HoodieRecord<R> convertToHoodieRecordPayload(GenericRecord rec, String payloadClazz, String preCombineField, boolean withOperationField) {
return convertToHoodieRecordPayload(rec, payloadClazz, preCombineFie... | 3.26 |
hudi_SpillableMapUtils_readInternal_rdh | /**
* Reads the given file with specific pattern(|crc|timestamp|sizeOfKey|SizeOfValue|key|value|) then
* returns an instance of {@link FileEntry}.
*/
private static FileEntry readInternal(RandomAccessFile file, long valuePosition, int valueLength) throws IOException
{
file.seek(valuePosition);
long crc = fil... | 3.26 |
hudi_SpillableMapUtils_getPreCombineVal_rdh | /**
* Returns the preCombine value with given field name.
*
* @param rec
* The avro record
* @param preCombineField
* The preCombine field name
* @return the preCombine field value or 0 if the field does not exist in the avro schema
*/private static Object getPreCombineVal(GenericRecord rec, String preCombi... | 3.26 |
hudi_SpillableMapUtils_computePayloadSize_rdh | /**
* Compute a bytes representation of the payload by serializing the contents This is used to estimate the size of the
* payload (either in memory or when written to disk).
*/public static <R> long computePayloadSize(R value, SizeEstimator<R> valueSizeEstimator) throws IOException {
return valueSizeEstimator.s... | 3.26 |
hudi_SpillableMapUtils_readBytesFromDisk_rdh | /**
* Using the schema and payload class, read and convert the bytes on disk to a HoodieRecord.
*/
public static byte[] readBytesFromDisk(RandomAccessFile file, long valuePosition, int valueLength) throws IOException {
FileEntry fileEntry = readInternal(file, valuePosition, valueLength);
return fileEntry.getV... | 3.26 |
hudi_SpillableMapUtils_spillToDisk_rdh | /**
* Write Value and other metadata necessary to disk. Each entry has the following sequence of data
* <p>
* |crc|timestamp|sizeOfKey|SizeOfValue|key|value|
*/
public static long spillToDisk(SizeAwareDataOutputStream outputStream, FileEntry fileEntry) throws
IOException {
return spill(outputStream, fileEntry);... | 3.26 |
hudi_SpillableMapUtils_generateEmptyPayload_rdh | /**
* Utility method to convert bytes to HoodieRecord using schema and payload class.
*/
public static <R> R generateEmptyPayload(String recKey, String partitionPath, Comparable orderingVal, String payloadClazz) {
HoodieRecord<? extends HoodieRecordPayload> hoodieRecord = new HoodieAvroRecord<>(new HoodieKey(r... | 3.26 |
AreaShop_BukkitHandler1_12_getSignFacing_rdh | // Uses Sign, which is deprecated in 1.13+, broken in 1.14+
@Override
public BlockFace getSignFacing(Block block) {
if (block == null) {
return null;
}
BlockState blockState = block.getState();
if (blockState == null) {
return null;
}
MaterialData materialData = blockState.getDat... | 3.26 |
AreaShop_ResoldRegionEvent_getFromPlayer_rdh | /**
* Get the player that the region has been bought from.
*
* @return The UUID of the player that the region has been bought from
*/
public UUID getFromPlayer() {
return from;
} | 3.26 |
AreaShop_FileManager_getRegions_rdh | /**
* Get all regions.
*
* @return List of all regions (it is safe to modify the list)
*/
public List<GeneralRegion> getRegions() {
return new ArrayList<>(regions.values());
} | 3.26 |
AreaShop_FileManager_addRegion_rdh | /**
* Add a region to the list and mark it as to-be-saved.
*
* @param region
* Then region to add
* @return true when successful, otherwise false (denied by an event listener)
*/
public AddingRegionEvent addRegion(GeneralRegion region) {
AddingRegionEvent v17 = addRegionNoSave(region);
if (v17.isCance... | 3.26 |
AreaShop_FileManager_saveVersions_rdh | /**
* Save the versions file to disk.
*/
public void saveVersions() {if (!new File(versionPath).exists()) {
AreaShop.debug("versions file created, this should happen only after installing or upgrading the plugin");
}
try (ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(versionPath))) {
... | 3.26 |
AreaShop_FileManager_checkForInactiveRegions_rdh | /**
* Check all regions and unrent/sell them if the player is inactive for too long.
*/
public void checkForInactiveRegions() {
Do.forAll(plugin.getConfig().getInt("inactive.regionsPerTick"), getRegions(), GeneralRegion::checkInactive);
} | 3.26 |
AreaShop_FileManager_m1_rdh | /**
* Load the groups.yml file from disk
*
* @return true if succeeded, otherwise false
*/
public boolean m1() {
boolean result = true;
File groupFile = new File(groupsPath);
if (groupFile.exists() && groupFile.isFile()) {
try (InputStreamReader reader = new InputStreamReader(new FileInputStream(groupFile), C... | 3.26 |
AreaShop_FileManager_performPeriodicSignUpdate_rdh | /**
* Update all signs that need periodic updating.
*/
public void performPeriodicSignUpdate() {
Do.forAll(plugin.getConfig().getInt("signs.regionsPerTick"), getRents(), region -> {
if (region.needsPeriodicUpdate()) {
region.update();
}
});
} | 3.26 |
AreaShop_FileManager_saveRequiredFiles_rdh | /**
* Save all region related files spread over time (low load).
*/
public void saveRequiredFiles()
{
if (isSaveGroupsRequired()) {
saveGroupsNow();
}
this.saveWorldGuardRegions();
Do.forAll(plugin.getConfig().getInt("saving.regionsPerTick"), getRegions(), region -> {
if (region.isSave... | 3.26 |
AreaShop_FileManager_getRegion_rdh | /**
* Get a region.
*
* @param name
* The name of the region to get (will be normalized)
* @return The region if found, otherwise null
*/
public GeneralRegion getRegion(String name) {
return regions.get(name.toLowerCase());
} | 3.26 |
AreaShop_FileManager_saveGroupsNow_rdh | /**
* Save the groups file to disk synchronously.
*/
public void saveGroupsNow() {
AreaShop.debug("saveGroupsNow() done");
saveGroupsRequired = false;
try {
groupsConfig.save(groupsPath);
} catch (IOException e) {
AreaShop.warn("Groups file could not be saved: " + groupsPath);
}... | 3.26 |
AreaShop_FileManager_getRent_rdh | /**
* Get a rental region.
*
* @param name
* The name of the rental region (will be normalized)
* @return RentRegion if it could be found, otherwise null
*/
public RentRegion getRent(String name) {
GeneralRegion region = regions.get(name.toLowerCase());if (region instanceof RentRegion) {
return ((... | 3.26 |
AreaShop_FileManager_preUpdateFiles_rdh | /**
* Checks for old file formats and converts them to the latest format.
* After conversion the region files need to be loaded.
*/
@SuppressWarnings("unchecked")
private void preUpdateFiles() {
Integer fileStatus = versions.get(AreaShop.versionFiles);
// If the the files are already the current version
if ((fileSta... | 3.26 |
AreaShop_FileManager_getGroupSettings_rdh | /**
* Get the settings of a group.
*
* @param groupName
* Name of the group to get the settings from
* @return The settings of the group
*/
public ConfigurationSection getGroupSettings(String groupName) {
return groupsConfig.getConfigurationSection(groupName.toLowerCase());
} | 3.26 |
AreaShop_FileManager_saveGroupsIsRequired_rdh | /**
* Save the group file to disk.
*/
public void saveGroupsIsRequired() {
saveGroupsRequired = true;
} | 3.26 |
AreaShop_FileManager_getGroups_rdh | /**
* Get all groups.
*
* @return Collection with all groups (safe to modify)
*/
public Collection<RegionGroup> getGroups() {
return groups.values();
} | 3.26 |
AreaShop_FileManager_getRents_rdh | /**
* Get all rental regions.
*
* @return List of all rental regions
*/
public List<RentRegion> getRents() {
List<RentRegion> result = new ArrayList<>();
for (GeneralRegion region : regions.values()) {
if (region instanceof RentRegion) {
result.add(((RentRegion) (region)... | 3.26 |
AreaShop_FileManager_saveWorldGuardRegions_rdh | /**
* Save all worldGuard regions that need saving.
*/
public void saveWorldGuardRegions() {
for (String world : worldRegionsRequireSaving) {
World bukkitWorld = Bukkit.getWorld(world);
if (bukkitWorld != null) {
RegionManager manager = plugin.getRegionManager(bukkitWorld);
... | 3.26 |
AreaShop_FileManager_loadRegionFiles_rdh | /**
* Load all region files.
*/
public void loadRegionFiles() {
regions.clear();
final
File file
= new File(regionsPath);
if (!file.exists()) {
if (!file.mkdirs()) {
AreaShop.warn("Could not create region files directory: " + file.getAbsolutePath());
return;
}
plugin.setReady(true);
} else... | 3.26 |
AreaShop_FileManager_updateRegions_rdh | /**
* Update regions in a task to minimize lag.
*
* @param regions
* Regions to update
* @param confirmationReceiver
* The CommandSender that should be notified at completion
*/
public void updateRegions(final List<GeneralRegion> regions, final CommandSender confirmationReceiver) {
final int regionsPerTi... | 3.26 |
AreaShop_FileManager_getRegionSettings_rdh | /**
* Get the default region settings as provided by the user (default.yml).
*
* @return YamlConfiguration with the settings (might miss settings, which should be filled in with {@link #getFallbackRegionSettings()})
*/
public YamlConfiguration getRegionSettings() {
return defaultConfig;
} | 3.26 |
AreaShop_FileManager_getRentNames_rdh | /**
* Get a list of names of all rent regions.
*
* @return A String list with all the names
*/
public List<String> getRentNames() {
ArrayList<String> result = new ArrayList<>();
fo... | 3.26 |
AreaShop_FileManager_checkRents_rdh | /**
* Unrent regions that have no time left, regions to check per tick is in the config.
*/public void checkRents() {
Do.forAll(plugin.getConfig().getInt("expiration.regionsPerTick"), getRents(), RentRegion::checkExpiration);
} | 3.26 |
AreaShop_FileManager_getGroupNames_rdh | /**
* Get a list of names of all groups.
*
* @return A String list with all the names
*/
public List<String> getGroupNames() {ArrayList<String> result = new ArrayList<>();
for (RegionGroup group : getGroups()) {
result.add(group.getName());
}
return result;
} | 3.26 |
AreaShop_FileManager_m0_rdh | /**
* Remove a region from the list.
*
* @param region
* The region to remove
* @param giveMoneyBack
* use true to give money back to the player if someone is currently holding this region, otherwise false
* @return true if the region has been removed, false otherwise
*/
public DeletingRegionEvent m0(Genera... | 3.26 |
AreaShop_FileManager_saveRequiredFilesAtOnce_rdh | /**
* Save all region related files directly (only for cases like onDisable()).
*/
public void saveRequiredFilesAtOnce() {
if (isSaveGroupsRequired()) {
saveGroupsNow();
}
for (GeneralRegion region : getRegions()) {
if (region.isSaveRequired()) {
region.saveNow();
}
... | 3.26 |
AreaShop_FileManager_getGroup_rdh | /**
* Get a group.
*
* @param name
* The name of the group to get (will be normalized)
* @return The group if found, otherwise null
*/
public RegionGroup getGroup(String name) {
return groups.get(name.toLowerCase());
} | 3.26 |
AreaShop_FileManager_addGroup_rdh | /**
* Add a RegionGroup.
*
* @param group
* The RegionGroup to add
*/
public void addGroup(RegionGroup group) {
groups.put(group.getName().toLowerCase(), group);
String lowGroup = group.getName().toLowerCase();
groupsConfig.set(lowGroup
+ ".name",
group.getName());
groupsConfig.set(lowGro... | 3.26 |
AreaShop_FileManager_getBuys_rdh | /**
* Get all buy regions.
*
* @return List of all buy regions
*/
public List<BuyRegion> getBuys() {
List<BuyRegion> result = new ArrayList<>();
for (GeneralRegion region : regions.values()) {
if (region instanceof BuyRegion) {
result.add(((BuyRegion) (region)));
}
}return re... | 3.26 |
AreaShop_FileManager_loadDefaultFile_rdh | /**
* Load the default.yml file
*
* @return true if it has been loaded successfully, otherwise false
*/
public boolean loadDefaultFile() {
boolean result = true;
File defaultFile = new File(defaultPath);
// Safe the file from the jar to disk if it does not exist
if (!defaultFile.exists()) {
try (InputStream i... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.