idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
15,200
private static long firstMondayOfFirstWeek ( int year ) { final long janFirst = ymdToJulian ( year , 1 , 1 ) ; final long janFirstDow = floorMod ( janFirst + 1 , 7 ) ; return janFirst + ( 11 - janFirstDow ) % 7 - 3 ; }
Returns the first day of the first week of a year . Per ISO - 8601 it is the Monday of the week that contains Jan 4 or equivalently it is a Monday between Dec 29 and Jan 4 . Sometimes it is in the year before the given year .
15,201
public static long addMonths ( long timestamp , int m ) { final long millis = DateTimeUtils . floorMod ( timestamp , DateTimeUtils . MILLIS_PER_DAY ) ; timestamp -= millis ; final long x = addMonths ( ( int ) ( timestamp / DateTimeUtils . MILLIS_PER_DAY ) , m ) ; return x * DateTimeUtils . MILLIS_PER_DAY + millis ; }
Adds a given number of months to a timestamp represented as the number of milliseconds since the epoch .
15,202
public static int addMonths ( int date , int m ) { int y0 = ( int ) DateTimeUtils . unixDateExtract ( TimeUnitRange . YEAR , date ) ; int m0 = ( int ) DateTimeUtils . unixDateExtract ( TimeUnitRange . MONTH , date ) ; int d0 = ( int ) DateTimeUtils . unixDateExtract ( TimeUnitRange . DAY , date ) ; int y = m / 12 ; y0 ...
Adds a given number of months to a date represented as the number of days since the epoch .
15,203
public static int subtractMonths ( int date0 , int date1 ) { if ( date0 < date1 ) { return - subtractMonths ( date1 , date0 ) ; } int m = ( date0 - date1 ) / 31 ; for ( ; ; ) { int date2 = addMonths ( date1 , m ) ; if ( date2 >= date0 ) { return m ; } int date3 = addMonths ( date1 , m + 1 ) ; if ( date3 > date0 ) { ret...
Finds the number of months between two dates each represented as the number of days since the epoch .
15,204
public static SingleInputSemanticProperties addSourceFieldOffset ( SingleInputSemanticProperties props , int numInputFields , int offset ) { SingleInputSemanticProperties offsetProps = new SingleInputSemanticProperties ( ) ; if ( props . getReadFields ( 0 ) != null ) { FieldSet offsetReadFields = new FieldSet ( ) ; for...
Creates SemanticProperties by adding an offset to each input field index of the given SemanticProperties .
15,205
public static DualInputSemanticProperties addSourceFieldOffsets ( DualInputSemanticProperties props , int numInputFields1 , int numInputFields2 , int offset1 , int offset2 ) { DualInputSemanticProperties offsetProps = new DualInputSemanticProperties ( ) ; if ( props . getReadFields ( 0 ) != null ) { FieldSet offsetRead...
Creates SemanticProperties by adding offsets to each input field index of the given SemanticProperties .
15,206
public static MemorySize parse ( String text , MemoryUnit defaultUnit ) throws IllegalArgumentException { if ( ! hasUnit ( text ) ) { return parse ( text + defaultUnit . getUnits ( ) [ 0 ] ) ; } return parse ( text ) ; }
Parses the given string with a default unit .
15,207
protected void buildInitialTable ( final MutableObjectIterator < BT > input ) throws IOException { final int partitionFanOut = getPartitioningFanOutNoEstimates ( this . availableMemory . size ( ) ) ; if ( partitionFanOut > MAX_NUM_PARTITIONS ) { throw new RuntimeException ( "Hash join partitions estimate exeeds maximum...
Creates the initial hash table . This method sets up partitions hash index and inserts the data from the given iterator .
15,208
final void buildBloomFilterForBucket ( int bucketInSegmentPos , MemorySegment bucket , HashPartition < BT , PT > p ) { final int count = bucket . getShort ( bucketInSegmentPos + HEADER_COUNT_OFFSET ) ; if ( count <= 0 ) { return ; } int [ ] hashCodes = new int [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { hashCode...
Set all the bucket memory except bucket header as the bit set of bloom filter and use hash code of build records to build bloom filter .
15,209
public static int getNumWriteBehindBuffers ( int numBuffers ) { int numIOBufs = ( int ) ( Math . log ( numBuffers ) / Math . log ( 4 ) - 1.5 ) ; return numIOBufs > 6 ? 6 : numIOBufs ; }
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 write behind buffers is however set to six .
15,210
public JobWithJars getPlanWithoutJars ( ) throws ProgramInvocationException { if ( isUsingProgramEntryPoint ( ) ) { return new JobWithJars ( getPlan ( ) , Collections . < URL > emptyList ( ) , classpaths , userCodeClassLoader ) ; } else { throw new ProgramInvocationException ( "Cannot create a " + JobWithJars . class ....
Returns the plan without the required jars when the files are already provided by the cluster .
15,211
public List < URL > getAllLibraries ( ) { List < URL > libs = new ArrayList < URL > ( this . extractedTempLibraries . size ( ) + 1 ) ; if ( jarFile != null ) { libs . add ( jarFile ) ; } for ( File tmpLib : this . extractedTempLibraries ) { try { libs . add ( tmpLib . getAbsoluteFile ( ) . toURI ( ) . toURL ( ) ) ; } c...
Returns all provided libraries needed to run the program .
15,212
private Plan getPlan ( ) throws ProgramInvocationException { if ( this . plan == null ) { Thread . currentThread ( ) . setContextClassLoader ( this . userCodeClassLoader ) ; this . plan = createPlanFromProgram ( this . program , this . args ) ; } return this . plan ; }
Returns the plan as generated from the Pact Assembler .
15,213
private static Plan createPlanFromProgram ( Program program , String [ ] options ) throws ProgramInvocationException { try { return program . getPlan ( options ) ; } catch ( Throwable t ) { throw new ProgramInvocationException ( "Error while calling the program: " + t . getMessage ( ) , t ) ; } }
Takes the jar described by the given file and invokes its pact assembler class to assemble a plan . The assembler class name is either passed through a parameter or it is read from the manifest of the jar . The assembler is handed the given options for its assembly .
15,214
public static TaskManagerServicesConfiguration fromConfiguration ( Configuration configuration , long maxJvmHeapMemory , InetAddress remoteAddress , boolean localCommunication ) { final String [ ] tmpDirs = ConfigurationUtils . parseTempDirectories ( configuration ) ; String [ ] localStateRootDir = ConfigurationUtils ....
Utility method to extract TaskManager config parameters from the configuration and to sanity check them .
15,215
public final void streamBufferWithGroups ( Iterator < IN1 > iterator1 , Iterator < IN2 > iterator2 , Collector < OUT > c ) { SingleElementPushBackIterator < IN1 > i1 = new SingleElementPushBackIterator < > ( iterator1 ) ; SingleElementPushBackIterator < IN2 > i2 = new SingleElementPushBackIterator < > ( iterator2 ) ; t...
Sends all values contained in both iterators to the external process and collects all results .
15,216
public TableOperation create ( SetTableOperationType type , TableOperation left , TableOperation right , boolean all ) { failIfStreaming ( type , all ) ; validateSetOperation ( type , left , right ) ; return new SetTableOperation ( left , right , type , all ) ; }
Creates a valid algebraic operation .
15,217
protected Union < T > translateToDataFlow ( Operator < T > input1 , Operator < T > input2 ) { return new Union < T > ( input1 , input2 , unionLocationName ) ; }
Returns the BinaryNodeTranslation of the Union .
15,218
public < T > T getFieldNotNull ( int pos ) { T field = getField ( pos ) ; if ( field != null ) { return field ; } else { throw new NullFieldException ( pos ) ; } }
Gets the field at the specified position throws NullFieldException if the field is null . Used for comparing key fields .
15,219
public static Tuple newInstance ( int arity ) { switch ( arity ) { case 0 : return Tuple0 . INSTANCE ; case 1 : return new Tuple1 ( ) ; case 2 : return new Tuple2 ( ) ; case 3 : return new Tuple3 ( ) ; case 4 : return new Tuple4 ( ) ; case 5 : return new Tuple5 ( ) ; case 6 : return new Tuple6 ( ) ; case 7 : return new...
GENERATED FROM org . apache . flink . api . java . tuple . TupleGenerator .
15,220
public final void streamBufferWithoutGroups ( Iterator < IN > iterator , Collector < OUT > c ) { SingleElementPushBackIterator < IN > i = new SingleElementPushBackIterator < > ( iterator ) ; try { int size ; if ( i . hasNext ( ) ) { while ( true ) { int sig = in . readInt ( ) ; switch ( sig ) { case SIGNAL_BUFFER_REQUE...
Sends all values contained in the iterator to the external process and collects all results .
15,221
protected < K , V > KafkaProducer < K , V > getKafkaProducer ( Properties props ) { return new KafkaProducer < > ( props ) ; }
Used for testing only .
15,222
public void invoke ( IN next , Context context ) throws Exception { checkErroneous ( ) ; byte [ ] serializedKey = schema . serializeKey ( next ) ; byte [ ] serializedValue = schema . serializeValue ( next ) ; String targetTopic = schema . getTargetTopic ( next ) ; if ( targetTopic == null ) { targetTopic = defaultTopic...
Called when new data arrives to the sink and forwards it to Kafka .
15,223
public < T > BroadcastVariableMaterialization < T , ? > materializeBroadcastVariable ( String name , int superstep , BatchTask < ? , ? > holder , MutableReader < ? > reader , TypeSerializerFactory < T > serializerFactory ) throws IOException { final BroadcastVariableKey key = new BroadcastVariableKey ( holder . getEnvi...
Materializes the broadcast variable for the given name scoped to the given task and its iteration superstep . An existing materialization created by another parallel subtask may be returned if it hasn t expired yet .
15,224
public void setGroupOrder ( int inputNum , Ordering order ) { if ( inputNum == 0 ) { this . groupOrder1 = order ; } else if ( inputNum == 1 ) { this . groupOrder2 = order ; } else { throw new IndexOutOfBoundsException ( ) ; } }
Sets the order of the elements within a group for the given input .
15,225
public Ordering appendOrdering ( Integer index , Class < ? extends Comparable < ? > > type , Order order ) { if ( index < 0 ) { throw new IllegalArgumentException ( "The key index must not be negative." ) ; } if ( order == null ) { throw new NullPointerException ( ) ; } if ( order == Order . NONE ) { throw new IllegalA...
Extends this ordering by appending an additional order requirement . If the index has been previously appended then the unmodified Ordering is returned .
15,226
protected AmazonKinesis createKinesisClient ( Properties configProps ) { ClientConfiguration awsClientConfig = new ClientConfigurationFactory ( ) . getConfig ( ) ; setAwsClientConfigProperties ( awsClientConfig , configProps ) ; AWSCredentialsProvider credentials = getCredentialsProvider ( configProps ) ; awsClientConf...
Creates an AmazonDynamoDBStreamsAdapterClient . Uses it as the internal client interacting with the DynamoDB streams .
15,227
public static String concat ( CharacterFilter filter , Character delimiter , String ... components ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( filter . filterCharacters ( components [ 0 ] ) ) ; for ( int x = 1 ; x < components . length ; x ++ ) { sb . append ( delimiter ) ; sb . append ( filter . filte...
Concatenates the given component names separated by the delimiter character . Additionally the character filter is applied to all component names .
15,228
public static void main ( String [ ] args ) throws IOException { String outputDirectory = args [ 0 ] ; for ( final RestAPIVersion apiVersion : RestAPIVersion . values ( ) ) { if ( apiVersion == RestAPIVersion . V0 ) { continue ; } createHtmlFile ( new DocumentingDispatcherRestEndpoint ( ) , apiVersion , Paths . get ( o...
Generates the REST API documentation .
15,229
@ SuppressWarnings ( "unchecked" ) public static < T extends SpecificRecord > TypeInformation < Row > convertToTypeInfo ( Class < T > avroClass ) { Preconditions . checkNotNull ( avroClass , "Avro specific record class must not be null." ) ; final Schema schema = SpecificData . get ( ) . getSchema ( avroClass ) ; retur...
Converts an Avro class into a nested row structure with deterministic field order and data types that are compatible with Flink s Table & SQL API .
15,230
@ SuppressWarnings ( "unchecked" ) public static < T > TypeInformation < T > convertToTypeInfo ( String avroSchemaString ) { Preconditions . checkNotNull ( avroSchemaString , "Avro schema must not be null." ) ; final Schema schema ; try { schema = new Schema . Parser ( ) . parse ( avroSchemaString ) ; } catch ( SchemaP...
Converts an Avro schema string into a nested row structure with deterministic field order and data types that are compatible with Flink s Table & SQL API .
15,231
public void registerTypeWithKryoSerializer ( Class < ? > type , Class < ? extends Serializer < ? > > serializerClass ) { config . registerTypeWithKryoSerializer ( type , serializerClass ) ; }
Registers the given Serializer via its class as a serializer for the given type at the KryoSerializer .
15,232
public < X > DataSource < X > fromCollection ( Collection < X > data ) { if ( data == null ) { throw new IllegalArgumentException ( "The data must not be null." ) ; } if ( data . size ( ) == 0 ) { throw new IllegalArgumentException ( "The size of the collection must not be empty." ) ; } X firstValue = data . iterator (...
Creates a DataSet from the given non - empty collection . The type of the data set is that of the elements in the collection .
15,233
public < X > DataSource < X > fromCollection ( Collection < X > data , TypeInformation < X > type ) { return fromCollection ( data , type , Utils . getCallLocationName ( ) ) ; }
Creates a DataSet from the given non - empty collection . Note that this operation will result in a non - parallel data source i . e . a data source with a parallelism of one .
15,234
private < X > DataSource < X > fromParallelCollection ( SplittableIterator < X > iterator , TypeInformation < X > type , String callLocationName ) { return new DataSource < > ( this , new ParallelIteratorInputFormat < > ( iterator ) , type , callLocationName ) ; }
private helper for passing different call location names
15,235
protected void registerCachedFilesWithPlan ( Plan p ) throws IOException { for ( Tuple2 < String , DistributedCacheEntry > entry : cacheFile ) { p . registerCachedFile ( entry . f0 , entry . f1 ) ; } }
Registers all files that were registered at this execution environment s cache registry of the given plan s cache registry .
15,236
private void processEvent ( NFAState nfaState , IN event , long timestamp ) throws Exception { try ( SharedBufferAccessor < IN > sharedBufferAccessor = partialMatches . getAccessor ( ) ) { Collection < Map < String , List < IN > > > patterns = nfa . process ( sharedBufferAccessor , nfaState , event , timestamp , afterM...
Process the given event by giving it to the NFA and outputting the produced set of matched event sequences .
15,237
private static < IN , OUT > SingleOutputStreamOperator < OUT > addOperator ( DataStream < IN > in , AsyncFunction < IN , OUT > func , long timeout , int bufSize , OutputMode mode ) { TypeInformation < OUT > outTypeInfo = TypeExtractor . getUnaryOperatorReturnType ( func , AsyncFunction . class , 0 , 1 , new int [ ] { 1...
Add an AsyncWaitOperator .
15,238
public static < IN , OUT > SingleOutputStreamOperator < OUT > unorderedWait ( DataStream < IN > in , AsyncFunction < IN , OUT > func , long timeout , TimeUnit timeUnit , int capacity ) { return addOperator ( in , func , timeUnit . toMillis ( timeout ) , capacity , OutputMode . UNORDERED ) ; }
Add an AsyncWaitOperator . The order of output stream records may be reordered .
15,239
public static < IN , OUT > SingleOutputStreamOperator < OUT > orderedWait ( DataStream < IN > in , AsyncFunction < IN , OUT > func , long timeout , TimeUnit timeUnit , int capacity ) { return addOperator ( in , func , timeUnit . toMillis ( timeout ) , capacity , OutputMode . ORDERED ) ; }
Add an AsyncWaitOperator . The order to process input records is guaranteed to be the same as input ones .
15,240
public String getJobParameter ( String key , String defaultValue ) { final GlobalJobParameters conf = context . getExecutionConfig ( ) . getGlobalJobParameters ( ) ; if ( conf != null && conf . toMap ( ) . containsKey ( key ) ) { return conf . toMap ( ) . get ( key ) ; } else { return defaultValue ; } }
Gets the global job parameter value associated with the given key as a string .
15,241
public static Deadline fromNow ( Duration duration ) { return new Deadline ( Math . addExact ( System . nanoTime ( ) , duration . toNanos ( ) ) ) ; }
Constructs a Deadline that is a given duration after now .
15,242
public void start ( ResourceManagerId newResourceManagerId , Executor newMainThreadExecutor , ResourceActions newResourceActions ) { LOG . info ( "Starting the SlotManager." ) ; this . resourceManagerId = Preconditions . checkNotNull ( newResourceManagerId ) ; mainThreadExecutor = Preconditions . checkNotNull ( newMain...
Starts the slot manager with the given leader id and resource manager actions .
15,243
public void suspend ( ) { LOG . info ( "Suspending the SlotManager." ) ; if ( taskManagerTimeoutCheck != null ) { taskManagerTimeoutCheck . cancel ( false ) ; taskManagerTimeoutCheck = null ; } if ( slotRequestTimeoutCheck != null ) { slotRequestTimeoutCheck . cancel ( false ) ; slotRequestTimeoutCheck = null ; } for (...
Suspends the component . This clears the internal state of the slot manager .
15,244
public boolean registerSlotRequest ( SlotRequest slotRequest ) throws SlotManagerException { checkInit ( ) ; if ( checkDuplicateRequest ( slotRequest . getAllocationId ( ) ) ) { LOG . debug ( "Ignoring a duplicate slot request with allocation id {}." , slotRequest . getAllocationId ( ) ) ; return false ; } else { Pendi...
Requests a slot with the respective resource profile .
15,245
public boolean unregisterSlotRequest ( AllocationID allocationId ) { checkInit ( ) ; PendingSlotRequest pendingSlotRequest = pendingSlotRequests . remove ( allocationId ) ; if ( null != pendingSlotRequest ) { LOG . debug ( "Cancel slot request {}." , allocationId ) ; cancelPendingSlotRequest ( pendingSlotRequest ) ; re...
Cancels and removes a pending slot request with the given allocation id . If there is no such pending request then nothing is done .
15,246
public void registerTaskManager ( final TaskExecutorConnection taskExecutorConnection , SlotReport initialSlotReport ) { checkInit ( ) ; LOG . debug ( "Registering TaskManager {} under {} at the SlotManager." , taskExecutorConnection . getResourceID ( ) , taskExecutorConnection . getInstanceID ( ) ) ; if ( taskManagerR...
Registers a new task manager at the slot manager . This will make the task managers slots known and thus available for allocation .
15,247
public boolean unregisterTaskManager ( InstanceID instanceId ) { checkInit ( ) ; LOG . debug ( "Unregister TaskManager {} from the SlotManager." , instanceId ) ; TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations . remove ( instanceId ) ; if ( null != taskManagerRegistration ) { internalUnregist...
Unregisters the task manager identified by the given instance id and its associated slots from the slot manager .
15,248
public boolean reportSlotStatus ( InstanceID instanceId , SlotReport slotReport ) { checkInit ( ) ; LOG . debug ( "Received slot report from instance {}: {}." , instanceId , slotReport ) ; TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations . get ( instanceId ) ; if ( null != taskManagerRegistrat...
Reports the current slot allocations for a task manager identified by the given instance id .
15,249
public void freeSlot ( SlotID slotId , AllocationID allocationId ) { checkInit ( ) ; TaskManagerSlot slot = slots . get ( slotId ) ; if ( null != slot ) { if ( slot . getState ( ) == TaskManagerSlot . State . ALLOCATED ) { if ( Objects . equals ( allocationId , slot . getAllocationId ( ) ) ) { TaskManagerRegistration t...
Free the given slot from the given allocation . If the slot is still allocated by the given allocation id then the slot will be marked as free and will be subject to new slot requests .
15,250
protected PendingSlotRequest findMatchingRequest ( ResourceProfile slotResourceProfile ) { for ( PendingSlotRequest pendingSlotRequest : pendingSlotRequests . values ( ) ) { if ( ! pendingSlotRequest . isAssigned ( ) && slotResourceProfile . isMatching ( pendingSlotRequest . getResourceProfile ( ) ) ) { return pendingS...
Finds a matching slot request for a given resource profile . If there is no such request the method returns null .
15,251
protected TaskManagerSlot findMatchingSlot ( ResourceProfile requestResourceProfile ) { Iterator < Map . Entry < SlotID , TaskManagerSlot > > iterator = freeSlots . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { TaskManagerSlot taskManagerSlot = iterator . next ( ) . getValue ( ) ; Preconditions . che...
Finds a matching slot for a given resource profile . A matching slot has at least as many resources available as the given resource profile . If there is no such slot available then the method returns null .
15,252
private void registerSlot ( SlotID slotId , AllocationID allocationId , JobID jobId , ResourceProfile resourceProfile , TaskExecutorConnection taskManagerConnection ) { if ( slots . containsKey ( slotId ) ) { removeSlot ( slotId ) ; } final TaskManagerSlot slot = createAndRegisterTaskManagerSlot ( slotId , resourceProf...
Registers a slot for the given task manager at the slot manager . The slot is identified by the given slot id . The given resource profile defines the available resources for the slot . The task manager connection can be used to communicate with the task manager .
15,253
private boolean updateSlot ( SlotID slotId , AllocationID allocationId , JobID jobId ) { final TaskManagerSlot slot = slots . get ( slotId ) ; if ( slot != null ) { final TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations . get ( slot . getInstanceId ( ) ) ; if ( taskManagerRegistration != null ...
Updates a slot with the given allocation id .
15,254
private void internalRequestSlot ( PendingSlotRequest pendingSlotRequest ) throws ResourceManagerException { final ResourceProfile resourceProfile = pendingSlotRequest . getResourceProfile ( ) ; TaskManagerSlot taskManagerSlot = findMatchingSlot ( resourceProfile ) ; if ( taskManagerSlot != null ) { allocateSlot ( task...
Tries to allocate a slot for the given slot request . If there is no slot available the resource manager is informed to allocate more resources and a timeout for the request is registered .
15,255
private void allocateSlot ( TaskManagerSlot taskManagerSlot , PendingSlotRequest pendingSlotRequest ) { Preconditions . checkState ( taskManagerSlot . getState ( ) == TaskManagerSlot . State . FREE ) ; TaskExecutorConnection taskExecutorConnection = taskManagerSlot . getTaskManagerConnection ( ) ; TaskExecutorGateway g...
Allocates the given slot for the given slot request . This entails sending a registration message to the task manager and treating failures .
15,256
private void handleFreeSlot ( TaskManagerSlot freeSlot ) { Preconditions . checkState ( freeSlot . getState ( ) == TaskManagerSlot . State . FREE ) ; PendingSlotRequest pendingSlotRequest = findMatchingRequest ( freeSlot . getResourceProfile ( ) ) ; if ( null != pendingSlotRequest ) { allocateSlot ( freeSlot , pendingS...
Handles a free slot . It first tries to find a pending slot request which can be fulfilled . If there is no such request then it will add the slot to the set of free slots .
15,257
private void removeSlot ( SlotID slotId ) { TaskManagerSlot slot = slots . remove ( slotId ) ; if ( null != slot ) { freeSlots . remove ( slotId ) ; if ( slot . getState ( ) == TaskManagerSlot . State . PENDING ) { rejectPendingSlotRequest ( slot . getAssignedSlotRequest ( ) , new Exception ( "The assigned slot " + slo...
Removes the given slot from the slot manager .
15,258
private void removeSlotRequestFromSlot ( SlotID slotId , AllocationID allocationId ) { TaskManagerSlot taskManagerSlot = slots . get ( slotId ) ; if ( null != taskManagerSlot ) { if ( taskManagerSlot . getState ( ) == TaskManagerSlot . State . PENDING && Objects . equals ( allocationId , taskManagerSlot . getAssignedSl...
Removes a pending slot request identified by the given allocation id from a slot identified by the given slot id .
15,259
private void handleFailedSlotRequest ( SlotID slotId , AllocationID allocationId , Throwable cause ) { PendingSlotRequest pendingSlotRequest = pendingSlotRequests . get ( allocationId ) ; LOG . debug ( "Slot request with allocation id {} failed for slot {}." , allocationId , slotId , cause ) ; if ( null != pendingSlotR...
Handles a failed slot request . The slot manager tries to find a new slot fulfilling the resource requirements for the failed slot request .
15,260
private void cancelPendingSlotRequest ( PendingSlotRequest pendingSlotRequest ) { CompletableFuture < Acknowledge > request = pendingSlotRequest . getRequestFuture ( ) ; returnPendingTaskManagerSlotIfAssigned ( pendingSlotRequest ) ; if ( null != request ) { request . cancel ( false ) ; } }
Cancels the given slot request .
15,261
protected FlinkKafkaConsumerBase < Row > getKafkaConsumer ( String topic , Properties properties , DeserializationSchema < Row > deserializationSchema ) { FlinkKafkaConsumerBase < Row > kafkaConsumer = createKafkaConsumer ( topic , properties , deserializationSchema ) ; switch ( startupMode ) { case EARLIEST : kafkaCon...
Returns a version - specific Kafka consumer with the start position configured .
15,262
public boolean triggerCheckpoint ( CheckpointMetaData checkpointMetaData , CheckpointOptions checkpointOptions , boolean advanceToEndOfEventTime ) throws Exception { throw new UnsupportedOperationException ( String . format ( "triggerCheckpoint not supported by %s" , this . getClass ( ) . getName ( ) ) ) ; }
This method is called to trigger a checkpoint asynchronously by the checkpoint coordinator .
15,263
public void triggerCheckpointOnBarrier ( CheckpointMetaData checkpointMetaData , CheckpointOptions checkpointOptions , CheckpointMetrics checkpointMetrics ) throws Exception { throw new UnsupportedOperationException ( String . format ( "triggerCheckpointOnBarrier not supported by %s" , this . getClass ( ) . getName ( )...
This method is called when a checkpoint is triggered as a result of receiving checkpoint barriers on all input streams .
15,264
public Map < String , Object > getAllAccumulatorResults ( ) { return accumulatorResults . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , entry -> entry . getValue ( ) . getUnchecked ( ) ) ) ; }
Gets all accumulators produced by the job . The map contains the accumulators as mappings from the accumulator name to the accumulator value .
15,265
public Integer getIntCounterResult ( String accumulatorName ) { Object result = this . accumulatorResults . get ( accumulatorName ) . getUnchecked ( ) ; if ( result == null ) { return null ; } if ( ! ( result instanceof Integer ) ) { throw new ClassCastException ( "Requested result of the accumulator '" + accumulatorNa...
Gets the accumulator with the given name as an integer .
15,266
private static ByteBuf allocateBuffer ( ByteBufAllocator allocator , byte id , int messageHeaderLength , int contentLength , boolean allocateForContent ) { checkArgument ( contentLength <= Integer . MAX_VALUE - FRAME_HEADER_LENGTH ) ; final ByteBuf buffer ; if ( ! allocateForContent ) { buffer = allocator . directBuffe...
Allocates a new buffer and adds some header information for the frame decoder .
15,267
protected TwoPhaseCommitSinkFunction < IN , TXN , CONTEXT > setTransactionTimeout ( long transactionTimeout ) { checkArgument ( transactionTimeout >= 0 , "transactionTimeout must not be negative" ) ; this . transactionTimeout = transactionTimeout ; return this ; }
Sets the transaction timeout . Setting only the transaction timeout has no effect in itself .
15,268
public int hash ( ) { hash ^= 4 * count ; hash ^= hash >>> 16 ; hash *= 0x85ebca6b ; hash ^= hash >>> 13 ; hash *= 0xc2b2ae35 ; hash ^= hash >>> 16 ; return hash ; }
Finalize and return the MurmurHash output .
15,269
static Set < String > extractPortKeys ( Configuration config ) { final LinkedHashSet < String > tmPortKeys = new LinkedHashSet < > ( TM_PORT_KEYS ) ; final String portKeys = config . getString ( PORT_ASSIGNMENTS ) ; if ( portKeys != null ) { Arrays . stream ( portKeys . split ( "," ) ) . map ( String :: trim ) . peek (...
Get the port keys representing the TM s configured endpoints . This includes mandatory TM endpoints such as data and rpc as well as optionally configured endpoints for services such as prometheus reporter
15,270
static void configureArtifactServer ( MesosArtifactServer server , ContainerSpecification container ) throws IOException { for ( ContainerSpecification . Artifact artifact : container . getArtifacts ( ) ) { server . addPath ( artifact . source , artifact . dest ) ; } }
Configures an artifact server to serve the artifacts associated with a container specification .
15,271
public CirculantGraph addRange ( long offset , long length ) { Preconditions . checkArgument ( offset >= MINIMUM_OFFSET , "Range offset must be at least " + MINIMUM_OFFSET ) ; Preconditions . checkArgument ( length <= vertexCount - offset , "Range length must not be greater than the vertex count minus the range offset....
Required configuration for each range of offsets in the graph .
15,272
public static CuratorFramework useNamespaceAndEnsurePath ( final CuratorFramework client , final String path ) throws Exception { Preconditions . checkNotNull ( client , "client must not be null" ) ; Preconditions . checkNotNull ( path , "path must not be null" ) ; client . newNamespaceAwareEnsurePath ( path ) . ensure...
Returns a facade of the client that uses the specified namespace and ensures that all nodes in the path exist .
15,273
public static FullTypeInfo getFullTemplateType ( Type type , int templatePosition ) { if ( type instanceof ParameterizedType ) { return getFullTemplateType ( ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) [ templatePosition ] ) ; } else { throw new IllegalArgumentException ( ) ; } }
Extract the full template type information from the given type s template parameter at the given position .
15,274
public static FullTypeInfo getFullTemplateType ( Type type ) { if ( type instanceof ParameterizedType ) { ParameterizedType parameterizedType = ( ParameterizedType ) type ; FullTypeInfo [ ] templateTypeInfos = new FullTypeInfo [ parameterizedType . getActualTypeArguments ( ) . length ] ; for ( int i = 0 ; i < parameter...
Extract the full type information from the given type .
15,275
static String sqlToRegexLike ( String sqlPattern , char escapeChar ) { int i ; final int len = sqlPattern . length ( ) ; final StringBuilder javaPattern = new StringBuilder ( len + len ) ; for ( i = 0 ; i < len ; i ++ ) { char c = sqlPattern . charAt ( i ) ; if ( JAVA_REGEX_SPECIALS . indexOf ( c ) >= 0 ) { javaPattern...
Translates a SQL LIKE pattern to Java regex pattern .
15,276
static String sqlToRegexSimilar ( String sqlPattern , CharSequence escapeStr ) { final char escapeChar ; if ( escapeStr != null ) { if ( escapeStr . length ( ) != 1 ) { throw invalidEscapeCharacter ( escapeStr . toString ( ) ) ; } escapeChar = escapeStr . charAt ( 0 ) ; } else { escapeChar = 0 ; } return sqlToRegexSimi...
Translates a SQL SIMILAR pattern to Java regex pattern with optional escape string .
15,277
static String sqlToRegexSimilar ( String sqlPattern , char escapeChar ) { similarEscapeRuleChecking ( sqlPattern , escapeChar ) ; boolean insideCharacterEnumeration = false ; final StringBuilder javaPattern = new StringBuilder ( sqlPattern . length ( ) * 2 ) ; final int len = sqlPattern . length ( ) ; for ( int i = 0 ;...
Translates SQL SIMILAR pattern to Java regex pattern .
15,278
private static String toHtmlTable ( final List < OptionWithMetaInfo > options ) { StringBuilder htmlTable = new StringBuilder ( ) ; htmlTable . append ( "<table class=\"table table-bordered\">\n" ) ; htmlTable . append ( " <thead>\n" ) ; htmlTable . append ( " <tr>\n" ) ; htmlTable . append ( " <th...
Transforms this configuration group into HTML formatted table . Options are sorted alphabetically by key .
15,279
private static String toHtmlString ( final OptionWithMetaInfo optionWithMetaInfo ) { ConfigOption < ? > option = optionWithMetaInfo . option ; String defaultValue = stringifyDefault ( optionWithMetaInfo ) ; return "" + " <tr>\n" + " <td><h5>" + escapeCharacters ( option . key ( ) ) + "</h5></td>\n" + ...
Transforms option to table row .
15,280
public void dispose ( ) { if ( this . disposed ) { return ; } super . dispose ( ) ; rocksDBResourceGuard . close ( ) ; if ( db != null ) { IOUtils . closeQuietly ( writeBatchWrapper ) ; if ( nativeMetricMonitor != null ) { nativeMetricMonitor . close ( ) ; } List < ColumnFamilyOptions > columnFamilyOptions = new ArrayL...
Should only be called by one thread and only after all accesses to the DB happened .
15,281
public boolean startsWith ( CharSequence prefix , int startIndex ) { final char [ ] thisChars = this . value ; final int pLen = this . len ; final int sLen = prefix . length ( ) ; if ( ( startIndex < 0 ) || ( startIndex > pLen - sLen ) ) { return false ; } int sPos = 0 ; while ( sPos < sLen ) { if ( thisChars [ startIn...
Checks whether the substring starting at the specified index starts with the given prefix string .
15,282
private void grow ( int size ) { if ( this . value . length < size ) { char [ ] value = new char [ Math . max ( this . value . length * 3 / 2 , size ) ] ; System . arraycopy ( this . value , 0 , value , 0 , this . len ) ; this . value = value ; } }
Grow and retain content .
15,283
public Optional < TableStats > getTableStats ( ) { DescriptorProperties normalizedProps = new DescriptorProperties ( ) ; normalizedProps . putProperties ( normalizedProps ) ; Optional < Long > rowCount = normalizedProps . getOptionalLong ( STATISTICS_ROW_COUNT ) ; if ( rowCount . isPresent ( ) ) { Map < String , Column...
Reads table statistics from the descriptors properties .
15,284
public int close ( ) throws IOException { if ( ! writer . isClosed ( ) ) { int currentPositionInSegment = getCurrentPositionInSegment ( ) ; writer . writeBlock ( getCurrentSegment ( ) ) ; clear ( ) ; writer . getReturnQueue ( ) . clear ( ) ; this . writer . close ( ) ; return currentPositionInSegment ; } return - 1 ; }
Closes this OutputView closing the underlying writer . And return number bytes in last memory segment .
15,285
public void addBroadcastSet ( String name , DataSet < ? > data ) { this . bcVars . add ( new Tuple2 < > ( name , data ) ) ; }
Adds a data set as a broadcast set to the compute function .
15,286
public OptimizedPlan compile ( Plan program ) throws CompilerException { final OptimizerPostPass postPasser = getPostPassFromPlan ( program ) ; return compile ( program , postPasser ) ; }
Translates the given program to an OptimizedPlan where all nodes have their local strategy assigned and all channels have a shipping strategy assigned .
15,287
public void registerBufferPool ( BufferPool bufferPool ) { checkArgument ( bufferPool . getNumberOfRequiredMemorySegments ( ) >= getNumberOfSubpartitions ( ) , "Bug in result partition setup logic: Buffer pool has not enough guaranteed buffers for this result partition." ) ; checkState ( this . bufferPool == null , "Bu...
Registers a buffer pool with this result partition .
15,288
public void finish ( ) throws IOException { boolean success = false ; try { checkInProduceState ( ) ; for ( ResultSubpartition subpartition : subpartitions ) { subpartition . finish ( ) ; } success = true ; } finally { if ( success ) { isFinished = true ; notifyPipelinedConsumers ( ) ; } } }
Finishes the result partition .
15,289
public void release ( Throwable cause ) { if ( isReleased . compareAndSet ( false , true ) ) { LOG . debug ( "{}: Releasing {}." , owningTaskName , this ) ; if ( cause != null ) { this . cause = cause ; } for ( ResultSubpartition subpartition : subpartitions ) { try { subpartition . release ( ) ; } catch ( Throwable t ...
Releases the result partition .
15,290
public ResultSubpartitionView createSubpartitionView ( int index , BufferAvailabilityListener availabilityListener ) throws IOException { int refCnt = pendingReferences . get ( ) ; checkState ( refCnt != - 1 , "Partition released." ) ; checkState ( refCnt > 0 , "Partition not pinned." ) ; checkElementIndex ( index , su...
Returns the requested subpartition .
15,291
public void releaseMemory ( int toRelease ) throws IOException { checkArgument ( toRelease > 0 ) ; for ( ResultSubpartition subpartition : subpartitions ) { toRelease -= subpartition . releaseMemory ( ) ; if ( toRelease <= 0 ) { break ; } } }
Releases buffers held by this result partition .
15,292
void pin ( ) { while ( true ) { int refCnt = pendingReferences . get ( ) ; if ( refCnt >= 0 ) { if ( pendingReferences . compareAndSet ( refCnt , refCnt + subpartitions . length ) ) { break ; } } else { throw new IllegalStateException ( "Released." ) ; } } }
Pins the result partition .
15,293
void onConsumedSubpartition ( int subpartitionIndex ) { if ( isReleased . get ( ) ) { return ; } int refCnt = pendingReferences . decrementAndGet ( ) ; if ( refCnt == 0 ) { partitionManager . onConsumedPartition ( this ) ; } else if ( refCnt < 0 ) { throw new IllegalStateException ( "All references released." ) ; } LOG...
Notification when a subpartition is released .
15,294
private void notifyPipelinedConsumers ( ) { if ( sendScheduleOrUpdateConsumersMessage && ! hasNotifiedPipelinedConsumers && partitionType . isPipelined ( ) ) { partitionConsumableNotifier . notifyPartitionConsumable ( jobId , partitionId , taskActions ) ; hasNotifiedPipelinedConsumers = true ; } }
Notifies pipelined consumers of this result partition once .
15,295
public RMatGraph < T > setConstants ( float a , float b , float c ) { Preconditions . checkArgument ( a >= 0.0f && b >= 0.0f && c >= 0.0f && a + b + c <= 1.0f , "RMat parameters A, B, and C must be non-negative and sum to less than or equal to one" ) ; this . a = a ; this . b = b ; this . c = c ; return this ; }
The parameters for recursively subdividing the adjacency matrix .
15,296
public RMatGraph < T > setNoise ( boolean noiseEnabled , float noise ) { Preconditions . checkArgument ( noise >= 0.0f && noise <= 2.0f , "RMat parameter noise must be non-negative and less than or equal to 2.0" ) ; this . noiseEnabled = noiseEnabled ; this . noise = noise ; return this ; }
Enable and configure noise . Each edge is generated independently but when noise is enabled the parameters A B and C are randomly increased or decreased then normalized by a fraction of the noise factor during the computation of each bit .
15,297
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public DataStream < T > closeWith ( DataStream < T > feedbackStream ) { Collection < StreamTransformation < ? > > predecessors = feedbackStream . getTransformation ( ) . getTransitivePredecessors ( ) ; if ( ! predecessors . contains ( this . transformation ) ) { throw...
Closes the iteration . This method defines the end of the iterative program part that will be fed back to the start of the iteration .
15,298
public void open ( ) { isRunning = true ; terminal . writer ( ) . append ( CliStrings . MESSAGE_WELCOME ) ; while ( isRunning ) { terminal . writer ( ) . append ( "\n" ) ; terminal . flush ( ) ; final String line ; try { line = lineReader . readLine ( prompt , null , ( MaskingCallback ) null , null ) ; } catch ( UserIn...
Opens the interactive CLI shell .
15,299
public static SlotProfile noLocality ( ResourceProfile resourceProfile ) { return new SlotProfile ( resourceProfile , Collections . emptyList ( ) , Collections . emptyList ( ) ) ; }
Returns a slot profile for the given resource profile without any locality requirements .