idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
31,000 | private Expression readNullIfExpression ( ) { read ( ) ; readThis ( Tokens . OPENBRACKET ) ; Expression c = XreadValueExpression ( ) ; readThis ( Tokens . COMMA ) ; Expression thenelse = new ExpressionOp ( OpTypes . ALTERNATIVE , new ExpressionValue ( ( Object ) null , ( Type ) null ) , c ) ; c = new ExpressionLogical ... | Reads a NULLIF expression |
31,001 | private Expression readCoalesceExpression ( ) { Expression c = null ; read ( ) ; readThis ( Tokens . OPENBRACKET ) ; Expression leaf = null ; while ( true ) { Expression current = XreadValueExpression ( ) ; if ( leaf != null && token . tokenType == Tokens . CLOSEBRACKET ) { readThis ( Tokens . CLOSEBRACKET ) ; leaf . s... | Reads a COALESE or IFNULL expression |
31,002 | StatementDMQL compileCursorSpecification ( ) { QueryExpression queryExpression = XreadQueryExpression ( ) ; queryExpression . setAsTopLevel ( ) ; queryExpression . resolve ( session ) ; if ( token . tokenType == Tokens . FOR ) { read ( ) ; if ( token . tokenType == Tokens . READ ) { read ( ) ; readThis ( Tokens . ONLY ... | Retrieves a SELECT or other query expression Statement from this parse context . |
31,003 | public long toLong ( ) { byte [ ] data = getBytes ( ) ; if ( data == null || data . length <= 0 || data . length > 8 ) { throw Error . error ( ErrorCode . X_42585 ) ; } byte [ ] dataWithLeadingZeros = new byte [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; int lenDiff = 8 - data . length ; for ( int j = lenDiff ; j < 8 ; ++ j... | Given a sequence of bytes that would otherwise be a VARBINARY constant return a long value with the understanding that the caller has determined that this value is in a numeric context . |
31,004 | public static void main ( String args [ ] ) { Statement stmts [ ] = null ; try { stmts = getStatements ( args [ 0 ] ) ; } catch ( Throwable e ) { System . out . println ( e . getMessage ( ) ) ; return ; } for ( Statement s : stmts ) { System . out . print ( s . statement ) ; } } | Run the parser as a stand - alone tool sending output to standard out . |
31,005 | void watchPartition ( int pid , ExecutorService es , boolean shouldBlock ) throws InterruptedException , ExecutionException { String dir = LeaderElector . electionDirForPartition ( VoltZK . leaders_initiators , pid ) ; m_callbacks . put ( pid , new PartitionCallback ( pid ) ) ; BabySitter babySitter ; if ( shouldBlock ... | Watch the partition ZK dir in the leader appointer . |
31,006 | private int getInitialPartitionCount ( ) throws IllegalAccessException { AppointerState currentState = m_state . get ( ) ; if ( currentState != AppointerState . INIT && currentState != AppointerState . CLUSTER_START ) { throw new IllegalAccessException ( "Getting cached partition count after cluster " + "startup" ) ; }... | Gets the initial cluster partition count on startup . This can only be called during initialization . Calling this after initialization throws because the partition count may not reflect the actual partition count in the cluster . |
31,007 | public void updatePartitionLeader ( int partitionId , long newMasterHISD , boolean isLeaderMigrated ) { PartitionCallback cb = m_callbacks . get ( partitionId ) ; if ( cb != null && cb . m_currentLeader != newMasterHISD ) { cb . m_previousLeader = cb . m_currentLeader ; cb . m_currentLeader = newMasterHISD ; cb . m_isL... | update the partition call back with current master and replica |
31,008 | public int compare ( String a , String b ) { int i ; if ( collator == null ) { i = a . compareTo ( b ) ; } else { i = collator . compare ( a , b ) ; } return ( i == 0 ) ? 0 : ( i < 0 ? - 1 : 1 ) ; } | returns - 1 0 or + 1 |
31,009 | int get ( int rowSize ) { if ( lookup . size ( ) == 0 ) { return - 1 ; } int index = lookup . findFirstGreaterEqualKeyIndex ( rowSize ) ; if ( index == - 1 ) { return - 1 ; } requestCount ++ ; requestSize += rowSize ; int length = lookup . getValue ( index ) ; int difference = length - rowSize ; int key = lookup . getK... | Returns the position of a free block or 0 . |
31,010 | public void seek ( long position ) throws IOException { if ( ! readOnly && file . length ( ) < position ) { long tempSize = position - file . length ( ) ; if ( tempSize > 1 << 18 ) { tempSize = 1 << 18 ; } byte [ ] temp = new byte [ ( int ) tempSize ] ; try { long pos = file . length ( ) ; for ( ; pos < position - temp... | Some JVM s do not allow seek beyond end of file so zeros are written first in that case . Reported by bohgammer |
31,011 | void getBytes ( byte [ ] output ) { if ( m_totalAvailable < output . length ) { throw new IllegalStateException ( "Requested " + output . length + " bytes; only have " + m_totalAvailable + " bytes; call tryRead() first" ) ; } int bytesCopied = 0 ; while ( bytesCopied < output . length ) { BBContainer firstC = m_readBBC... | Move all bytes in current read buffers to output array free read buffers back to thread local memory pool . |
31,012 | void reindex ( Session session , Index index ) { setAccessor ( index , null ) ; RowIterator it = table . rowIterator ( session ) ; while ( it . hasNext ( ) ) { Row row = it . getNextRow ( ) ; index . insert ( session , this , row ) ; } } | for result tables |
31,013 | public XAConnection getXAConnection ( ) throws SQLException { System . err . print ( "Executing " + getClass ( ) . getName ( ) + ".getXAConnection()..." ) ; try { Class . forName ( driver ) . newInstance ( ) ; } catch ( ClassNotFoundException e ) { throw new SQLException ( "Error opening connection: " + e . getMessage ... | Get new PHYSICAL connection to be managed by a connection manager . |
31,014 | public XAConnection getXAConnection ( String user , String password ) throws SQLException { validateSpecifiedUserAndPassword ( user , password ) ; return getXAConnection ( ) ; } | Gets a new physical connection after validating the given username and password . |
31,015 | static String id ( Object o ) { if ( o == null ) return "(null)" ; Thread t = Thread . currentThread ( ) ; StringBuilder sb = new StringBuilder ( 128 ) ; sb . append ( "(T[" ) . append ( t . getName ( ) ) . append ( "]@" ) ; sb . append ( Long . toString ( t . getId ( ) , Character . MAX_RADIX ) ) ; sb . append ( ":O["... | Tracing utility method useful for debugging |
31,016 | public void registerCallback ( String importer , ChannelChangeCallback callback ) { Preconditions . checkArgument ( importer != null && ! importer . trim ( ) . isEmpty ( ) , "importer is null or empty" ) ; callback = checkNotNull ( callback , "callback is null" ) ; if ( m_done . get ( ) ) return ; int [ ] stamp = new i... | Registers a ( |
31,017 | public void unregisterCallback ( String importer ) { if ( importer == null || ! m_callbacks . getReference ( ) . containsKey ( importer ) || m_unregistered . getReference ( ) . contains ( importer ) ) { return ; } if ( m_done . get ( ) ) return ; int [ ] rstamp = new int [ ] { 0 } ; NavigableMap < String , ChannelChang... | Unregisters the callback assigned to given importer . Once it is unregistered it can no longer be re - registered |
31,018 | public void shutdown ( ) { if ( m_done . compareAndSet ( false , true ) ) { m_es . shutdown ( ) ; m_buses . shutdown ( ) ; DeleteNode deleteHost = new DeleteNode ( joinZKPath ( HOST_DN , m_hostId ) ) ; DeleteNode deleteCandidate = new DeleteNode ( m_candidate ) ; try { m_es . awaitTermination ( 365 , TimeUnit . DAYS ) ... | Sets the done flag shuts down its executor thread and deletes its own host and candidate nodes |
31,019 | public void undispatched ( DeadEvent e ) { if ( ! m_done . get ( ) && e . getEvent ( ) instanceof ImporterChannelAssignment ) { ImporterChannelAssignment assignment = ( ImporterChannelAssignment ) e . getEvent ( ) ; synchronized ( m_undispatched ) { NavigableSet < String > registered = m_callbacks . getReference ( ) . ... | Keeps assignments for unregistered importers |
31,020 | public Object next ( ) { if ( chained ) { if ( it1 == null ) { if ( it2 == null ) { throw new NoSuchElementException ( ) ; } if ( it2 . hasNext ( ) ) { return it2 . next ( ) ; } it2 = null ; next ( ) ; } else { if ( it1 . hasNext ( ) ) { return it1 . next ( ) ; } it1 = null ; next ( ) ; } } if ( hasNext ( ) ) { return ... | Returns the next element . |
31,021 | public List < Long > getSitesForPartitions ( int [ ] partitions ) { ArrayList < Long > all_sites = new ArrayList < Long > ( ) ; for ( int p : partitions ) { List < Long > sites = getSitesForPartition ( p ) ; for ( long site : sites ) { all_sites . add ( site ) ; } } return all_sites ; } | Get the ids of all sites that contain a copy of ANY of the given partitions . |
31,022 | public long [ ] getSitesForPartitionsAsArray ( int [ ] partitions ) { ArrayList < Long > all_sites = new ArrayList < Long > ( ) ; for ( int p : partitions ) { List < Long > sites = getSitesForPartition ( p ) ; for ( long site : sites ) { all_sites . add ( site ) ; } } return longListToArray ( all_sites ) ; } | Get the ids of all live sites that contain a copy of ANY of the given partitions . |
31,023 | protected void readCompressedBlocks ( int blocks ) throws IOException { int bytesSoFar = 0 ; int requiredBytes = 512 * blocks ; int i ; while ( bytesSoFar < requiredBytes ) { i = readStream . read ( readBuffer , bytesSoFar , requiredBytes - bytesSoFar ) ; if ( i < 0 ) { return ; } bytesRead += i ; bytesSoFar += i ; } } | Work - around for the problem that compressed InputReaders don t fill the read buffer before returning . |
31,024 | static < T > T [ ] arraysCopyOf ( T [ ] original , int newLength ) { T [ ] copy = newArray ( original , newLength ) ; System . arraycopy ( original , 0 , copy , 0 , Math . min ( original . length , newLength ) ) ; return copy ; } | GWT safe version of Arrays . copyOf . |
31,025 | public static void initialize ( Class < ? extends TheHashinator > hashinatorImplementation , byte config [ ] ) { TheHashinator hashinator = constructHashinator ( hashinatorImplementation , config , false ) ; m_pristineHashinator = hashinator ; m_cachedHashinators . put ( 0L , hashinator ) ; instance . set ( Pair . of (... | Initialize TheHashinator with the specified implementation class and configuration . The starting version number will be 0 . |
31,026 | public static TheHashinator getHashinator ( Class < ? extends TheHashinator > hashinatorImplementation , byte config [ ] , boolean cooked ) { return constructHashinator ( hashinatorImplementation , config , cooked ) ; } | Get TheHashinator instanced based on known implementation and configuration . Used by client after asking server what it is running . |
31,027 | public static TheHashinator constructHashinator ( Class < ? extends TheHashinator > hashinatorImplementation , byte configBytes [ ] , boolean cooked ) { try { Constructor < ? extends TheHashinator > constructor = hashinatorImplementation . getConstructor ( byte [ ] . class , boolean . class ) ; return constructor . new... | Helper method to do the reflection boilerplate to call the constructor of the selected hashinator and convert the exceptions to runtime exceptions . |
31,028 | static public long computeConfigurationSignature ( byte [ ] config ) { PureJavaCrc32C crc = new PureJavaCrc32C ( ) ; crc . update ( config ) ; return crc . getValue ( ) ; } | It computes a signature from the given configuration bytes |
31,029 | public static int getPartitionForParameter ( VoltType partitionType , Object invocationParameter ) { return instance . get ( ) . getSecond ( ) . getHashedPartitionForParameter ( partitionType , invocationParameter ) ; } | Given the type of the targeting partition parameter and an object coerce the object to the correct type and hash it . NOTE NOTE NOTE NOTE! THIS SHOULD BE THE ONLY WAY THAT YOU FIGURE OUT THE PARTITIONING FOR A PARAMETER! ON SERVER |
31,030 | public static Pair < ? extends UndoAction , TheHashinator > updateHashinator ( Class < ? extends TheHashinator > hashinatorImplementation , long version , byte configBytes [ ] , boolean cooked ) { TheHashinator existingHashinator = m_cachedHashinators . get ( version ) ; if ( existingHashinator == null ) { existingHash... | Update the hashinator in a thread safe manner with a newer version of the hash function . A version number must be provided and the new config will only be used if it is greater than the current version of the hash function . |
31,031 | public static Map < Integer , Integer > getRanges ( int partition ) { return instance . get ( ) . getSecond ( ) . pGetRanges ( partition ) ; } | Get the ranges the given partition is assigned to . |
31,032 | public static HashinatorSnapshotData serializeConfiguredHashinator ( ) throws IOException { Pair < Long , ? extends TheHashinator > currentInstance = instance . get ( ) ; byte [ ] cookedData = currentInstance . getSecond ( ) . getCookedBytes ( ) ; return new HashinatorSnapshotData ( cookedData , currentInstance . getFi... | Get optimized configuration data for wire serialization . |
31,033 | public static Pair < ? extends UndoAction , TheHashinator > updateConfiguredHashinator ( long version , byte config [ ] ) { return updateHashinator ( getConfiguredHashinatorClass ( ) , version , config , true ) ; } | Update the current configured hashinator class . Used by snapshot restore . |
31,034 | public static VoltTable getPartitionKeys ( TheHashinator hashinator , VoltType type ) { final VoltTable partitionKeys ; switch ( type ) { case INTEGER : partitionKeys = hashinator . m_integerPartitionKeys . get ( ) ; break ; case STRING : partitionKeys = hashinator . m_stringPartitionKeys . get ( ) ; break ; case VARBI... | Get a VoltTable containing the partition keys for each partition that can be found for the given hashinator . May be missing some partitions during elastic rebalance when the partitions don t own enough of the ring to be probed |
31,035 | public void append ( long startDrId , long endDrId , long spUniqueId , long mpUniqueId ) { assert ( startDrId <= endDrId && ( m_map . isEmpty ( ) || startDrId > end ( m_map . span ( ) ) ) ) ; addRange ( startDrId , endDrId , spUniqueId , mpUniqueId ) ; } | Appends a range to the tracker . The range has to be after the last DrId of the tracker . |
31,036 | public void truncate ( long newTruncationPoint ) { if ( newTruncationPoint < getFirstDrId ( ) ) { return ; } final Iterator < Range < Long > > iter = m_map . asRanges ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final Range < Long > next = iter . next ( ) ; if ( end ( next ) < newTruncationPoint ) { iter . remov... | Truncate the tracker to the given safe point . After truncation the new safe point will be the first DrId of the tracker . If the new safe point is before the first DrId of the tracker it s a no - op . |
31,037 | public void mergeTracker ( DRConsumerDrIdTracker tracker ) { final long newSafePoint = Math . max ( tracker . getSafePointDrId ( ) , getSafePointDrId ( ) ) ; m_map . addAll ( tracker . m_map ) ; truncate ( newSafePoint ) ; m_lastSpUniqueId = Math . max ( m_lastSpUniqueId , tracker . m_lastSpUniqueId ) ; m_lastMpUniqueI... | Merge the given tracker with the current tracker . Ranges can overlap . After the merge the current tracker will be truncated to the larger safe point . |
31,038 | private JSONObject readJSONObjFromWire ( MessagingChannel messagingChannel ) throws IOException , JSONException { ByteBuffer messageBytes = messagingChannel . readMessage ( ) ; JSONObject jsObj = new JSONObject ( new String ( messageBytes . array ( ) , StandardCharsets . UTF_8 ) ) ; return jsObj ; } | Read a length prefixed JSON message |
31,039 | private JSONObject processJSONResponse ( MessagingChannel messagingChannel , Set < String > activeVersions , boolean checkVersion ) throws IOException , JSONException { JSONObject jsonResponse = readJSONObjFromWire ( messagingChannel ) ; if ( ! checkVersion ) { return jsonResponse ; } VersionChecker versionChecker = m_... | Read version info from a socket and check compatibility . After verifying versions return if paused start is indicated . True if paused start otherwise normal start . |
31,040 | private SocketChannel createLeaderSocket ( SocketAddress hostAddr , ConnectStrategy mode ) throws IOException { SocketChannel socket ; int connectAttempts = 0 ; do { try { socket = SocketChannel . open ( ) ; socket . socket ( ) . connect ( hostAddr , 5000 ) ; } catch ( java . net . ConnectException | java . nio . chann... | Create socket to the leader node |
31,041 | private SocketChannel connectToHost ( SocketAddress hostAddr ) throws IOException { SocketChannel socket = null ; while ( socket == null ) { try { socket = SocketChannel . open ( hostAddr ) ; } catch ( java . net . ConnectException e ) { LOG . warn ( "Joining host failed: " + e . getMessage ( ) + " retrying.." ) ; try ... | Create socket to the given host |
31,042 | private RequestHostIdResponse requestHostId ( MessagingChannel messagingChannel , Set < String > activeVersions ) throws Exception { VersionChecker versionChecker = m_acceptor . getVersionChecker ( ) ; activeVersions . add ( versionChecker . getVersionString ( ) ) ; JSONObject jsObj = new JSONObject ( ) ; jsObj . put (... | Connection handshake to the leader ask the leader to assign a host Id for current node . |
31,043 | public void addFragment ( byte [ ] planHash , int outputDepId , ByteBuffer parameterSet ) { addFragment ( planHash , null , outputDepId , parameterSet ) ; } | Add a pre - planned fragment . |
31,044 | public void addCustomFragment ( byte [ ] planHash , int outputDepId , ByteBuffer parameterSet , byte [ ] fragmentPlan , String stmtText ) { FragmentData item = new FragmentData ( ) ; item . m_planHash = planHash ; item . m_outputDepId = outputDepId ; item . m_parameterSet = parameterSet ; item . m_fragmentPlan = fragme... | Add an unplanned fragment . |
31,045 | public static FragmentTaskMessage createWithOneFragment ( long initiatorHSId , long coordinatorHSId , long txnId , long uniqueId , boolean isReadOnly , byte [ ] planHash , int outputDepId , ParameterSet params , boolean isFinal , boolean isForReplay , boolean isNPartTxn , long timestamp ) { ByteBuffer parambytes = null... | Convenience factory method to replace constructor that includes arrays of stuff . |
31,046 | public void setEmptyForRestart ( int outputDepId ) { m_emptyForRestart = true ; ParameterSet blank = ParameterSet . emptyParameterSet ( ) ; ByteBuffer mt = ByteBuffer . allocate ( blank . getSerializedSize ( ) ) ; try { blank . flattenToBuffer ( mt ) ; } catch ( IOException ioe ) { mt = ByteBuffer . allocate ( 2 ) ; mt... | fragment with the provided outputDepId |
31,047 | public static < R , C , V > ImmutableTable < R , C , V > copyOf ( Table < ? extends R , ? extends C , ? extends V > table ) { if ( table instanceof ImmutableTable ) { @ SuppressWarnings ( "unchecked" ) ImmutableTable < R , C , V > parameterizedTable = ( ImmutableTable < R , C , V > ) table ; return parameterizedTable ;... | Returns an immutable copy of the provided table . |
31,048 | private void replaceSocket ( Socket newSocket ) { synchronized ( m_socketLock ) { closeSocket ( m_socket ) ; if ( m_eos . get ( ) ) { closeSocket ( newSocket ) ; m_socket = null ; } else { m_socket = newSocket ; } } } | Set the socket to newSocket unless we re shutting down . The most reliable way to ensure the importer thread exits is to close its socket . |
31,049 | public synchronized void dumpWatches ( PrintWriter pwriter , boolean byPath ) { if ( byPath ) { for ( Entry < String , HashSet < Watcher > > e : watchTable . entrySet ( ) ) { pwriter . println ( e . getKey ( ) ) ; for ( Watcher w : e . getValue ( ) ) { pwriter . print ( "\t0x" ) ; pwriter . print ( Long . toHexString (... | String representation of watches . Warning may be large! |
31,050 | void setBaseValues ( CatalogMap < ? extends CatalogType > parentMap , String name ) { if ( name == null ) { throw new CatalogException ( "Null value where it shouldn't be." ) ; } m_parentMap = parentMap ; m_typename = name ; } | This is my lazy hack to avoid using reflection to instantiate records . |
31,051 | public void validate ( ) throws IllegalArgumentException , IllegalAccessException { for ( Field field : getClass ( ) . getDeclaredFields ( ) ) { if ( CatalogType . class . isAssignableFrom ( field . getType ( ) ) ) { CatalogType ct = ( CatalogType ) field . get ( this ) ; assert ( ct . getCatalog ( ) == getCatalog ( ) ... | Fails an assertion if any child of this object doesn t think it s part of the same catalog . |
31,052 | private void writeExternalStreamStates ( JSONStringer stringer ) throws JSONException { stringer . key ( DISABLED_EXTERNAL_STREAMS ) . array ( ) ; for ( int partition : m_disabledExternalStreams ) { stringer . value ( partition ) ; } stringer . endArray ( ) ; } | Writes external streams state for partitions into snapshot digest . |
31,053 | public static VoltTable unionTables ( Collection < VoltTable > operands ) { VoltTable result = null ; for ( VoltTable vt : operands ) { if ( vt != null ) { result = new VoltTable ( vt . getTableSchema ( ) ) ; result . setStatusCode ( vt . getStatusCode ( ) ) ; break ; } } if ( result != null ) { result . addTables ( op... | Utility to aggregate a list of tables sharing a schema . Common for sysprocs to do this to aggregate results . |
31,054 | public static boolean tableContainsString ( VoltTable t , String s , boolean caseSenstive ) { if ( t . getRowCount ( ) == 0 ) { return false ; } if ( ! caseSenstive ) { s = s . toLowerCase ( ) ; } VoltTableRow row = t . fetchRow ( 0 ) ; do { for ( int i = 0 ; i < t . getColumnCount ( ) ; i ++ ) { if ( t . getColumnType... | Return true if any string field in the table contains param s . |
31,055 | public static Object [ ] tableRowAsObjects ( VoltTableRow row ) { Object [ ] result = new Object [ row . getColumnCount ( ) ] ; for ( int i = 0 ; i < row . getColumnCount ( ) ; i ++ ) { result [ i ] = row . get ( i , row . getColumnType ( i ) ) ; } return result ; } | Get a VoltTableRow as an array of Objects of the right type |
31,056 | public static Stream < VoltTableRow > stream ( VoltTable table ) { return StreamSupport . stream ( new VoltTableSpliterator ( table , 0 , table . getRowCount ( ) ) , false ) ; } | Not yet public API for VoltTable and Java 8 streams |
31,057 | public void register ( ZKMBeanInfo bean , ZKMBeanInfo parent ) throws JMException { assert bean != null ; String path = null ; if ( parent != null ) { path = mapBean2Path . get ( parent ) ; assert path != null ; } path = makeFullPath ( path , parent ) ; mapBean2Path . put ( bean , path ) ; mapName2Bean . put ( bean . g... | Registers a new MBean with the platform MBean server . |
31,058 | private void unregister ( String path , ZKMBeanInfo bean ) throws JMException { if ( path == null ) return ; if ( ! bean . isHidden ( ) ) { MBeanServer mbs = ManagementFactory . getPlatformMBeanServer ( ) ; try { mbs . unregisterMBean ( makeObjectName ( path , bean ) ) ; } catch ( JMException e ) { LOG . warn ( "Failed... | Unregister the MBean identified by the path . |
31,059 | public void unregister ( ZKMBeanInfo bean ) { if ( bean == null ) return ; String path = mapBean2Path . get ( bean ) ; try { unregister ( path , bean ) ; } catch ( InstanceNotFoundException e ) { LOG . warn ( "InstanceNotFoundException during unregister usually means more than one Zookeeper server has been running in a... | Unregister MBean . |
31,060 | public void unregisterAll ( ) { for ( Map . Entry < ZKMBeanInfo , String > e : mapBean2Path . entrySet ( ) ) { try { unregister ( e . getValue ( ) , e . getKey ( ) ) ; } catch ( JMException e1 ) { LOG . warn ( "Error during unregister" , e1 ) ; } } mapBean2Path . clear ( ) ; mapName2Bean . clear ( ) ; } | Unregister all currently registered MBeans |
31,061 | public String makeFullPath ( String prefix , String ... name ) { StringBuilder sb = new StringBuilder ( prefix == null ? "/" : ( prefix . equals ( "/" ) ? prefix : prefix + "/" ) ) ; boolean first = true ; for ( String s : name ) { if ( s == null ) continue ; if ( ! first ) { sb . append ( "/" ) ; } else first = false ... | Generate a filesystem - like path . |
31,062 | protected ObjectName makeObjectName ( String path , ZKMBeanInfo bean ) throws MalformedObjectNameException { if ( path == null ) return null ; StringBuilder beanName = new StringBuilder ( CommonNames . DOMAIN + ":" ) ; int counter = 0 ; counter = tokenize ( beanName , path , counter ) ; tokenize ( beanName , bean . get... | Builds an MBean path and creates an ObjectName instance using the path . |
31,063 | public final int getType ( ) { if ( userTypeModifier == null ) { throw Error . runtimeError ( ErrorCode . U_S0500 , "Type" ) ; } return userTypeModifier . getType ( ) ; } | interface specific methods |
31,064 | public Object castToType ( SessionInterface session , Object a , Type type ) { return convertToType ( session , a , type ) ; } | Explicit casts are handled by this method . SQL standard 6 . 12 rules for enforcement of size precision and scale are implemented . For CHARACTER values it performs truncation in all cases of long strings . |
31,065 | public Object convertToTypeJDBC ( SessionInterface session , Object a , Type type ) { return convertToType ( session , a , type ) ; } | Convert type for JDBC . Same as convertToType but supports non - standard SQL conversions supported by JDBC |
31,066 | public static int getJDBCTypeCode ( int type ) { switch ( type ) { case Types . SQL_BLOB : return Types . BLOB ; case Types . SQL_CLOB : return Types . CLOB ; case Types . SQL_BIGINT : return Types . BIGINT ; case Types . SQL_BINARY : return Types . BINARY ; case Types . SQL_VARBINARY : return Types . VARBINARY ; case ... | translate an internal type number to JDBC type number if a type is not supported internally it is returned without translation |
31,067 | public static Type getType ( int type , int collation , long precision , int scale ) { switch ( type ) { case Types . SQL_ALL_TYPES : return SQL_ALL_TYPES ; case Types . SQL_CHAR : case Types . SQL_VARCHAR : case Types . VARCHAR_IGNORECASE : case Types . SQL_CLOB : return CharacterType . getCharacterType ( type , preci... | Enforces precision and scale limits on type |
31,068 | public boolean handleEvent ( Event e ) { switch ( e . id ) { case Event . SCROLL_LINE_UP : case Event . SCROLL_LINE_DOWN : case Event . SCROLL_PAGE_UP : case Event . SCROLL_PAGE_DOWN : case Event . SCROLL_ABSOLUTE : iX = sbHoriz . getValue ( ) ; iY = iRowHeight * sbVert . getValue ( ) ; repaint ( ) ; return true ; } re... | would require browsers to use the Java plugin . |
31,069 | public static byte [ ] getConfigureBytes ( int partitionCount , int tokenCount ) { Preconditions . checkArgument ( partitionCount > 0 ) ; Preconditions . checkArgument ( tokenCount > partitionCount ) ; Buckets buckets = new Buckets ( partitionCount , tokenCount ) ; ElasticHashinator hashinator = new ElasticHashinator (... | Convenience method for generating a deterministic token distribution for the ring based on a given partition count and tokens per partition . Each partition will have N tokens placed randomly on the ring . |
31,070 | private byte [ ] toBytes ( ) { ByteBuffer buf = ByteBuffer . allocate ( 4 + ( m_tokenCount * 8 ) ) ; buf . putInt ( m_tokenCount ) ; int lastToken = Integer . MIN_VALUE ; for ( int ii = 0 ; ii < m_tokenCount ; ii ++ ) { final long ptr = m_tokens + ( ii * 8 ) ; final int token = Bits . unsafe . getInt ( ptr ) ; Precondi... | Serializes the configuration into bytes also updates the currently cached m_configBytes . |
31,071 | public ElasticHashinator addTokens ( NavigableMap < Integer , Integer > tokensToAdd ) { long interval = deriveTokenInterval ( m_tokensMap . get ( ) . keySet ( ) ) ; Map < Integer , Integer > tokens = Maps . newTreeMap ( ) ; for ( Map . Entry < Integer , Integer > e : m_tokensMap . get ( ) . entrySet ( ) ) { if ( tokens... | Add the given tokens to the ring and generate the new hashinator . The current hashinator is not changed . |
31,072 | public Map < Integer , Integer > pPredecessors ( int partition ) { Map < Integer , Integer > predecessors = new TreeMap < Integer , Integer > ( ) ; UnmodifiableIterator < Map . Entry < Integer , Integer > > iter = m_tokensMap . get ( ) . entrySet ( ) . iterator ( ) ; Set < Integer > pTokens = new HashSet < Integer > ( ... | Find the predecessors of the given partition on the ring . This method runs in linear time use with caution when the set of partitions is large . |
31,073 | public Pair < Integer , Integer > pPredecessor ( int partition , int token ) { Integer partForToken = m_tokensMap . get ( ) . get ( token ) ; if ( partForToken != null && partForToken == partition ) { Map . Entry < Integer , Integer > predecessor = m_tokensMap . get ( ) . headMap ( token ) . lastEntry ( ) ; if ( predec... | Find the predecessor of the given token on the ring . |
31,074 | public Map < Integer , Integer > pGetRanges ( int partition ) { Map < Integer , Integer > ranges = new TreeMap < Integer , Integer > ( ) ; Integer first = null ; Integer start = null ; UnmodifiableIterator < Map . Entry < Integer , Integer > > iter = m_tokensMap . get ( ) . entrySet ( ) . iterator ( ) ; while ( iter . ... | This runs in linear time with respect to the number of tokens on the ring . |
31,075 | private byte [ ] toCookedBytes ( ) { ByteBuffer buf = ByteBuffer . allocate ( 4 + ( m_tokenCount * 8 ) ) ; buf . putInt ( m_tokenCount ) ; for ( int zz = 3 ; zz >= 0 ; zz -- ) { int lastToken = Integer . MIN_VALUE ; for ( int ii = 0 ; ii < m_tokenCount ; ii ++ ) { int token = Bits . unsafe . getInt ( m_tokens + ( ii * ... | Returns compressed config bytes . |
31,076 | private static synchronized void trackAllocatedHashinatorBytes ( long bytes ) { final long allocated = m_allocatedHashinatorBytes . addAndGet ( bytes ) ; if ( allocated > HASHINATOR_GC_THRESHHOLD ) { hostLogger . warn ( allocated + " bytes of hashinator data has been allocated" ) ; if ( m_emergencyGCThread == null || m... | Track allocated bytes and invoke System . gc to encourage reclamation if it is growing large |
31,077 | private static long deriveTokenInterval ( ImmutableSortedSet < Integer > tokens ) { long interval = 0 ; int count = 4 ; int prevToken = Integer . MIN_VALUE ; UnmodifiableIterator < Integer > tokenIter = tokens . iterator ( ) ; while ( tokenIter . hasNext ( ) && count -- > 0 ) { int nextToken = tokenIter . next ( ) ; in... | Figure out the token interval from the first 3 ranges assuming that there is at most one token that doesn t fall onto the bucket boundary at any given time . The largest range will be the hashinator s bucket size . |
31,078 | private static int containingBucket ( int token , long interval ) { return ( int ) ( ( ( ( long ) token - Integer . MIN_VALUE ) / interval ) * interval + Integer . MIN_VALUE ) ; } | Calculate the boundary of the bucket that countain the given token given the token interval . |
31,079 | public boolean isOrderDeterministic ( ) { assert ( m_children != null ) ; assert ( m_children . size ( ) == 1 ) ; AbstractPlanNode child = m_children . get ( 0 ) ; if ( ! child . isOrderDeterministic ( ) ) { m_nondeterminismDetail = child . m_nondeterminismDetail ; return false ; } return true ; } | Order determinism for insert nodes depends on the determinism of child nodes . For subqueries producing unordered rows the insert will be considered order - nondeterministic . |
31,080 | private void logBatch ( final CatalogContext context , final AdHocPlannedStmtBatch batch , final Object [ ] userParams ) { final int numStmts = batch . getPlannedStatementCount ( ) ; final int numParams = userParams == null ? 0 : userParams . length ; final String readOnly = batch . readOnly ? "yes" : "no" ; final Stri... | Log ad hoc batch info |
31,081 | static CompletableFuture < ClientResponse > processExplainDefaultProc ( AdHocPlannedStmtBatch planBatch ) { Database db = VoltDB . instance ( ) . getCatalogContext ( ) . database ; assert ( planBatch . getPlannedStatementCount ( ) == 1 ) ; AdHocPlannedStatement ahps = planBatch . getPlannedStatement ( 0 ) ; String sql ... | Explain Proc for a default proc is routed through the regular Explain path using ad hoc planning and all . Take the result from that async process and format it like other explains for procedures . |
31,082 | private final CompletableFuture < ClientResponse > createAdHocTransaction ( final AdHocPlannedStmtBatch plannedStmtBatch , final boolean isSwapTables ) throws VoltTypeException { ByteBuffer buf = null ; try { buf = plannedStmtBatch . flattenPlanArrayToBuffer ( ) ; } catch ( IOException e ) { VoltDB . crashLocalVoltDB (... | Take a set of adhoc plans and pass them off to the right transactional adhoc variant . |
31,083 | private void collectParameterValueExpressions ( AbstractExpression expr , List < AbstractExpression > pves ) { if ( expr == null ) { return ; } if ( expr instanceof TupleValueExpression || expr instanceof AggregateExpression ) { addCorrelationParameterValueExpression ( expr , pves ) ; return ; } collectParameterValueEx... | PVE inside the Row subquery |
31,084 | public static Result newPSMResult ( int type , String label , Object value ) { Result result = newResult ( ResultConstants . VALUE ) ; result . errorCode = type ; result . mainString = label ; result . valueData = value ; return result ; } | For interval PSM return values |
31,085 | public static Result newPreparedExecuteRequest ( Type [ ] types , long statementId ) { Result result = newResult ( ResultConstants . EXECUTE ) ; result . metaData = ResultMetaData . newSimpleResultMetaData ( types ) ; result . statementID = statementId ; result . navigator . add ( ValuePool . emptyObjectArray ) ; retur... | For SQLEXECUTE For execution of SQL prepared statements . The parameters are set afterwards as the Result is reused |
31,086 | public static Result newCallResponse ( Type [ ] types , long statementId , Object [ ] values ) { Result result = newResult ( ResultConstants . CALL_RESPONSE ) ; result . metaData = ResultMetaData . newSimpleResultMetaData ( types ) ; result . statementID = statementId ; result . navigator . add ( values ) ; return resu... | For CALL_RESPONSE For execution of SQL callable statements . |
31,087 | public static Result newUpdateResultRequest ( Type [ ] types , long id ) { Result result = newResult ( ResultConstants . UPDATE_RESULT ) ; result . metaData = ResultMetaData . newUpdateResultMetaData ( types ) ; result . id = id ; result . navigator . add ( new Object [ ] { } ) ; return result ; } | For UPDATE_RESULT The parameters are set afterwards as the Result is reused |
31,088 | public void setPreparedResultUpdateProperties ( Object [ ] parameterValues ) { if ( navigator . getSize ( ) == 1 ) { ( ( RowSetNavigatorClient ) navigator ) . setData ( 0 , parameterValues ) ; } else { navigator . clear ( ) ; navigator . add ( parameterValues ) ; } } | For UPDATE_RESULT results The parameters are set by this method as the Result is reused |
31,089 | public void setPreparedExecuteProperties ( Object [ ] parameterValues , int maxRows , int fetchSize ) { mode = ResultConstants . EXECUTE ; if ( navigator . getSize ( ) == 1 ) { ( ( RowSetNavigatorClient ) navigator ) . setData ( 0 , parameterValues ) ; } else { navigator . clear ( ) ; navigator . add ( parameterValues ... | For SQLEXECUTE results The parameters are set by this method as the Result is reused |
31,090 | public static Result newBatchedExecuteResponse ( int [ ] updateCounts , Result generatedResult , Result e ) { Result result = newResult ( ResultConstants . BATCHEXECRESPONSE ) ; result . addChainedResult ( generatedResult ) ; result . addChainedResult ( e ) ; Type [ ] types = new Type [ ] { Type . SQL_INTEGER } ; resul... | For BATCHEXERESPONSE for a BATCHEXECUTE or BATCHEXECDIRECT |
31,091 | public void setPrepareOrExecuteProperties ( String sql , int maxRows , int fetchSize , int statementReturnType , int resultSetType , int resultSetConcurrency , int resultSetHoldability , int keyMode , int [ ] generatedIndexes , String [ ] generatedNames ) { mainString = sql ; updateCount = maxRows ; this . fetchSize = ... | For both EXECDIRECT and PREPARE |
31,092 | private static void reset ( ) { description = null ; argName = null ; longopt = null ; type = String . class ; required = false ; numberOfArgs = Option . UNINITIALIZED ; optionalArg = false ; valuesep = ( char ) 0 ; } | Resets the member variables to their default values . |
31,093 | public static OptionBuilder hasOptionalArgs ( ) { OptionBuilder . numberOfArgs = Option . UNLIMITED_VALUES ; OptionBuilder . optionalArg = true ; return INSTANCE ; } | The next Option can have an unlimited number of optional arguments . |
31,094 | public static OptionBuilder hasOptionalArgs ( int numArgs ) { OptionBuilder . numberOfArgs = numArgs ; OptionBuilder . optionalArg = true ; return INSTANCE ; } | The next Option can have the specified number of optional arguments . |
31,095 | public static Option create ( ) throws IllegalArgumentException { if ( longopt == null ) { OptionBuilder . reset ( ) ; throw new IllegalArgumentException ( "must specify longopt" ) ; } return create ( null ) ; } | Create an Option using the current settings |
31,096 | private String checkProcedureIdentifier ( final String identifier , final String statement ) throws VoltCompilerException { String retIdent = checkIdentifierStart ( identifier , statement ) ; if ( retIdent . contains ( "." ) ) { String msg = String . format ( "Invalid procedure name containing dots \"%s\" in DDL: \"%s\... | Check whether or not a procedure name is acceptible . |
31,097 | void resolveHostname ( boolean synchronous ) { Runnable r = new Runnable ( ) { public void run ( ) { String remoteHost = ReverseDNSCache . hostnameOrAddress ( m_remoteSocketAddress . getAddress ( ) ) ; if ( ! remoteHost . equals ( m_remoteSocketAddress . getAddress ( ) . getHostAddress ( ) ) ) { m_remoteHostname = remo... | Do a reverse DNS lookup of the remote end . Done in a separate thread unless synchronous is specified . If asynchronous lookup is requested the task may be dropped and resolution may never occur |
31,098 | public void setInterests ( int opsToAdd , int opsToRemove ) { synchronized ( m_lock ) { int oldInterestOps = m_interestOps ; m_interestOps = ( m_interestOps | opsToAdd ) & ( ~ opsToRemove ) ; if ( oldInterestOps != m_interestOps && ! m_running ) { m_network . addToChangeList ( this , ( opsToAdd & SelectionKey . OP_WRIT... | Change the desired interest key set |
31,099 | public static String adHocSQLFromInvocationForDebug ( StoredProcedureInvocation invocation ) { assert ( invocation . getProcName ( ) . startsWith ( "@AdHoc" ) ) ; ParameterSet params = invocation . getParams ( ) ; byte [ ] serializedBatchData = ( byte [ ] ) params . getParam ( params . size ( ) - 1 ) ; Pair < Object [ ... | Get a string containing the SQL statements and any parameters for a given batch passed to an ad - hoc query . Used for debugging and logging . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.