name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
flink_QueryableStateClient_shutdownAndHandle_rdh | /**
* Shuts down the client and returns a {@link CompletableFuture} that will be completed when the
* shutdown process is completed.
*
* <p>If an exception is thrown for any reason, then the returned future will be completed
* exceptionally with that exception.
*
* @return A {@link CompletableFuture} for further... | 3.26 |
flink_QueryableStateClient_setUserClassLoader_rdh | /**
* * Replaces the existing {@link ClassLoader} (possibly {@code null}), with the provided one.
*
* @param userClassLoader
* The new {@code userClassLoader}.
* @return The old classloader, or {@code null} if none was specified.
*/
public ClassLoader setUserClassLoader(ClassLoa... | 3.26 |
flink_QueryableStateClient_getExecutionConfig_rdh | /**
* Gets the {@link ExecutionConfig}.
*/
public ExecutionConfig getExecutionConfig() {
return executionConfig;
} | 3.26 |
flink_QueryableStateClient_setExecutionConfig_rdh | /**
* Replaces the existing {@link ExecutionConfig} (possibly {@code null}), with the provided one.
*
* @param config
* The new {@code configuration}.
* @return The old configuration, or {@code null} if none was specified.
*/
public ExecutionConfig setExecutionConfig(ExecutionConfig config) {
ExecutionConfi... | 3.26 |
flink_StreamExecTemporalSort_createSortProcTime_rdh | /**
* Create Sort logic based on processing time.
*/
private Transformation<RowData> createSortProcTime(RowType inputType, Transformation<RowData> inputTransform, ExecNodeConfig config, ClassLoader classLoader) {
// if the order has secondary sorting fields in addition to the proctime
if (sort... | 3.26 |
flink_StreamExecTemporalSort_createSortRowTime_rdh | /**
* Create Sort logic based on row time.
*/
private Transformation<RowData> createSortRowTime(RowType inputType, Transformation<RowData> inputTransform, ExecNodeConfig config, ClassLoader classLoader) {
GeneratedRecordComparator rowComparator = null;
if (sortSpec.getFieldSize() > 1) {
// skip the f... | 3.26 |
flink_AbstractServerBase_m0_rdh | /**
* Starts the server by binding to the configured bind address (blocking).
*
* @throws Exception
* If something goes wrong during the bind operation.
*/
public void m0() throws Throwable {
Preconditions.checkState((f1 == null) && (serverShutdownFuture.get() == null), ((serverName + " is already running @... | 3.26 |
flink_AbstractServerBase_createQueryExecutor_rdh | /**
* Creates a thread pool for the query execution.
*
* @return Thread pool for query execution
*/
private ExecutorService createQueryExecutor() {ThreadFactory threadFactory
= new ThreadFactoryBuilder().setDaemon(true).setNameFormat(("Flink " + getServerName()) + " Thread %d").build();
return Executors.... | 3.26 |
flink_AbstractServerBase_getQueryExecutor_rdh | /**
* Returns the thread-pool responsible for processing incoming requests.
*/
protected ExecutorService getQueryExecutor() {
return queryExecutor;
} | 3.26 |
flink_AbstractServerBase_attemptToBind_rdh | /**
* Tries to start the server at the provided port.
*
* <p>This, in conjunction with {@link #start()}, try to start the server on a free port among
* the port range provided at the constructor.
*
* @param port
* the port to try to bind the server to.
* @throws Exception
* If something goes wrong during t... | 3.26 |
flink_AbstractServerBase_getServerAddress_rdh | /**
* Returns the address of this server.
*
* @return AbstractServerBase address
* @throws IllegalStateException
* If server has not been started yet
*/
public InetSocketAddress getServerAddress() {
Preconditions.checkState(f1 != null, ("Server " + serverName) + " has not been started.");
return f1;
} | 3.26 |
flink_RelativeFileStateHandle_equals_rdh | // ------------------------------------------------------------------------
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof RelativeFileStateHandle)) {
return false;
}
RelativeFileStateHandle v0 = ((RelativeFileStateHandle) (o));
ret... | 3.26 |
flink_ListElement_list_rdh | /**
* Creates a list with blocks of text. For example:
*
* <pre>{@code .list(
* text("this is first element of list"),
* text("this is second element of list with a %s", link("https://link"))
* )}</pre>
*
* @param elements
* list of this list entries
* @return list representation
*/
public static ListEle... | 3.26 |
flink_TumbleWithSizeOnTime_as_rdh | /**
* Assigns an alias for this window that the following {@code groupBy()} and {@code select()}
* clause can refer to. {@code select()} statement can access window properties such as window
* start or end time.
*
* @param alias
* alias for this window
* @return this window
*/
public TumbleWithSizeOnTimeWithA... | 3.26 |
flink_ContinuousFileSplitEnumerator_processDiscoveredSplits_rdh | // ------------------------------------------------------------------------
private void processDiscoveredSplits(Collection<FileSourceSplit> splits, Throwable error) {
if (error != null)
{
LOG.error("Failed to enumerate files", error);
return;
}
final Collection<FileSourceSplit> newSplits = splits.stream().filt... | 3.26 |
flink_Predicates_arePublicFinalOfTypeWithAnnotation_rdh | /**
* Tests that the field is {@code public final}, has the fully qualified type name of {@code fqClassName} and is annotated with the {@code annotationType}.
*/
public static DescribedPredicate<JavaField> arePublicFinalOfTypeWithAnnotation(String fqClassName, Class<? extends Annotation> annotationType) {
ret... | 3.26 |
flink_Predicates_getClassSimpleNameFromFqName_rdh | /**
* Extracts the class name from the given fully qualified class name.
*
* <p>Example:
*
* <pre>
* getClassFromFqName("com.example.MyClass"); // Returns: "MyClass"
* </pre>
*/
public static String getClassSimpleNameFromFqName(String fqClassName) {
// Not using Preconditions to avoid adding non-test f... | 3.26 |
flink_Predicates_arePublicStaticOfType_rdh | /**
* Tests that the given field is {@code public static} and has the fully qualified type name of
* {@code fqClassName}.
*
* <p>Attention: changing the description will add a rule into the stored.rules.
*/
public static DescribedPredicate<JavaField> arePublicStaticOfType(String fqClassName) {
return areFie... | 3.26 |
flink_Predicates_arePublicStaticFinalOfType_rdh | /**
* Tests that the field is {@code public static final} and has the fully qualified type name of
* {@code fqClassName}.
*/
public static DescribedPredicate<JavaField> arePublicStaticFinalOfType(String fqClassName) {
return arePublicStaticO... | 3.26 |
flink_Predicates_areFieldOfType_rdh | /**
* Tests that the field has the fully qualified type of {@code fqClassName} with the given
* modifiers.
*
* <p>Attention: changing the description will add a rule into the stored.rules.
*/
public static DescribedPredicate<JavaField> areFieldOfType(String fqClassName, JavaModifier... modifiers) {
return Desc... | 3.26 |
flink_Predicates_containAnyFieldsInClassHierarchyThat_rdh | /**
*
* @return A {@link DescribedPredicate} returning true, if and only if the predicate {@link JavaField} could be found in the {@link JavaClass}.
*/
public static DescribedPredicate<JavaClass> containAnyFieldsInClassHierarchyThat(DescribedPredicate<? super JavaField> predicate) {
return new ContainAnyFi... | 3.26 |
flink_Predicates_arePublicStaticFinalOfTypeWithAnnotation_rdh | /**
* Tests that the field is {@code public static final}, has the fully qualified type name of
* {@code fqClassName} and is annotated with the {@code annotationType}.
*/
public static DescribedPredicate<JavaField> arePublicStaticFinalOfTypeWithAnnotation(String fqClassName, Class<? extends Annotation> annotationTyp... | 3.26 |
flink_Predicates_exactlyOneOf_rdh | /**
* Returns a {@link DescribedPredicate} that returns true if one and only one of the given
* predicates match.
*/
@SafeVarargs
public static <T> DescribedPredicate<T> exactlyOneOf(final DescribedPredicate<? super T>... other) {
return DescribedPredicate.describe("only one of the following predicates match:\n"... | 3.26 |
flink_Predicates_areStaticFinalOfTypeWithAnnotation_rdh | /**
* Tests that the field is {@code static final}, has the fully qualified type name of {@code fqClassName} and is annotated with the {@code annotationType}. It doesn't matter if public,
* private or protected.
*/
public static DescribedPredicate<JavaField> areStaticFinalOfTypeWithAnnotation(String fqClassName, Cla... | 3.26 |
flink_Predicates_arePublicFinalOfType_rdh | /**
* Tests that the given field is {@code public final}, not {@code static} and has the given
* fully qualified type name of {@code fqClassName}.
*/public static DescribedPredicate<JavaField> arePublicFinalOfType(String fqClassName) {
return is(ofType(fqClassName)).and(isPublic()).and(isFinal()).and(isNotStat... | 3.26 |
flink_ParserImpl_parse_rdh | /**
* When parsing statement, it first uses {@link ExtendedParser} to parse statements. If {@link ExtendedParser} fails to parse statement, it uses the {@link CalciteParser} to parse
* statements.
*
* @param statement
* input statement.
* @return parsed operations.
*/
@Override
public List<Operation> parse(Str... | 3.26 |
flink_RichInputFormat_closeInputFormat_rdh | /**
* Closes this InputFormat instance. This method is called once per parallel instance. Resources
* allocated during {@link #openInputFormat()} should be closed in this method.
*
* @see InputFormat
* @throws IOException
* in case closing the resources failed
*/@PublicEvolving
... | 3.26 |
flink_RichInputFormat_openInputFormat_rdh | /**
* Opens this InputFormat instance. This method is called once per parallel instance. Resources
* should be allocated in this method. (e.g. database connections, cache, etc.)
*
* @see InputFormat
* @throws IOException
* in case allocating the resources failed.
*/
@PublicEvolving
public void openInputFormat(... | 3.26 |
flink_PackagedProgramUtils_createJobGraph_rdh | /**
* Creates a {@link JobGraph} with a random {@link JobID} from the given {@link PackagedProgram}.
*
* @param packagedProgram
* to extract the JobGraph from
* @param configuration
* to use for the optimizer and job graph generator
* @param defaultParallelism
* for the JobGraph
* @param suppressOutput
... | 3.26 |
flink_MapOperatorBase_executeOnCollections_rdh | // --------------------------------------------------------------------------------------------
@Override
protected List<OUT> executeOnCollections(List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {MapFunction<IN, OUT> function = this.userFunction.getUserCodeObject();
Fun... | 3.26 |
flink_DoubleHashSet_contains_rdh | /**
* See {@link Double#equals(Object)}.
*/
public boolean contains(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
return this.containsZero;
} else {
double[] key = this.key;
long curr;
int v7;
if ((curr = Double.doubleToLongBits... | 3.26 |
flink_DoubleHashSet_add_rdh | /**
* See {@link Double#equals(Object)}.
*/
public boolean add(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
if (this.containsZero) {
return false;
}
this.containsZero = true;
} else {
double[] key = this.key;
int pos;... | 3.26 |
flink_MergingWindowSet_getStateWindow_rdh | /**
* Returns the state window for the given in-flight {@code Window}. The state window is the
* {@code Window} in which we keep the actual state of a given in-flight window. Windows might
* expand but we keep to original state window for keeping the elements of the window to avoid
* costly state juggling.
*
* @p... | 3.26 |
flink_MergingWindowSet_persist_rdh | /**
* Persist the updated mapping to the given state if the mapping changed since initialization.
*/
public void persist() throws Exception {
if (!mapping.equals(initialMapping)) {state.update(mapping.entrySet().stream().map(w -> new Tuple2<>(w.getKey(), w.getValue())).collect(Collectors.toList()));
}
} | 3.26 |
flink_MergingWindowSet_retireWindow_rdh | /**
* Removes the given window from the set of in-flight windows.
*
* @param window
* The {@code Window} to remove.
*/
public void retireWindow(W window)
{
W removed = this.mapping.remove(window);
if (removed == null) {
throw new IllegalStateException(("Window " + window) + " is not in in-flight window set... | 3.26 |
flink_TriConsumerWithException_unchecked_rdh | /**
* Convert a {@link TriConsumerWithException} into a {@link TriConsumer}.
*
* @param triConsumerWithException
* TriConsumer with exception to convert into a {@link TriConsumer}.
* @param <A>
* first input type
* @param <B>
* second input type
* @param <C>
* third input type
* @return {@link TriCon... | 3.26 |
flink_WritableComparator_checkKryoInitialized_rdh | // --------------------------------------------------------------------------------------------
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
Kryo.DefaultInstantiatorStrategy instantiatorStrategy = new Kryo.DefaultInstantiatorStrategy();
instantia... | 3.26 |
flink_WritableComparator_supportsSerializationWithKeyNormalization_rdh | // --------------------------------------------------------------------------------------------
// unsupported normalization
// --------------------------------------------------------------------------------------------
@Override
public boolean supportsSerializationWithKeyNormalization() {
return false;
} | 3.26 |
flink_MetricOptions_forReporter_rdh | /**
* Returns a view over the given configuration via which options can be set/retrieved for the
* given reporter.
*
* <pre>
* Configuration config = ...
* MetricOptions.forReporter(config, "my_reporter")
* .set(MetricOptions.REPORTER_INTERVAL, Duration.ofSeconds(10))
* ...
* </pre>
*
... | 3.26 |
flink_OrInputTypeStrategy_commonMax_rdh | /**
* Returns the common maximum argument count or null if undefined.
*/
@Nullable
private static Integer commonMax(List<ArgumentCount> counts) {// max=5, max=3, max=0 -> max=5
// max=5, max=3, max=0, max=null -> max=null
int commonMax = Integer.MIN_VALUE;
for (ArgumentCount count : counts) {
... | 3.26 |
flink_OrInputTypeStrategy_commonMin_rdh | // --------------------------------------------------------------------------------------------
/**
* Returns the common minimum argument count or null if undefined.
*/
@Nullable
private static Integer commonMin(List<ArgumentCount> counts) {
// min=5, min=3, min=0 -> min=0
// min=5, min=3, min=0, min=null -... | 3.26 |
flink_AsyncClient_query_rdh | /**
* A simple asynchronous client that simulates interacting with an unreliable external service.
*/public class AsyncClient {
public CompletableFuture<String> query(int key) {
return CompletableFuture.supplyAsync(() -> {
long sleep = ((long) (ThreadLocalRandom.current().nextFloat() * 100));
... | 3.26 |
flink_CheckpointOptions_getCheckpointType_rdh | // ------------------------------------------------------------------------
/**
* Returns the type of checkpoint to perform.
*/
public SnapshotType getCheckpointType() {
return checkpointType;} | 3.26 |
flink_CheckpointOptions_hashCode_rdh | // ------------------------------------------------------------------------
@Overridepublic int hashCode() {
return Objects.hash(targetLocation, checkpointType, alignmentType,
f0);
} | 3.26 |
flink_CheckpointOptions_getTargetLocation_rdh | /**
* Returns the target location for the checkpoint.
*/
public CheckpointStorageLocationReference getTargetLocation() {return targetLocation;
} | 3.26 |
flink_ScalaFutureUtils_toJava_rdh | /**
* Converts a Scala {@link Future} to a {@link CompletableFuture}.
*
* @param scalaFuture
* to convert to a Java 8 CompletableFuture
* @param <T>
* type of the future value
* @param <U>
* type of the original future
* @return Java 8 CompletableFuture
*/
public static <T, U extends T> CompletableFut... | 3.26 |
flink_ContextResolvedFunction_isTemporary_rdh | /**
*
* @return true if the function is temporary. An anonymous function is always temporary.
*/
public boolean isTemporary() {
return isTemporary;
} | 3.26 |
flink_HiveTableInputFormat_addSchemaToConf_rdh | // Hive readers may rely on the schema info in configuration
private void addSchemaToConf(JobConf jobConf) {
// set columns/types -- including partition cols
List<String> typeStrs = Arrays.stream(fieldTypes).map(t -> HiveTypeUtil.toHiveTypeInfo(t, true).toString()).collect(Collectors.toList());
jobConf.set(... | 3.26 |
flink_AbstractOrcNoHiveVector_createFlinkVectorFromConstant_rdh | /**
* Create flink vector by hive vector from constant.
*/
public static ColumnVector createFlinkVectorFromConstant(LogicalType
type, Object value, int batchSize) {
return createFlinkVector(createHiveVectorFromConstant(type, value, batchSize));
} | 3.26 |
flink_AbstractOrcNoHiveVector_createHiveVectorFromConstant_rdh | /**
* Create a orc vector from partition spec value. See hive {@code VectorizedRowBatchCtx#addPartitionColsToBatch}.
*/
private static ColumnVector createHiveVectorFromConstant(LogicalType type, Object value, int batchSize) {
switch (type.getTypeRoot()) {
case CHAR :
case VARCHAR :
case... | 3.26 |
flink_RankProcessStrategy_analyzeRankProcessStrategies_rdh | /**
* Gets {@link RankProcessStrategy} based on input, partitionKey and orderKey.
*/
static List<RankProcessStrategy> analyzeRankProcessStrategies(StreamPhysicalRel rank, ImmutableBitSet partitionKey, RelCollation orderKey) {
FlinkRelMetadataQuery mq = ((FlinkRelMetadataQuery) (rank.getCluster().getMetadataQuery(... | 3.26 |
flink_HiveDeclarativeAggregateFunction_getTypeInference_rdh | /**
* This method is used to infer result type when generate {@code AggregateCall} of calcite.
*/
public TypeInference getTypeInference(DataTypeFactory factory) {
return TypeInference.newBuilder().outputTypeStrategy(new HiveAggregateFunctionOutputStrategy(this)).build();
} | 3.26 |
flink_KMeans_getCentroidDataSet_rdh | // *************************************************************************
// DATA SOURCE READING (POINTS AND CENTROIDS)
// *************************************************************************
private static DataSet<Centroid> getCentroidDataSet(ParameterTool params, ExecutionEnvironment env) {
DataSet<Centro... | 3.26 |
flink_KMeans_open_rdh | /**
* Reads the centroid values from a broadcast variable into a collection.
*/
@Override
public void open(OpenContext openContext) throws Exception
{
this.centroids = getRuntimeContext().getBroadcastVariable("centroids");
} | 3.26 |
flink_StateMetadata_validateStateMetadata_rdh | /**
* Validate deserialized state metadata from json content of {@link org.apache.flink.table.api.CompiledPlan}.
*
* @param inputNumOfOperator
* the input number of the stateful operator that the exec node to
* translate to.
* @param stateMetadataList
* the deserialized state metadata list.
*/
private sta... | 3.26 |
flink_PythonEnvUtils_preparePythonEnvironment_rdh | /**
* Prepares PythonEnvironment to start python process.
*
* @param config
* The Python configurations.
* @param entryPointScript
* The entry point script, optional.
* @param tmpDir
* The temporary directory which files will be copied to.
* @return PythonEnvironment the Python environment which will be ... | 3.26 |
flink_PythonEnvUtils_createSymbolicLink_rdh | /**
* Creates symbolLink in working directory for pyflink lib.
*
* @param libPath
* the pyflink lib file path.
* @param symbolicLinkPath
* the symbolic link to pyflink lib.
*/
private static void createSymbolicLink(Path libPath, Path symbolicLinkPath) throws IOException {
try {
Files.createSymb... | 3.26 |
flink_PythonEnvUtils_startPythonProcess_rdh | /**
* Starts python process.
*
* @param pythonEnv
* the python Environment which will be in a process.
* @param commands
* the commands that python process will execute.
* @return the process represent the python process.
* @throws IOException
* Thrown if an error occurred when python process start.
*/
... | 3.26 |
flink_PythonEnvUtils_resetCallbackClientExecutorService_rdh | /**
* Reset a daemon thread to the callback client thread pool so that the callback server can be
* terminated when gate way server is shutting down. We need to shut down the none-daemon thread
* firstly, then set a new thread created in a daemon thread to the ExecutorService.
*
* @param gatewayServer
* the gat... | 3.26 |
flink_PythonEnvUtils_resetCallbackClient_rdh | /**
* Reset the callback client of gatewayServer with the given callbackListeningAddress and
* callbackListeningPort after the callback server started.
*
* @param callbackServerListeningAddress
* the listening address of the callback server.
* @param callbackServerListeningPort
* the listening port of the ca... | 3.26 |
flink_CheckpointStatsTracker_createSnapshot_rdh | /**
* Creates a new snapshot of the available stats.
*
* @return The latest statistics snapshot.
*/public CheckpointStatsSnapshot createSnapshot() {
CheckpointStatsSnapshot
snapshot = latestSnapshot;
// Only create a new snapshot if dirty and no update in progress,
// because we don't want to block ... | 3.26 |
flink_CheckpointStatsTracker_reportRestoredCheckpoint_rdh | /**
* Callback when a checkpoint is restored.
*
* @param restored
* The restored checkpoint stats.
*/
void reportRestoredCheckpoint(RestoredCheckpointStats restored) {
checkNotNull(restored, "Restored checkpoint");
statsReadWriteLock.lock();
try {
counts.incrementRestoredCheckpoints();
... | 3.26 |
flink_CheckpointStatsTracker_m0_rdh | /**
* Callback when a checkpoint failure without in progress checkpoint. For example, it should be
* callback when triggering checkpoint failure before creating PendingCheckpoint.
*/
public void m0() {
statsReadWriteLock.lock();
try {
counts.incrementFailedCheckpointsWithoutInProgress();
dirt... | 3.26 |
flink_CheckpointStatsTracker_reportPendingCheckpoint_rdh | // ------------------------------------------------------------------------
// Callbacks
// ------------------------------------------------------------------------
/**
* Creates a new pending checkpoint tracker.
*
* @param checkpointId
* ID of the checkpoint.
* @param triggerTimestamp
* Trigger timestamp of ... | 3.26 |
flink_CheckpointStatsTracker_registerMetrics_rdh | /**
* Register the exposed metrics.
*
* @param metricGroup
* Metric group to use for the metrics.
*/
private void registerMetrics(MetricGroup metricGroup) {
metricGroup.gauge(NUMBER_OF_CHECKPOINTS_METRIC, new CheckpointsCounter());
metricGroup.gauge(NUMBER_OF_IN_PROGRESS_CHECKPOINTS_METRIC, new InProgres... | 3.26 |
flink_CheckpointStatsTracker_reportCompletedCheckpoint_rdh | /**
* Callback when a checkpoint completes.
*
* @param completed
* The completed checkpoint stats.
*/
void reportCompletedCheckpoint(CompletedCheckpointStats completed) {
statsReadWriteLock.lock();
try {
latestCompletedCheckpoint = completed;
counts.incrementCompletedCheckpoints();
... | 3.26 |
flink_CheckpointStatsTracker_reportFailedCheckpoint_rdh | /**
* Callback when a checkpoint fails.
*
* @param failed
* The failed checkpoint stats.
*/
void reportFailedCheckpoint(FailedCheckpointStats failed) {
statsReadWriteLock.lock();
try {
counts.incrementFailedCheckpoints();
history.replacePendingCheckpointById(failed);
dirty = true;... | 3.26 |
flink_UniqueConstraint_asSummaryString_rdh | /**
* Returns constraint's summary. All constraints summary will be formatted as
*
* <pre>
* CONSTRAINT [constraint-name] [constraint-type] ([constraint-definition])
*
* E.g CONSTRAINT pk PRIMARY KEY (f0, f1)
* </pre>
*/
@Overridepublic final String asSummaryString() {
final String typeString;
switch (m... | 3.26 |
flink_UniqueConstraint_getColumns_rdh | /**
* List of column names for which the primary key was defined.
*/
public List<String> getColumns() {
return columns;
} | 3.26 |
flink_UniqueConstraint_primaryKey_rdh | /**
* Creates a non enforced {@link ConstraintType#PRIMARY_KEY} constraint.
*/
public static UniqueConstraint primaryKey(String name, List<String> columns) {
return new UniqueConstraint(name, false, ConstraintType.PRIMARY_KEY, columns);
} | 3.26 |
flink_SharedResourceHolder_release_rdh | /**
* Releases an instance of the given resource.
*
* <p>The instance must have been obtained from {@link #get(Resource)}. Otherwise will throw
* IllegalArgumentException.
*
* <p>Caller must not release a reference more than once. It's advisory that you clear the
* reference to the instance with the null returne... | 3.26 |
flink_SharedResourceHolder_m0_rdh | /**
* Visible to unit tests.
*
* @see #get(Resource)
*/
@SuppressWarnings("unchecked")
synchronized <T> T m0(Resource<T> resource) {
Instance instance = instances.get(resource);
if (instance == null) {
instance = new Instance(resource.create());
instances.put(resource, instance);
}
i... | 3.26 |
flink_SharedResourceHolder_get_rdh | /**
* Try to get an existing instance of the given resource. If an instance does not exist, create
* a new one with the given factory.
*
* @param resource
* the singleton object that identifies the requested static resource
*/
public static <T> T get(Resource<T> resource) {
return holder.m0(resource);
} | 3.26 |
flink_SharedResourceHolder_releaseInternal_rdh | /**
* Visible to unit tests.
*/
synchronized <T>
T releaseInternal(final Resource<T> resource, final T instance) {
final Instance cached = instances.get(resource);
if (cached == null) {
throw new IllegalArgumentException("No cached instance found for " + resource);
}Preconditions.checkArgument(... | 3.26 |
flink_TopNBuffer_containsKey_rdh | /**
* Returns {@code true} if the buffer contains a mapping for the specified key.
*
* @param key
* key whose presence in the buffer is to be tested
* @return {@code true} if the buffer contains a mapping for the specified key
*/ public boolean containsKey(RowData key) {
return f0.containsKey(key);
} | 3.26 |
flink_TopNBuffer_entrySet_rdh | /**
* Returns a {@link Set} view of the mappings contained in the buffer.
*/public Set<Map.Entry<RowData, Collection<RowData>>> entrySet() {
return f0.entrySet();
} | 3.26 |
flink_TopNBuffer_getCurrentTopNum_rdh | /**
* Gets number of total records.
*
* @return the number of total records.
*/
public int getCurrentTopNum() {
return currentTopNum;
} | 3.26 |
flink_TopNBuffer_getElement_rdh | /**
* Gets record which rank is given value.
*
* @param rank
* rank value to search
* @return the record which rank is given value
*/
public RowData getElement(int rank) {
int curRank = 0;
for (Map.Entry<RowData, Collection<RowData>> entry : f0.entrySet()) {Collection<RowData> collection = entry.getValue();
... | 3.26 |
flink_TopNBuffer_lastEntry_rdh | /**
* Returns the last Entry in the buffer. Returns null if the TreeMap is empty.
*/
public Map.Entry<RowData, Collection<RowData>> lastEntry() { return f0.lastEntry();
} | 3.26 |
flink_TopNBuffer_put_rdh | /**
* Appends a record into the buffer.
*
* @param sortKey
* sort key with which the specified value is to be associated
* @param value
* record which is to be appended
* @return the size of the collection under the sortKey.
*/
public int put(RowData sortKey, RowData ... | 3.26 |
flink_TopNBuffer_removeAll_rdh | /**
* Removes all record list from the buffer under the sortKey.
*
* @param sortKey
* key to remove
*/
public void removeAll(RowData sortKey) {
Collection<RowData> collection = f0.get(sortKey);
if (collection != null) {
currentTopNum -=
collection.size(); f0.remove(sortKey);
}
} | 3.26 |
flink_TopNBuffer_removeLast_rdh | /**
* Removes the last record of the last Entry in the buffer.
*
* @return removed record
*/
public RowData removeLast() {
Map.Entry<RowData, Collection<RowData>> last = f0.lastEntry();
RowData lastElement = null;
if (last != null) {
Collection<RowData> collection = last.getValue();
if... | 3.26 |
flink_TopNBuffer_getSortKeyComparator_rdh | /**
* Gets sort key comparator used by buffer.
*
* @return sort key comparator used by buffer
*/
public Comparator<RowData> getSortKeyComparator() {
return sortKeyComparator;
} | 3.26 |
flink_TopNBuffer_checkSortKeyInBufferRange_rdh | /**
* Checks whether the record should be put into the buffer.
*
* @param sortKey
* sortKey to test
* @param topNum
* buffer to add
* @return true if the record should be put into the buffer.
*/
public boolean checkSortKeyInBufferRange(RowData sortKey, long topNum) {
Comparator<RowData> comparator = ge... | 3.26 |
flink_TopNBuffer_putAll_rdh | /**
* Puts a record list into the buffer under the sortKey. Note: if buffer already contains
* sortKey, putAll will overwrite the previous value
*
* @param sortKey
* sort key with which the specified values are to be associated
* @param values
* record lists to be associated with the specified key
*/
public... | 3.26 |
flink_TopNBuffer_get_rdh | /**
* Gets the record list from the buffer under the sortKey.
*
* @param sortKey
* key to get
* @return the record list from the buffer under the sortKey
*/
public Collection<RowData> get(RowData sortKey) {
return f0.get(sortKey);
} | 3.26 |
flink_EventTimeTriggers_withEarlyFirings_rdh | /**
* Creates a new {@code Trigger} like the this, except that it fires repeatedly whenever the
* given {@code Trigger} fires before the watermark has passed the end of the window.
*/
public AfterEndOfWindowNoLate<W> withEarlyFirings(Trigger<W> earlyFirings) {
checkNotNull(earlyFirings);
return new AfterEndO... | 3.26 |
flink_EventTimeTriggers_afterEndOfWindow_rdh | /**
* Creates a trigger that fires when the watermark passes the end of the window.
*/
public static <W extends Window> AfterEndOfWindow<W> afterEndOfWindow() {
return new AfterEndOfWindow<>();
} | 3.26 |
flink_EventTimeTriggers_withLateFirings_rdh | /**
* Creates a new {@code Trigger} like the this, except that it fires repeatedly whenever the
* given {@code Trigger} fires after the watermark has passed the end of the window.
*/
public Trigger<W> withLateFirings(Trigger<W> lateFirings) {
checkNotNull(lateFirings);
if (lateFirings instanceof ElementTriggers.Ever... | 3.26 |
flink_Expander_expanded_rdh | /**
* Expands identifiers in a given SQL string, returning a {@link Expanded}.
*/
public Expanded expanded(String ori) {
final Map<SqlParserPos, SqlIdentifier> identifiers = new HashMap<>();
final Map<String, SqlIdentifier> funcNameToId = new HashMap<>();
final SqlNode
oriNode = planner.parser().parse... | 3.26 |
flink_Expander_substitute_rdh | /**
* Returns the SQL string with identifiers replaced according to the given unparse function.
*/
public String substitute(Function<SqlNode, String> fn) {
final SqlShuttle shuttle = new SqlShuttle() {
@Override
public SqlNode visit(SqlCall call) {
SqlOperator operator = cal... | 3.26 |
flink_Expander_create_rdh | /**
* Creates an Expander. *
*/
public static Expander create(FlinkPlannerImpl planner) {
return new Expander(planner);
} | 3.26 |
flink_CatalogBaseTable_getUnresolvedSchema_rdh | /**
* Returns the schema of the table or view.
*
* <p>The schema can reference objects from other catalogs and will be resolved and validated by
* the framework when accessing the table or view.
*
* @see ResolvedCatalogTable
* @see ResolvedCatalogView
*/
default Schema getUnresolvedSchema() {
final TableSch... | 3.26 |
flink_AvailabilityProvider_resetUnavailable_rdh | /**
* Judges to reset the current available state as unavailable.
*/
public void resetUnavailable() {
if (isAvailable()) {
availableFuture = new CompletableFuture<>();
}
} | 3.26 |
flink_AvailabilityProvider_resetAvailable_rdh | /**
* Resets the constant completed {@link #AVAILABLE} as the current state.
*/
public void resetAvailable() {
availableFuture = AVAILABLE;
} | 3.26 |
flink_AvailabilityProvider_isAvailable_rdh | /**
* In order to best-effort avoid volatile access in {@link CompletableFuture#isDone()}, we check
* the condition of <code>future == AVAILABLE</code> firstly for getting probable performance
* benefits while hot looping.
*
* <p>It is always safe to use this method in performance nonsensitive scenarios to get the... | 3.26 |
flink_AvailabilityProvider_isApproximatelyAvailable_rdh | /**
* Checks whether this instance is available only via constant {@link #AVAILABLE} to avoid
* performance concern caused by volatile access in {@link CompletableFuture#isDone()}. So it is
* mainly used in the performance sensitive scenarios which do not always need the precise
* state.
*
* <p>This method is sti... | 3.26 |
flink_AvailabilityProvider_getAvailableFuture_rdh | /**
*
* @return a future that is completed if the respective provider is available.
*/
@Override
public CompletableFuture<?> getAvailableFuture() {
return availableFuture;
} | 3.26 |
flink_AvailabilityProvider_getUnavailableToResetAvailable_rdh | /**
* Returns the previously not completed future and resets the constant completed {@link #AVAILABLE} as the current state.
*/public CompletableFuture<?>
getUnavailableToResetAvailable() {
CompletableFuture<?> toNotify = availableFuture;
availableFuture = AVAILABLE;
return toNotify;
} | 3.26 |
flink_BinaryHashTable_m0_rdh | // ================================ internal method ===========================================
/**
* Determines the number of buffers to be used for asynchronous write behind. It is currently
* computed as the logarithm of the number of buffers to the base 4, rounded up, minus 2. The
* upper limit for the number of... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.