idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
14,400 | public void addUniqueFields ( Set < FieldSet > uniqueFieldSets ) { if ( this . uniqueFields == null ) { this . uniqueFields = new HashSet < FieldSet > ( ) ; } this . uniqueFields . addAll ( uniqueFieldSets ) ; } | Adds multiple FieldSets to be unique |
14,401 | public static DescriptorProperties normalizeYaml ( Map < String , Object > yamlMap ) { final Map < String , String > normalized = new HashMap < > ( ) ; yamlMap . forEach ( ( k , v ) -> normalizeYamlObject ( normalized , k , v ) ) ; final DescriptorProperties properties = new DescriptorProperties ( true ) ; properties .... | Normalizes key - value properties from Yaml in the normalized format of the Table API . |
14,402 | void retriggerSubpartitionRequest ( Timer timer , final int subpartitionIndex ) { synchronized ( requestLock ) { checkState ( subpartitionView == null , "already requested partition" ) ; timer . schedule ( new TimerTask ( ) { public void run ( ) { try { requestSubpartition ( subpartitionIndex ) ; } catch ( Throwable t ... | Retriggers a subpartition request . |
14,403 | public static String formatAddress ( int address ) { int b1 = ( address >>> 24 ) & 0xff ; int b2 = ( address >>> 16 ) & 0xff ; int b3 = ( address >>> 8 ) & 0xff ; int b4 = address & 0xff ; return "" + b1 + '.' + b2 + '.' + b3 + '.' + b4 ; } | Util method to create a string representation of a 32 bit integer representing an IPv4 address . |
14,404 | public PythonDataStream from_collection ( Iterator < Object > iter ) throws Exception { return new PythonDataStream < > ( env . addSource ( new PythonIteratorFunction ( iter ) , TypeExtractor . getForClass ( Object . class ) ) . map ( new AdapterMap < > ( ) ) ) ; } | Creates a python data stream from the given iterator . |
14,405 | public void seek ( long block , long recordInBlock ) throws IOException { List < BlockMetaData > blockMetaData = reader . getRowGroups ( ) ; if ( block == - 1L && recordInBlock == - 1L ) { currentBlock = blockMetaData . size ( ) - 1 ; numReadRecords = numTotalRecords ; numRecordsUpToCurrentBlock = numTotalRecords ; ret... | Moves the reading position to the given block and seeks to and reads the given record . |
14,406 | public Tuple2 < Long , Long > getCurrentReadPosition ( ) { long numRecordsReturned = numReadRecords ; if ( ! readRecordReturned && numReadRecords > 0 ) { numRecordsReturned -= 1 ; } if ( numRecordsReturned == numTotalRecords ) { return Tuple2 . of ( - 1L , - 1L ) ; } if ( numRecordsReturned == numRecordsUpToCurrentBloc... | Returns the current read position in the split i . e . the current block and the number of records that were returned from that block . |
14,407 | public boolean reachEnd ( ) throws IOException { if ( readRecord != null && ! readRecordReturned ) { return false ; } if ( numReadRecords >= numTotalRecords ) { return true ; } return ! readNextRecord ( ) ; } | Checks if the record reader returned all records . This method must be called before a record can be returned . |
14,408 | private boolean readNextRecord ( ) throws IOException { boolean recordFound = false ; while ( ! recordFound ) { if ( numReadRecords >= numTotalRecords ) { return false ; } try { if ( numReadRecords == numRecordsUpToCurrentBlock ) { PageReadStore pages = reader . readNextRowGroup ( ) ; recordReader = createRecordReader ... | Reads the next record . |
14,409 | public void shutdown ( ) { synchronized ( globalLock ) { for ( Instance i : allInstances ) { i . removeSlotListener ( ) ; i . cancelAndReleaseAllSlots ( ) ; } allInstances . clear ( ) ; allInstancesByHost . clear ( ) ; instancesWithAvailableResources . clear ( ) ; taskQueue . clear ( ) ; } } | Shuts the scheduler down . After shut down no more tasks can be added to the scheduler . |
14,410 | protected SimpleSlot getNewSlotForSharingGroup ( ExecutionVertex vertex , Iterable < TaskManagerLocation > requestedLocations , SlotSharingGroupAssignment groupAssignment , CoLocationConstraint constraint , boolean localOnly ) { while ( true ) { Pair < Instance , Locality > instanceLocalityPair = findInstance ( request... | Tries to allocate a new slot for a vertex that is part of a slot sharing group . If one of the instances has a slot available the method will allocate it as a shared slot add that shared slot to the sharing group and allocate a simple slot from that shared slot . |
14,411 | public String format ( Description description ) { for ( BlockElement blockElement : description . getBlocks ( ) ) { blockElement . format ( this ) ; } return finalizeFormatting ( ) ; } | Formats the description into a String using format specific tags . |
14,412 | @ SuppressWarnings ( "unchecked" ) public O withForwardedFieldsFirst ( String ... forwardedFieldsFirst ) { if ( this . udfSemantics == null || this . analyzedUdfSemantics ) { setSemanticProperties ( extractSemanticAnnotationsFromUdf ( getFunction ( ) . getClass ( ) ) ) ; } if ( this . udfSemantics == null || this . ana... | Adds semantic information about forwarded fields of the first input of the user - defined function . The forwarded fields information declares fields which are never modified by the function and which are forwarded at the same position to the output or unchanged copied to another position in the output . |
14,413 | @ SuppressWarnings ( "unchecked" ) public O withForwardedFieldsSecond ( String ... forwardedFieldsSecond ) { if ( this . udfSemantics == null || this . analyzedUdfSemantics ) { setSemanticProperties ( extractSemanticAnnotationsFromUdf ( getFunction ( ) . getClass ( ) ) ) ; } if ( this . udfSemantics == null || this . a... | Adds semantic information about forwarded fields of the second input of the user - defined function . The forwarded fields information declares fields which are never modified by the function and which are forwarded at the same position to the output or unchanged copied to another position in the output . |
14,414 | public ChannelHandler [ ] getServerChannelHandlers ( ) { PartitionRequestQueue queueOfPartitionQueues = new PartitionRequestQueue ( ) ; PartitionRequestServerHandler serverHandler = new PartitionRequestServerHandler ( partitionProvider , taskEventPublisher , queueOfPartitionQueues , creditBasedEnabled ) ; return new Ch... | Returns the server channel handlers . |
14,415 | public ChannelHandler [ ] getClientChannelHandlers ( ) { NetworkClientHandler networkClientHandler = creditBasedEnabled ? new CreditBasedPartitionRequestClientHandler ( ) : new PartitionRequestClientHandler ( ) ; return new ChannelHandler [ ] { messageEncoder , new NettyMessage . NettyMessageDecoder ( ! creditBasedEnab... | Returns the client channel handlers . |
14,416 | protected ShardConsumer createShardConsumer ( Integer subscribedShardStateIndex , StreamShardHandle handle , SequenceNumber lastSeqNum , ShardMetricsReporter shardMetricsReporter ) { return new ShardConsumer ( this , subscribedShardStateIndex , handle , lastSeqNum , DynamoDBStreamsProxy . create ( getConsumerConfigurat... | Create a new DynamoDB streams shard consumer . |
14,417 | private void openCli ( SessionContext context , Executor executor ) { CliClient cli = null ; try { cli = new CliClient ( context , executor ) ; if ( options . getUpdateStatement ( ) == null ) { cli . open ( ) ; } else { final boolean success = cli . submitUpdate ( options . getUpdateStatement ( ) ) ; if ( ! success ) {... | Opens the CLI client for executing SQL statements . |
14,418 | public static AmazonKinesis createKinesisClient ( Properties configProps , ClientConfiguration awsClientConfig ) { awsClientConfig . setUserAgentPrefix ( String . format ( USER_AGENT_FORMAT , EnvironmentInformation . getVersion ( ) , EnvironmentInformation . getRevisionInformation ( ) . commitId ) ) ; AmazonKinesisClie... | Creates an Amazon Kinesis Client . |
14,419 | private static AWSCredentialsProvider getCredentialsProvider ( final Properties configProps , final String configPrefix ) { CredentialProvider credentialProviderType ; if ( ! configProps . containsKey ( configPrefix ) ) { if ( configProps . containsKey ( AWSConfigConstants . accessKeyId ( configPrefix ) ) && configProp... | If the provider is ASSUME_ROLE then the credentials for assuming this role are determined recursively . |
14,420 | public static boolean isValidRegion ( String region ) { try { Regions . fromName ( region . toLowerCase ( ) ) ; } catch ( IllegalArgumentException e ) { return false ; } return true ; } | Checks whether or not a region ID is valid . |
14,421 | public static long nextPowerOfTwo ( long x ) { if ( x == 0L ) { return 1L ; } else { -- x ; x |= x >> 1 ; x |= x >> 2 ; x |= x >> 4 ; x |= x >> 8 ; x |= x >> 16 ; return ( x | x >> 32 ) + 1L ; } } | Return the least power of two greater than or equal to the specified value . |
14,422 | public static int maxFill ( int n , float f ) { return Math . min ( ( int ) Math . ceil ( ( double ) ( ( float ) n * f ) ) , n - 1 ) ; } | Returns the maximum number of entries that can be filled before rehashing . |
14,423 | public void recover ( ) throws Exception { LOG . info ( "Recovering checkpoints from ZooKeeper." ) ; List < Tuple2 < RetrievableStateHandle < CompletedCheckpoint > , String > > initialCheckpoints ; while ( true ) { try { initialCheckpoints = checkpointsInZooKeeper . getAllAndLock ( ) ; break ; } catch ( ConcurrentModif... | Gets the latest checkpoint from ZooKeeper and removes all others . |
14,424 | public void addCheckpoint ( final CompletedCheckpoint checkpoint ) throws Exception { checkNotNull ( checkpoint , "Checkpoint" ) ; final String path = checkpointIdToPath ( checkpoint . getCheckpointID ( ) ) ; checkpointsInZooKeeper . addAndLock ( path , checkpoint ) ; completedCheckpoints . addLast ( checkpoint ) ; whi... | Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones . |
14,425 | public static long pathToCheckpointId ( String path ) { try { String numberString ; if ( '/' == path . charAt ( 0 ) ) { numberString = path . substring ( 1 ) ; } else { numberString = path ; } return Long . parseLong ( numberString ) ; } catch ( NumberFormatException e ) { LOG . warn ( "Could not parse checkpoint id fr... | Converts a path to the checkpoint id . |
14,426 | private void checkAndPropagateAsyncError ( ) throws Exception { if ( thrownException != null ) { String errorMessages = "" ; if ( thrownException instanceof UserRecordFailedException ) { List < Attempt > attempts = ( ( UserRecordFailedException ) thrownException ) . getResult ( ) . getAttempts ( ) ; for ( Attempt attem... | Check if there are any asynchronous exceptions . If so rethrow the exception . |
14,427 | public static QueryableStateConfiguration disabled ( ) { final Iterator < Integer > proxyPorts = NetUtils . getPortRangeFromString ( QueryableStateOptions . PROXY_PORT_RANGE . defaultValue ( ) ) ; final Iterator < Integer > serverPorts = NetUtils . getPortRangeFromString ( QueryableStateOptions . SERVER_PORT_RANGE . de... | Gets the configuration describing the queryable state as deactivated . |
14,428 | public void addBroadcastSetForScatterFunction ( String name , DataSet < ? > data ) { this . bcVarsScatter . add ( new Tuple2 < > ( name , data ) ) ; } | Adds a data set as a broadcast set to the scatter function . |
14,429 | public void addBroadcastSetForGatherFunction ( String name , DataSet < ? > data ) { this . bcVarsGather . add ( new Tuple2 < > ( name , data ) ) ; } | Adds a data set as a broadcast set to the gather function . |
14,430 | public List < Map < String , List < EventId > > > extractPatterns ( final NodeId nodeId , final DeweyNumber version ) { List < Map < String , List < EventId > > > result = new ArrayList < > ( ) ; Stack < SharedBufferAccessor . ExtractionState > extractionStates = new Stack < > ( ) ; Lockable < SharedBufferNode > entryL... | Returns all elements from the previous relation starting at the given entry . |
14,431 | public Map < String , List < V > > materializeMatch ( Map < String , List < EventId > > match ) { Map < String , List < V > > materializedMatch = new LinkedHashMap < > ( match . size ( ) ) ; for ( Map . Entry < String , List < EventId > > pattern : match . entrySet ( ) ) { List < V > events = new ArrayList < > ( patter... | Extracts the real event from the sharedBuffer with pre - extracted eventId . |
14,432 | public void lockNode ( final NodeId node ) { Lockable < SharedBufferNode > sharedBufferNode = sharedBuffer . getEntry ( node ) ; if ( sharedBufferNode != null ) { sharedBufferNode . lock ( ) ; sharedBuffer . upsertEntry ( node , sharedBufferNode ) ; } } | Increases the reference counter for the given entry so that it is not accidentally removed . |
14,433 | public void releaseNode ( final NodeId node ) throws Exception { Lockable < SharedBufferNode > sharedBufferNode = sharedBuffer . getEntry ( node ) ; if ( sharedBufferNode != null ) { if ( sharedBufferNode . release ( ) ) { removeNode ( node , sharedBufferNode . getElement ( ) ) ; } else { sharedBuffer . upsertEntry ( n... | Decreases the reference counter for the given entry so that it can be removed once the reference counter reaches 0 . |
14,434 | private void lockEvent ( EventId eventId ) { Lockable < V > eventWrapper = sharedBuffer . getEvent ( eventId ) ; checkState ( eventWrapper != null , "Referring to non existent event with id %s" , eventId ) ; eventWrapper . lock ( ) ; sharedBuffer . upsertEvent ( eventId , eventWrapper ) ; } | Increases the reference counter for the given event so that it is not accidentally removed . |
14,435 | public void releaseEvent ( EventId eventId ) throws Exception { Lockable < V > eventWrapper = sharedBuffer . getEvent ( eventId ) ; if ( eventWrapper != null ) { if ( eventWrapper . release ( ) ) { sharedBuffer . removeEvent ( eventId ) ; } else { sharedBuffer . upsertEvent ( eventId , eventWrapper ) ; } } } | Decreases the reference counter for the given event so that it can be removed once the reference counter reaches 0 . |
14,436 | protected void stop ( String [ ] args ) throws Exception { LOG . info ( "Running 'stop-with-savepoint' command." ) ; final Options commandOptions = CliFrontendParser . getStopCommandOptions ( ) ; final Options commandLineOptions = CliFrontendParser . mergeOptions ( commandOptions , customCommandLineOptions ) ; final Co... | Executes the STOP action . |
14,437 | protected void cancel ( String [ ] args ) throws Exception { LOG . info ( "Running 'cancel' command." ) ; final Options commandOptions = CliFrontendParser . getCancelCommandOptions ( ) ; final Options commandLineOptions = CliFrontendParser . mergeOptions ( commandOptions , customCommandLineOptions ) ; final CommandLine... | Executes the CANCEL action . |
14,438 | protected void savepoint ( String [ ] args ) throws Exception { LOG . info ( "Running 'savepoint' command." ) ; final Options commandOptions = CliFrontendParser . getSavepointCommandOptions ( ) ; final Options commandLineOptions = CliFrontendParser . mergeOptions ( commandOptions , customCommandLineOptions ) ; final Co... | Executes the SAVEPOINT action . |
14,439 | private String triggerSavepoint ( ClusterClient < ? > clusterClient , JobID jobId , String savepointDirectory ) throws FlinkException { logAndSysout ( "Triggering savepoint for job " + jobId + '.' ) ; CompletableFuture < String > savepointPathFuture = clusterClient . triggerSavepoint ( jobId , savepointDirectory ) ; lo... | Sends a SavepointTriggerMessage to the job manager . |
14,440 | private void disposeSavepoint ( ClusterClient < ? > clusterClient , String savepointPath ) throws FlinkException { Preconditions . checkNotNull ( savepointPath , "Missing required argument: savepoint path. " + "Usage: bin/flink savepoint -d <savepoint-path>" ) ; logAndSysout ( "Disposing savepoint '" + savepointPath + ... | Sends a SavepointDisposalRequest to the job manager . |
14,441 | PackagedProgram buildProgram ( ProgramOptions options ) throws FileNotFoundException , ProgramInvocationException { String [ ] programArgs = options . getProgramArgs ( ) ; String jarFilePath = options . getJarFilePath ( ) ; List < URL > classpaths = options . getClasspaths ( ) ; if ( jarFilePath == null ) { throw new I... | Creates a Packaged program from the given command line options . |
14,442 | private static int handleParametrizationException ( ProgramParametrizationException e ) { LOG . error ( "Program has not been parametrized properly." , e ) ; System . err . println ( e . getMessage ( ) ) ; return 1 ; } | Displays an optional exception message for incorrect program parametrization . |
14,443 | private static int handleError ( Throwable t ) { LOG . error ( "Error while running the command." , t ) ; System . err . println ( ) ; System . err . println ( "------------------------------------------------------------" ) ; System . err . println ( " The program finished with the following exception:" ) ; System . e... | Displays an exception message . |
14,444 | public static void main ( final String [ ] args ) { EnvironmentInformation . logEnvironmentInfo ( LOG , "Command Line Client" , args ) ; final String configurationDirectory = getConfigurationDirectoryFromEnv ( ) ; final Configuration configuration = GlobalConfiguration . loadConfiguration ( configurationDirectory ) ; f... | Submits the job based on the arguments . |
14,445 | static void setJobManagerAddressInConfig ( Configuration config , InetSocketAddress address ) { config . setString ( JobManagerOptions . ADDRESS , address . getHostString ( ) ) ; config . setInteger ( JobManagerOptions . PORT , address . getPort ( ) ) ; config . setString ( RestOptions . ADDRESS , address . getHostStri... | Writes the given job manager address to the associated configuration object . |
14,446 | public CustomCommandLine < ? > getActiveCustomCommandLine ( CommandLine commandLine ) { for ( CustomCommandLine < ? > cli : customCommandLines ) { if ( cli . isActive ( commandLine ) ) { return cli ; } } throw new IllegalStateException ( "No command-line ran." ) ; } | Gets the custom command - line for the arguments . |
14,447 | private static CustomCommandLine < ? > loadCustomCommandLine ( String className , Object ... params ) throws IllegalAccessException , InvocationTargetException , InstantiationException , ClassNotFoundException , NoSuchMethodException { Class < ? extends CustomCommandLine > customCliClass = Class . forName ( className )... | Loads a class from the classpath that implements the CustomCommandLine interface . |
14,448 | public O withForwardedFields ( String ... forwardedFields ) { if ( this . udfSemantics == null ) { setSemanticProperties ( extractSemanticAnnotations ( getFunction ( ) . getClass ( ) ) ) ; } if ( this . udfSemantics == null || this . analyzedUdfSemantics ) { setSemanticProperties ( new SingleInputSemanticProperties ( )... | Adds semantic information about forwarded fields of the user - defined function . The forwarded fields information declares fields which are never modified by the function and which are forwarded at the same position to the output or unchanged copied to another position in the output . |
14,449 | private static JobVertexBackPressureInfo . VertexBackPressureLevel getBackPressureLevel ( double backPressureRatio ) { if ( backPressureRatio <= 0.10 ) { return JobVertexBackPressureInfo . VertexBackPressureLevel . OK ; } else if ( backPressureRatio <= 0.5 ) { return JobVertexBackPressureInfo . VertexBackPressureLevel ... | Returns the back pressure level as a String . |
14,450 | public boolean schemaEquals ( Object obj ) { return equals ( obj ) && Arrays . equals ( fieldNames , ( ( RowTypeInfo ) obj ) . fieldNames ) ; } | Tests whether an other object describes the same schema - equivalent row information . |
14,451 | public void discardState ( ) throws Exception { FileSystem fs = getFileSystem ( ) ; fs . delete ( filePath , false ) ; } | Discard the state by deleting the file that stores the state . If the parent directory of the state is empty after deleting the state file it is also deleted . |
14,452 | public final void setNewVertexValue ( VV newValue ) { if ( setNewVertexValueCalled ) { throw new IllegalStateException ( "setNewVertexValue should only be called at most once per updateVertex" ) ; } setNewVertexValueCalled = true ; outVertex . f1 = newValue ; out . collect ( Either . Left ( outVertex ) ) ; } | Sets the new value of this vertex . |
14,453 | public void setNewVertexValue ( VV newValue ) { if ( setNewVertexValueCalled ) { throw new IllegalStateException ( "setNewVertexValue should only be called at most once per updateVertex" ) ; } setNewVertexValueCalled = true ; if ( isOptDegrees ( ) ) { outValWithDegrees . f1 . f0 = newValue ; outWithDegrees . collect ( ... | Sets the new value of this vertex . Setting a new value triggers the sending of outgoing messages from this vertex . |
14,454 | private static Path validatePath ( Path path ) { final URI uri = path . toUri ( ) ; final String scheme = uri . getScheme ( ) ; final String pathPart = uri . getPath ( ) ; if ( scheme == null ) { throw new IllegalArgumentException ( "The scheme (hdfs://, file://, etc) is null. " + "Please specify the file system scheme... | Checks the validity of the path s scheme and path . |
14,455 | public void transferAllStateDataToDirectory ( IncrementalRemoteKeyedStateHandle restoreStateHandle , Path dest , CloseableRegistry closeableRegistry ) throws Exception { final Map < StateHandleID , StreamStateHandle > sstFiles = restoreStateHandle . getSharedState ( ) ; final Map < StateHandleID , StreamStateHandle > m... | Transfer all state data to the target directory using specified number of threads . |
14,456 | private void downloadDataForStateHandle ( Path restoreFilePath , StreamStateHandle remoteFileHandle , CloseableRegistry closeableRegistry ) throws IOException { FSDataInputStream inputStream = null ; FSDataOutputStream outputStream = null ; try { FileSystem restoreFileSystem = restoreFilePath . getFileSystem ( ) ; inpu... | Copies the file from a single state handle to the given path . |
14,457 | public static < OUT > void checkCollection ( Collection < OUT > elements , Class < OUT > viewedAs ) { for ( OUT elem : elements ) { if ( elem == null ) { throw new IllegalArgumentException ( "The collection contains a null element" ) ; } if ( ! viewedAs . isAssignableFrom ( elem . getClass ( ) ) ) { throw new IllegalAr... | Verifies that all elements in the collection are non - null and are of the given class or a subclass thereof . |
14,458 | public void initializeCache ( Object key ) throws Exception { this . sortedWindows = cachedSortedWindows . get ( key ) ; if ( sortedWindows == null ) { this . sortedWindows = new TreeSet < > ( ) ; Iterator < Map . Entry < W , W > > keyValues = mapping . iterator ( ) ; if ( keyValues != null ) { while ( keyValues . hasN... | Set current key context of this window set . |
14,459 | public final boolean isResolved ( ) { return getPathParameters ( ) . stream ( ) . filter ( MessageParameter :: isMandatory ) . allMatch ( MessageParameter :: isResolved ) && getQueryParameters ( ) . stream ( ) . filter ( MessageParameter :: isMandatory ) . allMatch ( MessageParameter :: isResolved ) ; } | Returns whether all mandatory parameters have been resolved . |
14,460 | public static Database createHiveDatabase ( String dbName , CatalogDatabase db ) { Map < String , String > props = db . getProperties ( ) ; return new Database ( dbName , db . getDescription ( ) . isPresent ( ) ? db . getDescription ( ) . get ( ) : null , null , props ) ; } | Creates a Hive database from CatalogDatabase . |
14,461 | private static int indexOfName ( List < UnresolvedReferenceExpression > inputFieldReferences , String targetName ) { int i ; for ( i = 0 ; i < inputFieldReferences . size ( ) ; ++ i ) { if ( inputFieldReferences . get ( i ) . getName ( ) . equals ( targetName ) ) { break ; } } return i == inputFieldReferences . size ( ... | Find the index of targetName in the list . Return - 1 if not found . |
14,462 | private static boolean checkBegin ( BinaryString pattern , MemorySegment [ ] segments , int start , int len ) { int lenSub = pattern . getSizeInBytes ( ) ; return len >= lenSub && SegmentsUtil . equals ( pattern . getSegments ( ) , 0 , segments , start , lenSub ) ; } | Matches the beginning of each string to a pattern . |
14,463 | private static int indexMiddle ( BinaryString pattern , MemorySegment [ ] segments , int start , int len ) { return SegmentsUtil . find ( segments , start , len , pattern . getSegments ( ) , pattern . getOffset ( ) , pattern . getSizeInBytes ( ) ) ; } | Matches the middle of each string to its pattern . |
14,464 | public < C extends RpcGateway > C getSelfGateway ( Class < C > selfGatewayType ) { if ( selfGatewayType . isInstance ( rpcServer ) ) { @ SuppressWarnings ( "unchecked" ) C selfGateway = ( ( C ) rpcServer ) ; return selfGateway ; } else { throw new RuntimeException ( "RpcEndpoint does not implement the RpcGateway interf... | Returns a self gateway of the specified type which can be used to issue asynchronous calls against the RpcEndpoint . |
14,465 | public static void closeSafetyNetAndGuardedResourcesForThread ( ) { SafetyNetCloseableRegistry registry = REGISTRIES . get ( ) ; if ( null != registry ) { REGISTRIES . remove ( ) ; IOUtils . closeQuietly ( registry ) ; } } | Closes the safety net for a thread . This closes all remaining unclosed streams that were opened by safety - net - guarded file systems . After this method was called no streams can be opened any more from any FileSystem instance that was obtained while the thread was guarded by the safety net . |
14,466 | public void addHeuristicNetworkCost ( double cost ) { if ( cost <= 0 ) { throw new IllegalArgumentException ( "Heuristic costs must be positive." ) ; } this . heuristicNetworkCost += cost ; if ( this . heuristicNetworkCost < 0 ) { this . heuristicNetworkCost = Double . MAX_VALUE ; } } | Adds the heuristic costs for network to the current heuristic network costs for this Costs object . |
14,467 | public void addHeuristicDiskCost ( double cost ) { if ( cost <= 0 ) { throw new IllegalArgumentException ( "Heuristic costs must be positive." ) ; } this . heuristicDiskCost += cost ; if ( this . heuristicDiskCost < 0 ) { this . heuristicDiskCost = Double . MAX_VALUE ; } } | Adds the heuristic costs for disk to the current heuristic disk costs for this Costs object . |
14,468 | public void addHeuristicCpuCost ( double cost ) { if ( cost <= 0 ) { throw new IllegalArgumentException ( "Heuristic costs must be positive." ) ; } this . heuristicCpuCost += cost ; if ( this . heuristicCpuCost < 0 ) { this . heuristicCpuCost = Double . MAX_VALUE ; } } | Adds the given heuristic CPU cost to the current heuristic CPU cost for this Costs object . |
14,469 | public void subtractCosts ( Costs other ) { if ( this . networkCost != UNKNOWN && other . networkCost != UNKNOWN ) { this . networkCost -= other . networkCost ; if ( this . networkCost < 0 ) { throw new IllegalArgumentException ( "Cannot subtract more cost then there is." ) ; } } if ( this . diskCost != UNKNOWN && othe... | Subtracts the given costs from these costs . If the given costs are unknown then these costs are remain unchanged . |
14,470 | public JoinOperator < I1 , I2 , OUT > withPartitioner ( Partitioner < ? > partitioner ) { if ( partitioner != null ) { keys1 . validateCustomPartitioner ( partitioner , null ) ; keys2 . validateCustomPartitioner ( partitioner , null ) ; } this . customPartitioner = getInput1 ( ) . clean ( partitioner ) ; return this ; ... | Sets a custom partitioner for this join . The partitioner will be called on the join keys to determine the partition a key should be assigned to . The partitioner is evaluated on both join inputs in the same way . |
14,471 | public BinaryRow append ( LookupInfo info , BinaryRow value ) throws IOException { try { if ( numElements >= growthThreshold ) { growAndRehash ( ) ; lookup ( info . key ) ; } BinaryRow toAppend = hashSetMode ? reusedValue : value ; long pointerToAppended = recordArea . appendRecord ( info . key , toAppend ) ; bucketSeg... | Append an value into the hash map s record area . |
14,472 | public void reset ( ) { int numBuckets = bucketSegments . size ( ) * numBucketsPerSegment ; this . log2NumBuckets = MathUtils . log2strict ( numBuckets ) ; this . numBucketsMask = ( 1 << MathUtils . log2strict ( numBuckets ) ) - 1 ; this . numBucketsMask2 = ( 1 << MathUtils . log2strict ( numBuckets >> 1 ) ) - 1 ; this... | reset the map s record and bucket area s memory segments for reusing . |
14,473 | public static int calculateHeapSize ( int memory , org . apache . flink . configuration . Configuration conf ) { float memoryCutoffRatio = conf . getFloat ( ResourceManagerOptions . CONTAINERIZED_HEAP_CUTOFF_RATIO ) ; int minCutoff = conf . getInteger ( ResourceManagerOptions . CONTAINERIZED_HEAP_CUTOFF_MIN ) ; if ( me... | See documentation . |
14,474 | static Tuple2 < Path , LocalResource > setupLocalResource ( FileSystem fs , String appId , Path localSrcPath , Path homedir , String relativeTargetPath ) throws IOException { File localFile = new File ( localSrcPath . toUri ( ) . getPath ( ) ) ; if ( localFile . isDirectory ( ) ) { throw new IllegalArgumentException ( ... | Copy a local file to a remote file system . |
14,475 | private static LocalResource registerLocalResource ( Path remoteRsrcPath , long resourceSize , long resourceModificationTime ) { LocalResource localResource = Records . newRecord ( LocalResource . class ) ; localResource . setResource ( ConverterUtils . getYarnUrlFromURI ( remoteRsrcPath . toUri ( ) ) ) ; localResource... | Creates a YARN resource for the remote object at the given location . |
14,476 | private static void obtainTokenForHBase ( Credentials credentials , Configuration conf ) throws IOException { if ( UserGroupInformation . isSecurityEnabled ( ) ) { LOG . info ( "Attempting to obtain Kerberos security token for HBase" ) ; try { Class . forName ( "org.apache.hadoop.hbase.HBaseConfiguration" ) . getMethod... | Obtain Kerberos security token for HBase . |
14,477 | public static Map < String , String > getEnvironmentVariables ( String envPrefix , org . apache . flink . configuration . Configuration flinkConfiguration ) { Map < String , String > result = new HashMap < > ( ) ; for ( Map . Entry < String , String > entry : flinkConfiguration . toMap ( ) . entrySet ( ) ) { if ( entry... | Method to extract environment variables from the flinkConfiguration based on the given prefix String . |
14,478 | static void require ( boolean condition , String message , Object ... values ) { if ( ! condition ) { throw new RuntimeException ( String . format ( message , values ) ) ; } } | Validates a condition throwing a RuntimeException if the condition is violated . |
14,479 | public QueryScopeInfo getQueryServiceMetricInfo ( CharacterFilter filter ) { if ( queryServiceScopeInfo == null ) { queryServiceScopeInfo = createQueryServiceMetricInfo ( filter ) ; } return queryServiceScopeInfo ; } | Returns the metric query service scope for this group . |
14,480 | protected void addMetric ( String name , Metric metric ) { if ( metric == null ) { LOG . warn ( "Ignoring attempted registration of a metric due to being null for name {}." , name ) ; return ; } synchronized ( this ) { if ( ! closed ) { Metric prior = metrics . put ( name , metric ) ; if ( prior == null ) { if ( groups... | Adds the given metric to the group and registers it at the registry if the group is not yet closed and if no metric with the same name has been registered before . |
14,481 | private static Calendar valueAsCalendar ( Object value ) { Date date = ( Date ) value ; Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; return cal ; } | Convert a Date value to a Calendar . Calcite s fromCalendarField functions use the Calendar . get methods so the raw values of the individual fields are preserved when converted to the String formats . |
14,482 | public static boolean isFunctionOfType ( Expression expr , FunctionDefinition . Type type ) { return expr instanceof CallExpression && ( ( CallExpression ) expr ) . getFunctionDefinition ( ) . getType ( ) == type ; } | Checks if the expression is a function call of given type . |
14,483 | private static String stripHostname ( final String originalHostname ) { final int index = originalHostname . indexOf ( DOMAIN_SEPARATOR ) ; if ( index == - 1 ) { return originalHostname ; } final Matcher matcher = IPV4_PATTERN . matcher ( originalHostname ) ; if ( matcher . matches ( ) ) { return originalHostname ; } i... | Looks for a domain suffix in a FQDN and strips it if present . |
14,484 | private void onBarrier ( int channelIndex ) throws IOException { if ( ! blockedChannels [ channelIndex ] ) { blockedChannels [ channelIndex ] = true ; numBarriersReceived ++ ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "{}: Received barrier from channel {}." , inputGate . getOwningTaskName ( ) , channelIndex ) ; }... | Blocks the given channel index from which a barrier has been received . |
14,485 | private void releaseBlocksAndResetBarriers ( ) throws IOException { LOG . debug ( "{}: End of stream alignment, feeding buffered data back." , inputGate . getOwningTaskName ( ) ) ; for ( int i = 0 ; i < blockedChannels . length ; i ++ ) { blockedChannels [ i ] = false ; } if ( currentBuffered == null ) { currentBuffere... | Releases the blocks on all channels and resets the barrier count . Makes sure the just written data is the next to be consumed . |
14,486 | public static void initDefaultsFromConfiguration ( Configuration configuration ) { final boolean overwrite = configuration . getBoolean ( CoreOptions . FILESYTEM_DEFAULT_OVERRIDE ) ; DEFAULT_WRITE_MODE = overwrite ? WriteMode . OVERWRITE : WriteMode . NO_OVERWRITE ; final boolean alwaysCreateDirectory = configuration .... | Initialize defaults for output format . Needs to be a static method because it is configured for local cluster execution . |
14,487 | public void initializeGlobal ( int parallelism ) throws IOException { final Path path = getOutputFilePath ( ) ; final FileSystem fs = path . getFileSystem ( ) ; if ( fs . isDistributedFS ( ) ) { final WriteMode writeMode = getWriteMode ( ) ; final OutputDirectoryMode outDirMode = getOutputDirectoryMode ( ) ; if ( paral... | Initialization of the distributed file system if it is used . |
14,488 | public static < T extends Throwable > Optional < T > findThrowable ( Throwable throwable , Class < T > searchType ) { if ( throwable == null || searchType == null ) { return Optional . empty ( ) ; } Throwable t = throwable ; while ( t != null ) { if ( searchType . isAssignableFrom ( t . getClass ( ) ) ) { return Option... | Checks whether a throwable chain contains a specific type of exception and returns it . |
14,489 | public static Optional < Throwable > findThrowable ( Throwable throwable , Predicate < Throwable > predicate ) { if ( throwable == null || predicate == null ) { return Optional . empty ( ) ; } Throwable t = throwable ; while ( t != null ) { if ( predicate . test ( t ) ) { return Optional . of ( t ) ; } else { t = t . g... | Checks whether a throwable chain contains an exception matching a predicate and returns it . |
14,490 | public static Optional < Throwable > findThrowableWithMessage ( Throwable throwable , String searchMessage ) { if ( throwable == null || searchMessage == null ) { return Optional . empty ( ) ; } Throwable t = throwable ; while ( t != null ) { if ( t . getMessage ( ) != null && t . getMessage ( ) . contains ( searchMess... | Checks whether a throwable chain contains a specific error message and returns the corresponding throwable . |
14,491 | public static int optimalNumOfBits ( long inputEntries , double fpp ) { int numBits = ( int ) ( - inputEntries * Math . log ( fpp ) / ( Math . log ( 2 ) * Math . log ( 2 ) ) ) ; return numBits ; } | Compute optimal bits number with given input entries and expected false positive probability . |
14,492 | static int optimalNumOfHashFunctions ( long expectEntries , long bitSize ) { return Math . max ( 1 , ( int ) Math . round ( ( double ) bitSize / expectEntries * Math . log ( 2 ) ) ) ; } | compute the optimal hash function number with given input entries and bits size which would make the false positive probability lowest . |
14,493 | @ SuppressWarnings ( "unchecked" ) public List < RecordWriter < SerializationDelegate < T > > > getWriters ( ) { return Collections . unmodifiableList ( Arrays . asList ( this . writers ) ) ; } | List of writers that are associated with this output collector |
14,494 | public boolean tryAssignPayload ( Payload payload ) { Preconditions . checkNotNull ( payload ) ; if ( isCanceled ( ) ) { return false ; } if ( ! PAYLOAD_UPDATER . compareAndSet ( this , null , payload ) ) { return false ; } if ( isCanceled ( ) ) { this . payload = null ; return false ; } return true ; } | Atomically sets the executed vertex if no vertex has been assigned to this slot so far . |
14,495 | public static ScopeFormats fromConfig ( Configuration config ) { String jmFormat = config . getString ( MetricOptions . SCOPE_NAMING_JM ) ; String jmJobFormat = config . getString ( MetricOptions . SCOPE_NAMING_JM_JOB ) ; String tmFormat = config . getString ( MetricOptions . SCOPE_NAMING_TM ) ; String tmJobFormat = co... | Creates the scope formats as defined in the given configuration . |
14,496 | private static void initDefaultsFromConfiguration ( Configuration configuration ) { final long to = configuration . getLong ( ConfigConstants . FS_STREAM_OPENING_TIMEOUT_KEY , ConfigConstants . DEFAULT_FS_STREAM_OPENING_TIMEOUT ) ; if ( to < 0 ) { LOG . error ( "Invalid timeout value for filesystem stream opening: " + ... | Initialize defaults for input format . Needs to be a static method because it is configured for local cluster execution . |
14,497 | public Path [ ] getFilePaths ( ) { if ( supportsMultiPaths ( ) ) { if ( this . filePaths == null ) { return new Path [ 0 ] ; } return this . filePaths ; } else { if ( this . filePath == null ) { return new Path [ 0 ] ; } return new Path [ ] { filePath } ; } } | Returns the paths of all files to be read by the FileInputFormat . |
14,498 | private long addFilesInDir ( Path path , List < FileStatus > files , boolean logExcludedFiles ) throws IOException { final FileSystem fs = path . getFileSystem ( ) ; long length = 0 ; for ( FileStatus dir : fs . listStatus ( path ) ) { if ( dir . isDir ( ) ) { if ( acceptFile ( dir ) && enumerateNestedFiles ) { length ... | Enumerate all files in the directory and recursive if enumerateNestedFiles is true . |
14,499 | public synchronized void addOpenChannels ( List < FileIOChannel > toOpen ) { checkArgument ( ! closed ) ; for ( FileIOChannel channel : toOpen ) { openChannels . add ( channel ) ; channels . remove ( channel . getChannelID ( ) ) ; } } | Open File channels . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.