idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
154,900
public String getUserName ( ) throws SQLException { ResultSet rs = execute ( "CALL USER()" ) ; rs . next ( ) ; String result = rs . getString ( 1 ) ; rs . close ( ) ; return result ; }
Retrieves the user name as known to this database .
55
12
154,901
public boolean isReadOnly ( ) throws SQLException { ResultSet rs = execute ( "CALL isReadOnlyDatabase()" ) ; rs . next ( ) ; boolean result = rs . getBoolean ( 1 ) ; rs . close ( ) ; return result ; }
Retrieves whether this database is in read - only mode .
58
13
154,902
private StringBuffer toQueryPrefixNoSelect ( String t ) { StringBuffer sb = new StringBuffer ( 255 ) ; return sb . append ( t ) . append ( whereTrue ) ; }
Retrieves &lt ; expression&gt ; WHERE 1 = 1 in string
42
16
154,903
public static ConstantValueExpression makeExpression ( VoltType dataType , String value ) { ConstantValueExpression constantExpr = new ConstantValueExpression ( ) ; constantExpr . setValueType ( dataType ) ; constantExpr . setValue ( value ) ; return constantExpr ; }
Create a new CVE for a given type and value
63
10
154,904
Result executeUpdateStatement ( Session session ) { int count = 0 ; Expression [ ] colExpressions = updateExpressions ; HashMappedList rowset = new HashMappedList ( ) ; Type [ ] colTypes = baseTable . getColumnTypes ( ) ; RangeIteratorBase it = RangeVariable . getIterator ( session , targetRangeVariables ) ; Expression...
Executes an UPDATE statement . It is assumed that the argument is of the correct type .
365
18
154,905
Result executeMergeStatement ( Session session ) { Result resultOut = null ; RowSetNavigator generatedNavigator = null ; PersistentStore store = session . sessionData . getRowStore ( baseTable ) ; if ( generatedIndexes != null ) { resultOut = Result . newUpdateCountResult ( generatedResultMetaData , 0 ) ; generatedNavi...
Executes a MERGE statement . It is assumed that the argument is of the correct type .
644
19
154,906
Result executeDeleteStatement ( Session session ) { int count = 0 ; RowSetNavigatorLinkedList oldRows = new RowSetNavigatorLinkedList ( ) ; RangeIterator it = RangeVariable . getIterator ( session , targetRangeVariables ) ; while ( it . next ( ) ) { Row currentRow = it . getCurrentRow ( ) ; oldRows . add ( currentRow )...
Executes a DELETE statement . It is assumed that the argument is of the correct type .
140
20
154,907
int delete ( Session session , Table table , RowSetNavigator oldRows ) { if ( table . fkMainConstraints . length == 0 ) { deleteRows ( session , table , oldRows ) ; oldRows . beforeFirst ( ) ; if ( table . hasTrigger ( Trigger . DELETE_AFTER ) ) { table . fireAfterTriggers ( session , Trigger . DELETE_AFTER , oldRows )...
Highest level multiple row delete method . Corresponds to an SQL DELETE .
553
17
154,908
static void mergeUpdate ( HashMappedList rowSet , Row row , Object [ ] newData , int [ ] cols ) { Object [ ] data = ( Object [ ] ) rowSet . get ( row ) ; if ( data != null ) { for ( int j = 0 ; j < cols . length ; j ++ ) { data [ cols [ j ] ] = newData [ cols [ j ] ] ; } } else { rowSet . add ( row , newData ) ; } }
Merges a triggered change with a previous triggered change or adds to list .
107
15
154,909
static boolean mergeKeepUpdate ( Session session , HashMappedList rowSet , int [ ] cols , Type [ ] colTypes , Row row , Object [ ] newData ) { Object [ ] data = ( Object [ ] ) rowSet . get ( row ) ; if ( data != null ) { if ( IndexAVL . compareRows ( row . getData ( ) , newData , cols , colTypes ) != 0 && IndexAVL . co...
Merge the full triggered change with the updated row or add to list . Return false if changes conflict .
187
21
154,910
protected ExportRowData decodeRow ( byte [ ] rowData ) throws IOException { ExportRow row = ExportRow . decodeRow ( m_legacyRow , getPartition ( ) , m_startTS , rowData ) ; return new ExportRowData ( row . values , row . partitionValue , row . partitionId ) ; }
Decode a byte array of row data into ExportRowData
70
12
154,911
public boolean writeRow ( Object row [ ] , CSVWriter writer , boolean skipinternal , BinaryEncoding binaryEncoding , SimpleDateFormat dateFormatter ) { int firstfield = getFirstField ( skipinternal ) ; try { String [ ] fields = new String [ m_tableSchema . size ( ) - firstfield ] ; for ( int i = firstfield ; i < m_tabl...
This is for legacy connector .
379
6
154,912
public final int setPartitionColumnName ( String partitionColumnName ) { if ( partitionColumnName == null || partitionColumnName . trim ( ) . isEmpty ( ) ) { return PARTITION_ID_INDEX ; } int idx = - 1 ; for ( String name : m_source . columnNames ) { if ( name . equalsIgnoreCase ( partitionColumnName ) ) { idx = m_sour...
Used for override of column for partitioning . This is for legacy connector only .
195
16
154,913
public static void registerShutdownHook ( int priority , boolean runOnCrash , Runnable action ) { m_instance . addHook ( priority , runOnCrash , action ) ; //Any hook registered lets print crash messsage. ShutdownHooks . m_crashMessage = true ; }
Register an action to be run when the JVM exits .
64
12
154,914
SocketAddress getRemoteSocketAddress ( ) { // a lot could go wrong here, so rather than put in a bunch of code // to check for nulls all down the chain let's do it the simple // yet bulletproof way try { return ( ( SocketChannel ) sendThread . sockKey . channel ( ) ) . socket ( ) . getRemoteSocketAddress ( ) ; } catch ...
Returns the address to which the socket is connected .
92
10
154,915
SocketAddress getLocalSocketAddress ( ) { // a lot could go wrong here, so rather than put in a bunch of code // to check for nulls all down the chain let's do it the simple // yet bulletproof way try { return ( ( SocketChannel ) sendThread . sockKey . channel ( ) ) . socket ( ) . getLocalSocketAddress ( ) ; } catch ( ...
Returns the local address to which the socket is bound .
92
11
154,916
private static String makeThreadName ( String suffix ) { String name = Thread . currentThread ( ) . getName ( ) . replaceAll ( "-EventThread" , "" ) ; return name + suffix ; }
Guard against creating - EventThread - EventThread - EventThread - ... thread names when ZooKeeper object is being created from within a watcher . See ZOOKEEPER - 795 for details .
43
41
154,917
public void commit ( Xid xid , boolean onePhase ) throws XAException { // Comment out following debug statement before public release: System . err . println ( "Performing a " + ( onePhase ? "1-phase" : "2-phase" ) + " commit on " + xid ) ; JDBCXAResource resource = xaDataSource . getResource ( xid ) ; if ( resource ==...
Per the JDBC 3 . 0 spec this commits the transaction for the specified Xid not necessarily for the transaction associated with this XAResource object .
128
31
154,918
public boolean isSameRM ( XAResource xares ) throws XAException { if ( ! ( xares instanceof JDBCXAResource ) ) { return false ; } return xaDataSource == ( ( JDBCXAResource ) xares ) . getXADataSource ( ) ; }
Stub . See implementation comment in the method for why this is not implemented yet .
67
17
154,919
public int prepare ( Xid xid ) throws XAException { validateXid ( xid ) ; /** * @todo: This is where the real 2-phase work should be done to * determine if a commit done here would succeed or not. */ /** * @todo: May improve performance to return XA_RDONLY whenever * possible, but I don't know. * Could determine this b...
Vote on whether to commit the global transaction .
198
9
154,920
public void rollback ( Xid xid ) throws XAException { JDBCXAResource resource = xaDataSource . getResource ( xid ) ; if ( resource == null ) { throw new XAException ( "The XADataSource has no such Xid in prepared state: " + xid ) ; } resource . rollbackThis ( ) ; }
Per the JDBC 3 . 0 spec this rolls back the transaction for the specified Xid not necessarily for the transaction associated with this XAResource object .
79
32
154,921
private void processValue ( String value ) { // this Option has a separator character if ( hasValueSeparator ( ) ) { // get the separator character char sep = getValueSeparator ( ) ; // store the index for the value separator int index = value . indexOf ( sep ) ; // while there are more value separators while ( index !...
Processes the value . If this Option has a value separator the value will have to be parsed into individual tokens . When n - 1 tokens have been processed and there are more value separators in the value parsing is ceased and the remaining characters are added as a single token .
169
56
154,922
public boolean enterWhenUninterruptibly ( Guard guard , long time , TimeUnit unit ) { final long timeoutNanos = toSafeNanos ( time , unit ) ; if ( guard . monitor != this ) { throw new IllegalMonitorStateException ( ) ; } final ReentrantLock lock = this . lock ; long startTime = 0L ; boolean signalBeforeWaiting = lock ...
Enters this monitor when the guard is satisfied . Blocks at most the given time including both the time to acquire the lock and the time to wait for the guard to be satisfied .
387
36
154,923
public boolean enterIfInterruptibly ( Guard guard , long time , TimeUnit unit ) throws InterruptedException { if ( guard . monitor != this ) { throw new IllegalMonitorStateException ( ) ; } final ReentrantLock lock = this . lock ; if ( ! lock . tryLock ( time , unit ) ) { return false ; } boolean satisfied = false ; tr...
Enters this monitor if the guard is satisfied . Blocks at most the given time acquiring the lock but does not wait for the guard to be satisfied and may be interrupted .
108
34
154,924
public boolean waitFor ( Guard guard , long time , TimeUnit unit ) throws InterruptedException { final long timeoutNanos = toSafeNanos ( time , unit ) ; if ( ! ( ( guard . monitor == this ) & lock . isHeldByCurrentThread ( ) ) ) { throw new IllegalMonitorStateException ( ) ; } if ( guard . isSatisfied ( ) ) { return tr...
Waits for the guard to be satisfied . Waits at most the given time and may be interrupted . May be called only by a thread currently occupying this monitor .
120
33
154,925
public void ack ( long hsId , boolean isEOS , long targetId , int blockIndex ) { rejoinLog . debug ( "Queue ack for hsId:" + hsId + " isEOS: " + isEOS + " targetId:" + targetId + " blockIndex: " + blockIndex ) ; m_blockIndices . offer ( Pair . of ( hsId , new RejoinDataAckMessage ( isEOS , targetId , blockIndex ) ) ) ;...
Ack with a positive block index .
111
8
154,926
@ Override public boolean absolute ( int row ) throws SQLException { checkClosed ( ) ; if ( rowCount == 0 ) { if ( row == 0 ) { return true ; } return false ; } if ( row == 0 ) { beforeFirst ( ) ; return true ; } if ( rowCount + row < 0 ) { beforeFirst ( ) ; return false ; } if ( row > rowCount ) { cursorPosition = Pos...
Moves the cursor to the given row number in this ResultSet object .
247
15
154,927
@ Override public int findColumn ( String columnLabel ) throws SQLException { checkClosed ( ) ; try { return table . getColumnIndex ( columnLabel ) + 1 ; } catch ( IllegalArgumentException iax ) { throw SQLError . get ( iax , SQLError . COLUMN_NOT_FOUND , columnLabel ) ; } catch ( Exception x ) { throw SQLError . get (...
Maps the given ResultSet column label to its ResultSet column index .
101
14
154,928
@ Override public BigDecimal getBigDecimal ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { final VoltType type = table . getColumnType ( columnIndex - 1 ) ; BigDecimal decimalValue = null ; switch ( type ) { case TINYINT : decimalValue = new BigDecimal ( table . getLong ( columnIndex...
ResultSet object as a java . math . BigDecimal with full precision .
287
16
154,929
@ Override public InputStream getBinaryStream ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { return new ByteArrayInputStream ( table . getStringAsBytes ( columnIndex - 1 ) ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a stream of uninterpreted bytes .
73
12
154,930
@ Override public Blob getBlob ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { return new SerialBlob ( table . getStringAsBytes ( columnIndex - 1 ) ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a Blob object in the Java programming language .
71
14
154,931
@ Override public boolean getBoolean ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; // TODO: Tempting to apply a != 0 operation on numbers and // .equals("true") on strings, but... hacky try { return ( new Long ( table . getLong ( columnIndex - 1 ) ) ) . intValue ( ) == 1 ; } catch ( Exce...
ResultSet object as a boolean in the Java programming language .
105
12
154,932
@ Override public byte getByte ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { Long longValue = getPrivateInteger ( columnIndex ) ; if ( longValue > Byte . MAX_VALUE || longValue < Byte . MIN_VALUE ) { throw new SQLException ( "Value out of byte range" ) ; } return longValue . byteVa...
ResultSet object as a byte in the Java programming language .
108
12
154,933
@ Override public byte [ ] getBytes ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { if ( table . getColumnType ( columnIndex - 1 ) == VoltType . STRING ) return table . getStringAsBytes ( columnIndex - 1 ) ; else if ( table . getColumnType ( columnIndex - 1 ) == VoltType . VARBINARY ...
ResultSet object as a byte array in the Java programming language .
174
13
154,934
@ Override public Clob getClob ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { return new SerialClob ( table . getString ( columnIndex - 1 ) . toCharArray ( ) ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a Clob object in the Java programming language .
75
14
154,935
@ Override public float getFloat ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { final VoltType type = table . getColumnType ( columnIndex - 1 ) ; Double doubleValue = null ; switch ( type ) { case TINYINT : doubleValue = new Double ( table . getLong ( columnIndex - 1 ) ) ; break ; c...
ResultSet object as a float in the Java programming language .
329
12
154,936
@ Override public int getInt ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { Long longValue = getPrivateInteger ( columnIndex ) ; if ( longValue > Integer . MAX_VALUE || longValue < Integer . MIN_VALUE ) { throw new SQLException ( "Value out of int range" ) ; } return longValue . int...
ResultSet object as an int in the Java programming language .
108
12
154,937
@ Override public long getLong ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { Long longValue = getPrivateInteger ( columnIndex ) ; return longValue ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a long in the Java programming language .
65
12
154,938
@ Override public Reader getNCharacterStream ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { String value = table . getString ( columnIndex - 1 ) ; if ( ! wasNull ( ) ) return new StringReader ( value ) ; return null ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a java . io . Reader object .
84
12
154,939
@ Override public NClob getNClob ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { return new JDBC4NClob ( table . getString ( columnIndex - 1 ) . toCharArray ( ) ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
ResultSet object as a NClob object in the Java programming language .
80
15
154,940
@ Override public Object getObject ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { VoltType type = table . getColumnType ( columnIndex - 1 ) ; if ( type == VoltType . TIMESTAMP ) return getTimestamp ( columnIndex ) ; else return table . get ( columnIndex - 1 , type ) ; } catch ( Exce...
ResultSet object as an Object in the Java programming language .
99
12
154,941
@ Override public short getShort ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; try { Long longValue = getPrivateInteger ( columnIndex ) ; if ( longValue > Short . MAX_VALUE || longValue < Short . MIN_VALUE ) { throw new SQLException ( "Value out of short range" ) ; } return longValue . s...
ResultSet object as a short in the Java programming language .
108
12
154,942
@ Override @ Deprecated public InputStream getUnicodeStream ( int columnIndex ) throws SQLException { checkColumnBounds ( columnIndex ) ; throw SQLError . noSupport ( ) ; }
Deprecated . use getCharacterStream in place of getUnicodeStream
46
15
154,943
@ Override @ Deprecated public InputStream getUnicodeStream ( String columnLabel ) throws SQLException { return getUnicodeStream ( findColumn ( columnLabel ) ) ; }
Deprecated . use getCharacterStream instead
41
8
154,944
@ Override public boolean last ( ) throws SQLException { checkClosed ( ) ; if ( rowCount == 0 ) { return false ; } try { if ( cursorPosition != Position . middle ) { cursorPosition = Position . middle ; table . resetRowPosition ( ) ; table . advanceToRow ( 0 ) ; } return table . advanceToRow ( rowCount - 1 ) ; } catch ...
Moves the cursor to the last row in this ResultSet object .
102
14
154,945
@ Override public boolean next ( ) throws SQLException { checkClosed ( ) ; if ( cursorPosition == Position . afterLast || table . getActiveRowIndex ( ) == rowCount - 1 ) { cursorPosition = Position . afterLast ; return false ; } if ( cursorPosition == Position . beforeFirst ) { cursorPosition = Position . middle ; } tr...
Moves the cursor forward one row from its current position .
106
12
154,946
@ Override public boolean previous ( ) throws SQLException { checkClosed ( ) ; if ( cursorPosition == Position . afterLast ) { return last ( ) ; } if ( cursorPosition == Position . beforeFirst || table . getActiveRowIndex ( ) <= 0 ) { beforeFirst ( ) ; return false ; } try { int tempRowIndex = table . getActiveRowIndex...
Moves the cursor to the previous row in this ResultSet object .
135
14
154,947
@ Override public boolean relative ( int rows ) throws SQLException { checkClosed ( ) ; if ( rowCount == 0 ) { return false ; } if ( cursorPosition == Position . afterLast && rows > 0 ) { return false ; } if ( cursorPosition == Position . beforeFirst && rows <= 0 ) { return false ; } if ( table . getActiveRowIndex ( ) ...
Moves the cursor a relative number of rows either positive or negative .
316
14
154,948
@ Override public void setFetchDirection ( int direction ) throws SQLException { if ( ( direction != FETCH_FORWARD ) && ( direction != FETCH_REVERSE ) && ( direction != FETCH_UNKNOWN ) ) throw SQLError . get ( SQLError . ILLEGAL_STATEMENT , direction ) ; this . fetchDirection = direction ; }
object will be processed .
89
5
154,949
@ Override public void updateAsciiStream ( String columnLabel , InputStream x , long length ) throws SQLException { throw SQLError . noSupport ( ) ; }
the specified number of bytes .
40
6
154,950
@ Override public void updateBlob ( String columnLabel , InputStream inputStream , long length ) throws SQLException { throw SQLError . noSupport ( ) ; }
have the specified number of bytes .
39
7
154,951
@ Override public void updateNClob ( String columnLabel , Reader reader , long length ) throws SQLException { throw SQLError . noSupport ( ) ; }
given number of characters long .
38
6
154,952
@ Override public void updateObject ( String columnLabel , Object x , int scaleOrLength ) throws SQLException { throw SQLError . noSupport ( ) ; }
Updates the designated column with an Object value .
38
10
154,953
@ Override public boolean wasNull ( ) throws SQLException { checkClosed ( ) ; try { return table . wasNull ( ) ; } catch ( Exception x ) { throw SQLError . get ( x ) ; } }
Reports whether the last column read had a value of SQL NULL .
51
13
154,954
public Object [ ] getRowData ( ) throws SQLException { Object [ ] row = new Object [ columnCount ] ; for ( int i = 1 ; i < columnCount + 1 ; i ++ ) { row [ i - 1 ] = getObject ( i ) ; } return row ; }
Retrieve the raw row data as an array
63
9
154,955
void transformAndQueue ( T event , long systemCurrentTimeMillis ) { // if you're super unlucky, this blows up the stack if ( rand . nextDouble ( ) < 0.05 ) { // duplicate this message (note recursion means maybe more than duped) transformAndQueue ( event , systemCurrentTimeMillis ) ; } long delayms = nextZipfDelay ( ) ...
Possibly duplicate and delay by some random amount .
100
10
154,956
@ Override public T next ( long systemCurrentTimeMillis ) { // drain all the waiting messages from the source (up to 10k) while ( delayed . size ( ) < 10000 ) { T event = source . next ( systemCurrentTimeMillis ) ; if ( event == null ) { break ; } transformAndQueue ( event , systemCurrentTimeMillis ) ; } return delayed...
Return the next event that is safe for delivery or null if there are no safe objects to deliver .
93
20
154,957
public int compareNames ( SchemaColumn that ) { String thatTbl ; String thisTbl ; if ( m_tableAlias != null && that . m_tableAlias != null ) { thisTbl = m_tableAlias ; thatTbl = that . m_tableAlias ; } else { thisTbl = m_tableName ; thatTbl = that . m_tableName ; } int tblCmp = nullSafeStringCompareTo ( thisTbl , thatT...
Compare this schema column to the input .
213
8
154,958
public SchemaColumn copyAndReplaceWithTVE ( int colIndex ) { TupleValueExpression newTve ; if ( m_expression instanceof TupleValueExpression ) { newTve = ( TupleValueExpression ) m_expression . clone ( ) ; newTve . setColumnIndex ( colIndex ) ; } else { newTve = new TupleValueExpression ( m_tableName , m_tableAlias , m...
Return a copy of this SchemaColumn but with the input expression replaced by an appropriate TupleValueExpression .
151
23
154,959
@ Override synchronized void offer ( TransactionTask task ) { Iv2Trace . logTransactionTaskQueueOffer ( task ) ; m_backlog . addLast ( task ) ; taskQueueOffer ( ) ; }
Stick this task in the backlog . Many network threads may be racing to reach here synchronize to serialize queue order . Always returns true in this case side effect of extending TransactionTaskQueue .
46
39
154,960
private boolean aquireFileLock ( ) { // PRE: // // raf is never null and is never closed upon entry. // // Rhetorical question to self: How does one tell if a RandomAccessFile // is closed, short of invoking an operation and getting an IOException // the says its closed (assuming you can control the Locale of the error...
does the real work of aquiring the FileLock
601
10
154,961
private boolean releaseFileLock ( ) { // Note: Closing the super class RandomAccessFile has the // side-effect of closing the file lock's FileChannel, // so we do not deal with this here. boolean success = false ; if ( this . fileLock == null ) { success = true ; } else { try { this . fileLock . release ( ) ; success =...
does the real work of releasing the FileLock
103
9
154,962
protected Object addOrRemove ( int intKey , Object objectValue , boolean remove ) { int hash = intKey ; int index = hashIndex . getHashIndex ( hash ) ; int lookup = hashIndex . hashTable [ index ] ; int lastLookup = - 1 ; Object returnValue = null ; for ( ; lookup >= 0 ; lastLookup = lookup , lookup = hashIndex . getNe...
type - specific method for adding or removing keys in int - > Object maps
392
15
154,963
protected Object removeObject ( Object objectKey , boolean removeRow ) { if ( objectKey == null ) { return null ; } int hash = objectKey . hashCode ( ) ; int index = hashIndex . getHashIndex ( hash ) ; int lookup = hashIndex . hashTable [ index ] ; int lastLookup = - 1 ; Object returnValue = null ; for ( ; lookup >= 0 ...
type specific method for Object sets or Object - > Object maps
198
12
154,964
public void clear ( ) { if ( hashIndex . modified ) { accessCount = 0 ; accessMin = accessCount ; hasZeroKey = false ; zeroKeyIndex = - 1 ; clearElementArrays ( 0 , hashIndex . linkTable . length ) ; hashIndex . clear ( ) ; if ( minimizeOnEmpty ) { rehash ( initialCapacity ) ; } } }
Clear the map completely .
79
5
154,965
public int getAccessCountCeiling ( int count , int margin ) { return ArrayCounter . rank ( accessTable , hashIndex . newNodePointer , count , accessMin + 1 , accessCount , margin ) ; }
Return the max accessCount value for count elements with the lowest access count . Always return at least accessMin + 1
47
23
154,966
protected void clear ( int count , int margin ) { if ( margin < 64 ) { margin = 64 ; } int maxlookup = hashIndex . newNodePointer ; int accessBase = getAccessCountCeiling ( count , margin ) ; for ( int lookup = 0 ; lookup < maxlookup ; lookup ++ ) { Object o = objectKeyTable [ lookup ] ; if ( o != null && accessTable [...
Clear approximately count elements from the map starting with those with low accessTable ranking .
112
16
154,967
public void materialise ( Session session ) { PersistentStore store ; // table constructors if ( isDataExpression ) { store = session . sessionData . getSubqueryRowStore ( table ) ; dataExpression . insertValuesIntoSubqueryTable ( session , store ) ; return ; } Result result = queryExpression . getResult ( session , is...
Fills the table with a result set
167
8
154,968
static public void encodeDecimal ( final FastSerializer fs , BigDecimal value ) throws IOException { fs . write ( ( byte ) VoltDecimalHelper . kDefaultScale ) ; fs . write ( ( byte ) 16 ) ; fs . write ( VoltDecimalHelper . serializeBigDecimal ( value ) ) ; }
Read a decimal according to the Export encoding specification .
69
10
154,969
static public void encodeGeographyPoint ( final FastSerializer fs , GeographyPointValue value ) throws IOException { final int length = GeographyPointValue . getLengthInBytes ( ) ; ByteBuffer bb = ByteBuffer . allocate ( length ) ; bb . order ( ByteOrder . nativeOrder ( ) ) ; value . flattenToBuffer ( bb ) ; byte [ ] a...
Encode a GEOGRAPHY_POINT according to the Export encoding specification .
107
18
154,970
static public void encodeGeography ( final FastSerializer fs , GeographyValue value ) throws IOException { ByteBuffer bb = ByteBuffer . allocate ( value . getLengthInBytes ( ) ) ; bb . order ( ByteOrder . nativeOrder ( ) ) ; value . flattenToBuffer ( bb ) ; byte [ ] array = bb . array ( ) ; fs . writeInt ( array . leng...
Encode a GEOGRAPHY according to the Export encoding specification .
97
15
154,971
@ SuppressWarnings ( "unchecked" ) private ImmutableMap < String , ProcedureRunnerNTGenerator > loadSystemProcedures ( boolean startup ) { ImmutableMap . Builder < String , ProcedureRunnerNTGenerator > builder = ImmutableMap . < String , ProcedureRunnerNTGenerator > builder ( ) ; Set < Entry < String , Config > > entry...
Load the system procedures . Optionally don t load UAC but use parameter instead .
442
17
154,972
@ SuppressWarnings ( "unchecked" ) synchronized void update ( CatalogContext catalogContext ) { CatalogMap < Procedure > procedures = catalogContext . database . getProcedures ( ) ; Map < String , ProcedureRunnerNTGenerator > runnerGeneratorMap = new TreeMap <> ( ) ; for ( Procedure procedure : procedures ) { if ( proc...
Refresh the NT procedures when the catalog changes .
533
10
154,973
synchronized void callProcedureNT ( final long ciHandle , final AuthUser user , final Connection ccxn , final boolean isAdmin , final boolean ntPriority , final StoredProcedureInvocation task ) { // If paused, stuff a record of the invocation into a queue that gets // drained when un-paused. We're counting on regular u...
Invoke an NT procedure asynchronously on one of the exec services .
744
15
154,974
void handleCallbacksForFailedHosts ( final Set < Integer > failedHosts ) { for ( ProcedureRunnerNT runner : m_outstanding . values ( ) ) { runner . processAnyCallbacksFromFailedHosts ( failedHosts ) ; } }
For all - host NT procs use site failures to call callbacks for hosts that will obviously never respond .
56
22
154,975
private boolean isDefinedFunctionName ( String functionName ) { return FunctionForVoltDB . isFunctionNameDefined ( functionName ) || FunctionSQL . isFunction ( functionName ) || FunctionCustom . getFunctionId ( functionName ) != ID_NOT_DEFINED || ( null != m_schema . findChild ( "ud_function" , functionName ) ) ; }
Find out if the function is defined . It might be defined in the FunctionForVoltDB table . It also might be in the VoltXML .
82
31
154,976
public Object upper ( Session session , Object data ) { if ( data == null ) { return null ; } if ( typeCode == Types . SQL_CLOB ) { String result = ( ( ClobData ) data ) . getSubString ( session , 0 , ( int ) ( ( ClobData ) data ) . length ( session ) ) ; result = collation . toUpperCase ( result ) ; ClobData clob = se...
Memory limits apply to Upper and Lower implementations with Clob data
139
12
154,977
public void outputStartTime ( final long startTimeMsec ) { log . format ( Locale . US , "#[StartTime: %.3f (seconds since epoch), %s]\n" , startTimeMsec / 1000.0 , ( new Date ( startTimeMsec ) ) . toString ( ) ) ; }
Log a start time in the log .
71
8
154,978
public String latencyHistoReport ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; PrintStream pw = null ; try { pw = new PrintStream ( baos , false , Charsets . UTF_8 . name ( ) ) ; } catch ( UnsupportedEncodingException e ) { Throwables . propagate ( e ) ; } //Get a latency report in milliseconds m_l...
Generate a human - readable report of latencies in the form of a histogram . Latency is in milliseconds
133
23
154,979
public synchronized BBContainer getNextChunk ( ) throws IOException { if ( m_chunkReaderException != null ) { throw m_chunkReaderException ; } if ( ! m_hasMoreChunks . get ( ) ) { final Container c = m_availableChunks . poll ( ) ; return c ; } if ( m_chunkReader == null ) { m_chunkReader = new ChunkReader ( ) ; m_chunk...
Will get the next chunk of the table that is just over the chunk size
257
15
154,980
protected void validateSpecifiedUserAndPassword ( String user , String password ) throws SQLException { String configuredUser = connProperties . getProperty ( "user" ) ; String configuredPassword = connProperties . getProperty ( "password" ) ; if ( ( ( user == null && configuredUser != null ) || ( user != null && confi...
Throws a SQLException if given user name or password are not same as those configured for this object .
163
23
154,981
public Object setConnectionProperty ( String name , String value ) { return connProperties . setProperty ( name , value ) ; }
Sets JDBC Connection Properties to be used when physical connections are obtained for the pool .
27
18
154,982
@ Override public void start ( boolean block ) throws InterruptedException , ExecutionException { Future < ? > task = m_es . submit ( new ParentEvent ( null ) ) ; if ( block ) { task . get ( ) ; } }
Initialize and start watching the cache .
51
8
154,983
public Object getAggregatedValue ( Session session , Object currValue ) { if ( currValue == null ) { // A VoltDB extension APPROX_COUNT_DISTINCT return opType == OpTypes . COUNT || opType == OpTypes . APPROX_COUNT_DISTINCT ? ValuePool . INTEGER_0 : null ; /* disable 2 lines... return opType == OpTypes.COUNT ? ValuePool...
Get the result of a SetFunction or an ordinary value
136
11
154,984
private boolean tableListIncludesReadOnlyView ( List < Table > tableList ) { for ( Table table : tableList ) { if ( table . getMaterializer ( ) != null && ! TableType . isStream ( table . getMaterializer ( ) . getTabletype ( ) ) ) { return true ; } } return false ; }
Return true if tableList includes at least one matview .
70
12
154,985
private boolean tableListIncludesExportOnly ( List < Table > tableList ) { // list of all export tables (assume uppercase) NavigableSet < String > exportTables = CatalogUtil . getExportTableNames ( m_catalogDb ) ; // this loop is O(number-of-joins * number-of-export-tables) // which seems acceptable if not great. Proba...
Return true if tableList includes at least one export table .
153
12
154,986
private ParsedResultAccumulator getBestCostPlanForEphemeralScans ( List < StmtEphemeralTableScan > scans ) { int nextPlanId = m_planSelector . m_planId ; boolean orderIsDeterministic = true ; boolean hasSignificantOffsetOrLimit = false ; String contentNonDeterminismMessage = null ; for ( StmtEphemeralTableScan scan : s...
Generate best cost plans for a list of derived tables which we call FROM sub - queries and common table queries .
377
23
154,987
private boolean getBestCostPlanForExpressionSubQueries ( Set < AbstractExpression > subqueryExprs ) { int nextPlanId = m_planSelector . m_planId ; for ( AbstractExpression expr : subqueryExprs ) { assert ( expr instanceof SelectSubqueryExpression ) ; if ( ! ( expr instanceof SelectSubqueryExpression ) ) { continue ; //...
Generate best cost plans for each Subquery expression from the list
311
13
154,988
private CompiledPlan getNextPlan ( ) { CompiledPlan retval ; AbstractParsedStmt nextStmt = null ; if ( m_parsedSelect != null ) { nextStmt = m_parsedSelect ; retval = getNextSelectPlan ( ) ; } else if ( m_parsedInsert != null ) { nextStmt = m_parsedInsert ; retval = getNextInsertPlan ( ) ; } else if ( m_parsedDelete !=...
Generate a unique and correct plan for the current SQL statement context . This method gets called repeatedly until it returns null meaning there are no more plans .
374
30
154,989
private void connectChildrenBestPlans ( AbstractPlanNode parentPlan ) { if ( parentPlan instanceof AbstractScanPlanNode ) { AbstractScanPlanNode scanNode = ( AbstractScanPlanNode ) parentPlan ; StmtTableScan tableScan = scanNode . getTableScan ( ) ; if ( tableScan instanceof StmtSubqueryScan ) { CompiledPlan bestCostPl...
For each sub - query or CTE node in the plan tree attach the corresponding plans to the parent node .
466
22
154,990
private boolean needProjectionNode ( AbstractPlanNode root ) { if ( ! root . planNodeClassNeedsProjectionNode ( ) ) { return false ; } // If there is a complexGroupby at his point, it means that // display columns contain all the order by columns and // does not require another projection node on top of sort node. // I...
Return true if the plan referenced by root node needs a projection node appended to the top .
200
19
154,991
static private boolean deleteIsTruncate ( ParsedDeleteStmt stmt , AbstractPlanNode plan ) { if ( ! ( plan instanceof SeqScanPlanNode ) ) { return false ; } // Assume all index scans have filters in this context, so only consider seq scans. SeqScanPlanNode seqScanNode = ( SeqScanPlanNode ) plan ; if ( seqScanNode . getP...
Returns true if this DELETE can be executed in the EE as a truncate operation
118
18
154,992
private static AbstractPlanNode addCoordinatorToDMLNode ( AbstractPlanNode dmlRoot , boolean isReplicated ) { dmlRoot = SubPlanAssembler . addSendReceivePair ( dmlRoot ) ; AbstractPlanNode sumOrLimitNode ; if ( isReplicated ) { // Replicated table DML result doesn't need to be summed. All partitions should // modify th...
Add a receive node a sum or limit node and a send node to the given DML node . If the DML target is a replicated table it will add a limit node otherwise it adds a sum node .
652
42
154,993
private static OrderByPlanNode buildOrderByPlanNode ( List < ParsedColInfo > cols ) { OrderByPlanNode n = new OrderByPlanNode ( ) ; for ( ParsedColInfo col : cols ) { n . addSortExpression ( col . m_expression , col . m_ascending ? SortDirectionType . ASC : SortDirectionType . DESC ) ; } return n ; }
Given a list of ORDER BY columns construct and return an OrderByPlanNode .
90
16
154,994
private static AbstractPlanNode handleOrderBy ( AbstractParsedStmt parsedStmt , AbstractPlanNode root ) { assert ( parsedStmt instanceof ParsedSelectStmt || parsedStmt instanceof ParsedUnionStmt || parsedStmt instanceof ParsedDeleteStmt ) ; if ( ! isOrderByNodeRequired ( parsedStmt , root ) ) { return root ; } OrderByP...
Create an order by node as required by the statement and make it a parent of root .
126
18
154,995
private AbstractPlanNode handleSelectLimitOperator ( AbstractPlanNode root ) { // The coordinator's top limit graph fragment for a MP plan. // If planning "order by ... limit", getNextSelectPlan() // will have already added an order by to the coordinator frag. // This is the only limit node in a SP plan LimitPlanNode t...
Add a limit pushed - down if possible and return the new root .
663
14
154,996
private AbstractPlanNode handleUnionLimitOperator ( AbstractPlanNode root ) { // The coordinator's top limit graph fragment for a MP plan. // If planning "order by ... limit", getNextUnionPlan() // will have already added an order by to the coordinator frag. // This is the only limit node in a SP plan LimitPlanNode top...
Add a limit and return the new root .
108
9
154,997
private AbstractPlanNode inlineLimitOperator ( AbstractPlanNode root , LimitPlanNode topLimit ) { if ( isInlineLimitPlanNodePossible ( root ) ) { root . addInlinePlanNode ( topLimit ) ; } else if ( root instanceof ProjectionPlanNode && isInlineLimitPlanNodePossible ( root . getChild ( 0 ) ) ) { // In future, inlined th...
Inline Limit plan node if possible
147
7
154,998
static private boolean isInlineLimitPlanNodePossible ( AbstractPlanNode pn ) { if ( pn instanceof OrderByPlanNode || pn . getPlanNodeType ( ) == PlanNodeType . AGGREGATE ) { return true ; } return false ; }
Inline limit plan node can be applied with ORDER BY node and serial aggregation node
58
16
154,999
private boolean switchToIndexScanForGroupBy ( AbstractPlanNode candidate , IndexGroupByInfo gbInfo ) { if ( ! m_parsedSelect . isGrouped ( ) ) { return false ; } if ( candidate instanceof IndexScanPlanNode ) { calculateIndexGroupByInfo ( ( IndexScanPlanNode ) candidate , gbInfo ) ; if ( gbInfo . m_coveredGroupByColumns...
For a seqscan feeding a GROUP BY consider substituting an IndexScan that pre - sorts by the GROUP BY keys . If a candidate is already an indexscan simply calculate GROUP BY column coverage
392
38