idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
154,700
private static < E > ListIterator < E > constrainedListIterator ( ListIterator < E > listIterator , Constraint < ? super E > constraint ) { return new ConstrainedListIterator < E > ( listIterator , constraint ) ; }
Returns a constrained view of the specified list iterator using the specified constraint . Any operations that would add new elements to the underlying list will be verified by the constraint .
51
32
154,701
public final Index createIndex ( PersistentStore store , HsqlName name , int [ ] columns , boolean [ ] descending , boolean [ ] nullsLast , boolean unique , boolean migrating , boolean constraint , boolean forward ) { Index newIndex = createAndAddIndexStructure ( name , columns , descending , nullsLast , unique , migra...
Create new memory - resident index . For MEMORY and TEXT tables .
81
14
154,702
public Type getCombinedType ( Type other , int operation ) { if ( operation != OpTypes . CONCAT ) { return getAggregateType ( other ) ; } Type newType ; long newPrecision = precision + other . precision ; switch ( other . typeCode ) { case Types . SQL_ALL_TYPES : return this ; case Types . SQL_BIT : newType = this ; br...
Returns type for concat
234
5
154,703
public VoltTable [ ] run ( SystemProcedureExecutionContext ctx ) { // Choose the lowest site ID on this host to actually flip the bit if ( ctx . isLowestSiteId ( ) ) { VoltDBInterface voltdb = VoltDB . instance ( ) ; OperationMode opMode = voltdb . getMode ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "voltdb o...
Enter admin mode
639
3
154,704
@ Override public void setGeneratedColumnInfo ( int generate , ResultMetaData meta ) { // can support INSERT_SELECT also if ( type != StatementTypes . INSERT ) { return ; } int colIndex = baseTable . getIdentityColumnIndex ( ) ; if ( colIndex == - 1 ) { return ; } switch ( generate ) { case ResultConstants . RETURN_NO_...
For the creation of the statement
371
6
154,705
void checkAccessRights ( Session session ) { if ( targetTable != null && ! targetTable . isTemp ( ) ) { targetTable . checkDataReadOnly ( ) ; session . checkReadWrite ( ) ; } if ( session . isAdmin ( ) ) { return ; } for ( int i = 0 ; i < sequences . length ; i ++ ) { session . getGrantee ( ) . checkAccess ( sequences ...
Determines if the authorizations are adequate to execute the compiled object . Completion requires the list of all database objects in a compiled statement .
408
29
154,706
@ Override public ResultMetaData getResultMetaData ( ) { switch ( type ) { case StatementTypes . DELETE_WHERE : case StatementTypes . INSERT : case StatementTypes . UPDATE_WHERE : case StatementTypes . MIGRATE_WHERE : return ResultMetaData . emptyResultMetaData ; default : throw Error . runtimeError ( ErrorCode . U_S05...
Returns the metadata which is empty if the CompiledStatement does not generate a Result .
97
17
154,707
@ Override public String describe ( Session session ) { try { return describeImpl ( session ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return e . toString ( ) ; } }
Retrieves a String representation of this object .
46
10
154,708
static boolean isGroupByColumn ( QuerySpecification select , int index ) { if ( ! select . isGrouped ) { return false ; } for ( int ii = 0 ; ii < select . groupIndex . getColumnCount ( ) ; ii ++ ) { if ( index == select . groupIndex . getColumns ( ) [ ii ] ) { return true ; } } return false ; }
Returns true if the specified exprColumn index is in the list of column indices specified by groupIndex
82
19
154,709
private static List < Expression > getDisplayColumnsForSetOp ( QueryExpression queryExpr ) { assert ( queryExpr != null ) ; if ( queryExpr . getLeftQueryExpression ( ) == null ) { // end of recursion. This is a QuerySpecification assert ( queryExpr instanceof QuerySpecification ) ; QuerySpecification select = ( QuerySp...
Return a list of the display columns for the left most statement from a set op
123
16
154,710
protected static List < VoltXMLElement > voltGetLimitOffsetXMLFromSortAndSlice ( Session session , SortAndSlice sortAndSlice ) throws HSQLParseException { List < VoltXMLElement > result = new ArrayList <> ( ) ; if ( sortAndSlice == null || sortAndSlice == SortAndSlice . noSort ) { return result ; } if ( sortAndSlice . ...
return a list of VoltXMLElements that need to be added to the statement XML for LIMIT and OFFSET
551
24
154,711
public static Object getObjectFromString ( VoltType type , String value ) throws ParseException { Object ret = null ; switch ( type ) { // NOTE: All runtime integer parameters are actually Longs,so we will have problems // if we actually try to convert the object to one of the smaller numeric sizes // -----------------...
Returns a casted object of the input value string based on the given type
412
15
154,712
public static VoltType getNumericLiteralType ( VoltType vt , String value ) { try { Long . parseLong ( value ) ; } catch ( NumberFormatException e ) { // Our DECIMAL may not be bigger/smaller enough to store the constant value return VoltType . DECIMAL ; } return vt ; }
If the type is NUMERIC from hsqldb VoltDB has to decide its real type . It s either INTEGER or DECIMAL according to the SQL Standard . Thanks for Hsqldb 1 . 9 FLOAT literal values have been handled well with E sign .
72
59
154,713
private static void writeLength ( ByteBuffer buf , int length ) { assert ( length >= 0 ) ; assert ( length == ( length & ( ~ length + 1 ) ) ) ; // check if power of two // shockingly fast log_2 uses intrinsics in JDK >= 1.7 byte log2size = ( byte ) ( 32 - Integer . numberOfLeadingZeros ( length ) ) ; buf . put ( log2si...
Over - clever way to store lots of lengths in a single byte Length must be a power of two > = 0 .
93
24
154,714
public OpsAgent getAgent ( OpsSelector selector ) { OpsAgent agent = m_agents . get ( selector ) ; assert ( agent != null ) ; return agent ; }
Return the OpsAgent for the specified selector .
36
9
154,715
public void shutdown ( ) { for ( Entry < OpsSelector , OpsAgent > entry : m_agents . entrySet ( ) ) { try { entry . getValue ( ) . shutdown ( ) ; } catch ( InterruptedException e ) { } } m_agents . clear ( ) ; }
Shutdown all the OpsAgent s executor services . Should be possible to eventually consolidate all of them into a single executor service .
62
27
154,716
public String add ( ProcedureDescriptor descriptor ) throws VoltCompilerException { assert descriptor != null ; String className = descriptor . m_className ; assert className != null && ! className . trim ( ) . isEmpty ( ) ; String shortName = deriveShortProcedureName ( className ) ; if ( m_procedureMap . containsKey (...
Tracks the given procedure descriptor if it is not already tracked
138
12
154,717
public void removeProcedure ( String procName , boolean ifExists ) throws VoltCompilerException { assert procName != null && ! procName . trim ( ) . isEmpty ( ) ; String shortName = deriveShortProcedureName ( procName ) ; if ( m_procedureMap . containsKey ( shortName ) ) { m_procedureMap . remove ( shortName ) ; } else...
Searches for and removes the Procedure provided in prior DDL statements
132
14
154,718
public void addProcedurePartitionInfoTo ( String procedureName , ProcedurePartitionData data ) throws VoltCompilerException { ProcedureDescriptor descriptor = m_procedureMap . get ( procedureName ) ; if ( descriptor == null ) { throw m_compiler . new VoltCompilerException ( String . format ( "Partition references an un...
Associates the given partition info to the given tracked procedure
229
12
154,719
void addExportedTable ( String tableName , String targetName , boolean isStream ) { assert tableName != null && ! tableName . trim ( ) . isEmpty ( ) ; assert targetName != null && ! targetName . trim ( ) . isEmpty ( ) ; // store uppercase in the catalog as typename targetName = targetName . toUpperCase ( ) ; if ( isStr...
Track an exported table
188
4
154,720
static < E > ImmutableList < E > asImmutableList ( Object [ ] elements , int length ) { switch ( length ) { case 0 : return of ( ) ; case 1 : @ SuppressWarnings ( "unchecked" ) // collection had only Es in it ImmutableList < E > list = new SingletonImmutableList < E > ( ( E ) elements [ 0 ] ) ; return list ; default : ...
Views the array as an immutable list . Copies if the specified range does not cover the complete array . Does not check for nulls .
127
29
154,721
@ CanIgnoreReturnValue // TODO(kak): Consider removing this public < E extends T > E min ( Iterable < E > iterable ) { return min ( iterable . iterator ( ) ) ; }
Returns the least of the specified values according to this ordering . If there are multiple least values the first of those is returned .
46
25
154,722
static long calculateAverage ( long currAvg , long currInvoc , long rowAvg , long rowInvoc ) { long currTtl = currAvg * currInvoc ; long rowTtl = rowAvg * rowInvoc ; // If both are 0, then currTtl, rowTtl are also 0. if ( ( currInvoc + rowInvoc ) == 0L ) { return 0L ; } else { return ( currTtl + rowTtl ) / ( currInvoc ...
Given a running average and the running invocation total as well as a new row s average and invocation total return a new running average
121
25
154,723
static void addToRecentConnectionSettings ( Hashtable settings , ConnectionSetting newSetting ) throws IOException { settings . put ( newSetting . getName ( ) , newSetting ) ; ConnectionDialogCommon . storeRecentConnectionSettings ( settings ) ; }
Adds the new settings name if it does not nexist or overwrites the old one .
50
19
154,724
private static void storeRecentConnectionSettings ( Hashtable settings ) { try { if ( recentSettings == null ) { setHomeDir ( ) ; if ( homedir == null ) { return ; } recentSettings = new File ( homedir , fileName ) ; if ( ! recentSettings . exists ( ) ) { // recentSettings.createNewFile(); } } if ( settings == null || ...
Here s a non - secure method of storing recent connection settings .
201
13
154,725
static void deleteRecentConnectionSettings ( ) { try { if ( recentSettings == null ) { setHomeDir ( ) ; if ( homedir == null ) { return ; } recentSettings = new File ( homedir , fileName ) ; } if ( ! recentSettings . exists ( ) ) { recentSettings = null ; return ; } recentSettings . delete ( ) ; recentSettings = null ;...
Removes the recent connection settings file store .
93
9
154,726
public Map < Integer , ClientAffinityStats > getAffinityStats ( ) { Map < Integer , ClientAffinityStats > retval = new TreeMap < Integer , ClientAffinityStats > ( ) ; for ( Entry < Integer , ClientAffinityStats > e : m_currentAffinity . entrySet ( ) ) { if ( m_baselineAffinity . containsKey ( e . getKey ( ) ) ) { retva...
Get the client affinity stats . Will only be populated if client affinity is enabled .
174
16
154,727
public ClientAffinityStats getAggregateAffinityStats ( ) { long afWrites = 0 ; long afReads = 0 ; long rrWrites = 0 ; long rrReads = 0 ; Map < Integer , ClientAffinityStats > affinityStats = getAffinityStats ( ) ; for ( Entry < Integer , ClientAffinityStats > e : affinityStats . entrySet ( ) ) { afWrites += e . getValu...
Roll up the per - partition affinity stats and return the totals for each of the four categories . Will only be populated if client affinity is enabled .
207
29
154,728
public static HSQLDDLInfo preprocessHSQLDDL ( String ddl ) { ddl = SQLLexer . stripComments ( ddl ) ; Matcher matcher = HSQL_DDL_PREPROCESSOR . matcher ( ddl ) ; if ( matcher . find ( ) ) { String verbString = matcher . group ( "verb" ) ; HSQLDDLInfo . Verb verb = HSQLDDLInfo . Verb . get ( verbString ) ; if ( verb == ...
Glean some basic info about DDL statements sent to HSQLDB
471
14
154,729
public void doRestart ( List < Long > masters , Map < Integer , Long > partitionMasters ) { List < Long > copy = new ArrayList < Long > ( masters ) ; m_restartMasters . set ( copy ) ; m_restartMastersMap . set ( Maps . newHashMap ( partitionMasters ) ) ; }
Update the list of partition masters to be used when this transaction is restarted . Currently thread - safe because we call this before poisoning the MP Transaction to restart it and only do this sequentially from the repairing thread .
74
43
154,730
public boolean activate ( SystemProcedureExecutionContext context , boolean undo , byte [ ] predicates ) { if ( ! context . activateTableStream ( m_tableId , m_type , undo , predicates ) ) { String tableName = CatalogUtil . getTableNameFromId ( context . getDatabase ( ) , m_tableId ) ; log . debug ( "Attempted to activ...
Activate the stream with the given predicates on the given table .
117
14
154,731
public Pair < ListenableFuture < ? > , Boolean > streamMore ( SystemProcedureExecutionContext context , List < DBBPool . BBContainer > outputBuffers , int [ ] rowCountAccumulator ) { ListenableFuture < ? > writeFuture = null ; prepareBuffers ( outputBuffers ) ; Pair < Long , int [ ] > serializeResult = context . tableS...
Streams more tuples from the table .
362
9
154,732
private void prepareBuffers ( List < DBBPool . BBContainer > buffers ) { Preconditions . checkArgument ( buffers . size ( ) == m_tableTasks . size ( ) ) ; UnmodifiableIterator < SnapshotTableTask > iterator = m_tableTasks . iterator ( ) ; for ( DBBPool . BBContainer container : buffers ) { int headerSize = iterator . n...
Set the positions of the buffers to the start of the content leaving some room for the headers .
127
19
154,733
private ListenableFuture < ? > writeBlocksToTargets ( Collection < DBBPool . BBContainer > outputBuffers , int [ ] serialized ) { Preconditions . checkArgument ( m_tableTasks . size ( ) == serialized . length ) ; Preconditions . checkArgument ( outputBuffers . size ( ) == serialized . length ) ; final List < Listenable...
Finalize the output buffers and write them to the corresponding data targets
397
13
154,734
public void recordValue ( final long value ) throws ArrayIndexOutOfBoundsException { long criticalValueAtEnter = recordingPhaser . writerCriticalSectionEnter ( ) ; try { activeHistogram . recordValue ( value ) ; } finally { recordingPhaser . writerCriticalSectionExit ( criticalValueAtEnter ) ; } }
Record a value
67
3
154,735
public static < K , V > HashBiMap < K , V > create ( int expectedSize ) { return new HashBiMap < K , V > ( expectedSize ) ; }
Constructs a new empty bimap with the specified expected size .
38
14
154,736
public void repairSurvivors ( ) { // cancel() and repair() must be synchronized by the caller (the deliver lock, // currently). If cancelled and the last repair message arrives, don't send // out corrections! if ( this . m_promotionResult . isCancelled ( ) ) { repairLogger . debug ( m_whoami + "Skipping repair message ...
Send missed - messages to survivors .
549
7
154,737
void init ( ResultMetaData meta , HsqlProperties props ) throws SQLException { resultMetaData = meta ; columnCount = resultMetaData . getColumnCount ( ) ; // fredt - props is null for internal connections, so always use the // default behaviour in this case // JDBCDriver.getPropertyInfo says // default is true useColum...
Initializes this JDBCResultSetMetaData object from the specified Result and HsqlProperties objects .
104
21
154,738
Map < Long , Long > reconfigureOnFault ( Set < Long > hsIds , FaultMessage fm ) { return reconfigureOnFault ( hsIds , fm , new HashSet < Long > ( ) ) ; }
Convenience wrapper for tests that don t care about unknown sites
53
13
154,739
public Map < Long , Long > reconfigureOnFault ( Set < Long > hsIds , FaultMessage fm , Set < Long > unknownFaultedSites ) { boolean proceed = false ; do { Discard ignoreIt = mayIgnore ( hsIds , fm ) ; if ( Discard . DoNot == ignoreIt ) { m_inTrouble . put ( fm . failedSite , fm . witnessed || fm . decided ) ; m_recover...
Process the fault message and if necessary start arbitration .
773
10
154,740
public static AbstractExpression createIndexExpressionForTable ( Table table , Map < Integer , Integer > ranges ) { HashRangeExpression predicate = new HashRangeExpression ( ) ; predicate . setRanges ( ranges ) ; predicate . setHashColumnIndex ( table . getPartitioncolumn ( ) . getIndex ( ) ) ; return predicate ; }
Create the expression used to build elastic index for a given table .
73
13
154,741
public void initialize ( ) throws Exception { List < Long > acctList = new ArrayList < Long > ( config . custcount * 2 ) ; List < String > stList = new ArrayList < String > ( config . custcount * 2 ) ; // generate customers System . out . println ( "generating " + config . custcount + " customers..." ) ; for ( int c = ...
this gets run once before the benchmark begins
546
8
154,742
public static void createHierarchy ( ZooKeeper zk ) { LinkedList < ZKUtil . StringCallback > callbacks = new LinkedList < ZKUtil . StringCallback > ( ) ; for ( String node : CoreZK . ZK_HIERARCHY ) { ZKUtil . StringCallback cb = new ZKUtil . StringCallback ( ) ; callbacks . add ( cb ) ; zk . create ( node , null , Ids ...
Creates the ZK directory nodes . Only the leader should do this .
192
15
154,743
public static int createRejoinNodeIndicator ( ZooKeeper zk , int hostId ) { try { zk . create ( rejoin_node_blocker , ByteBuffer . allocate ( 4 ) . putInt ( hostId ) . array ( ) , Ids . OPEN_ACL_UNSAFE , CreateMode . PERSISTENT ) ; } catch ( KeeperException e ) { if ( e . code ( ) == KeeperException . Code . NODEEXISTS...
Creates a rejoin blocker for the given rejoining host . This prevents other hosts from rejoining at the same time .
288
25
154,744
public static boolean removeRejoinNodeIndicatorForHost ( ZooKeeper zk , int hostId ) { try { Stat stat = new Stat ( ) ; final int rejoiningHost = ByteBuffer . wrap ( zk . getData ( rejoin_node_blocker , false , stat ) ) . getInt ( ) ; if ( hostId == rejoiningHost ) { zk . delete ( rejoin_node_blocker , stat . getVersio...
Removes the rejoin blocker if the current rejoin blocker contains the given host ID .
180
18
154,745
public static boolean removeJoinNodeIndicatorForHost ( ZooKeeper zk , int hostId ) { try { Stat stat = new Stat ( ) ; String path = ZKUtil . joinZKPath ( readyjoininghosts , Integer . toString ( hostId ) ) ; zk . getData ( path , false , stat ) ; zk . delete ( path , stat . getVersion ( ) ) ; return true ; } catch ( Ke...
Removes the join indicator for the given host ID .
166
11
154,746
public static boolean isPartitionCleanupInProgress ( ZooKeeper zk ) throws KeeperException , InterruptedException { List < String > children = zk . getChildren ( VoltZK . leaders_initiators , null ) ; List < ZKUtil . ChildrenCallback > childrenCallbacks = Lists . newArrayList ( ) ; for ( String child : children ) { ZKU...
Checks if the cluster suffered an aborted join or node shutdown and is still in the process of cleaning up .
185
22
154,747
public boolean isNullable ( ) { boolean isNullable = super . isNullable ( ) ; if ( isNullable ) { if ( dataType . isDomainType ( ) ) { return dataType . userTypeModifier . isNullable ( ) ; } } return isNullable ; }
Is column nullable .
63
5
154,748
Object getDefaultValue ( Session session ) { return defaultExpression == null ? null : defaultExpression . getValue ( session , dataType ) ; }
Returns default value in the session context .
32
8
154,749
Object getGeneratedValue ( Session session ) { return generatingExpression == null ? null : generatingExpression . getValue ( session , dataType ) ; }
Returns generated value in the session context .
33
8
154,750
public String getDefaultSQL ( ) { String ddl = null ; ddl = defaultExpression == null ? null : defaultExpression . getSQL ( ) ; return ddl ; }
Returns SQL for default value .
39
6
154,751
Expression getDefaultExpression ( ) { if ( defaultExpression == null ) { if ( dataType . isDomainType ( ) ) { return dataType . userTypeModifier . getDefaultClause ( ) ; } return null ; } else { return defaultExpression ; } }
Returns default expression for the column .
60
7
154,752
public static ZKUtil . StringCallback createSnapshotCompletionNode ( String path , String pathType , String nonce , long txnId , boolean isTruncation , String truncReqId ) { if ( ! ( txnId > 0 ) ) { VoltDB . crashGlobalVoltDB ( "Txnid must be greather than 0" , true , null ) ; } byte nodeBytes [ ] = null ; try { JSONSt...
Create the completion node for the snapshot identified by the txnId . It assumes that all hosts will race to call this so it doesn t fail if the node already exists .
498
35
154,753
public static void logParticipatingHostCount ( long txnId , int participantCount ) { ZooKeeper zk = VoltDB . instance ( ) . getHostMessenger ( ) . getZK ( ) ; final String snapshotPath = VoltZK . completed_snapshots + "/" + txnId ; boolean success = false ; while ( ! success ) { Stat stat = new Stat ( ) ; byte data [ ]...
Once participating host count is set SnapshotCompletionMonitor can check this ZK node to determine whether the snapshot has finished or not .
450
27
154,754
public synchronized void close ( ) { this . isPoolClosed = true ; while ( this . connectionsInactive . size ( ) > 0 ) { PooledConnection connection = dequeueFirstIfAny ( ) ; if ( connection != null ) { closePhysically ( connection , "closing inactive connection when connection pool was closed." ) ; } } }
Closes this connection pool . No further connections can be obtained from it after this . All inactive connections are physically closed before the call returns . Active connections are not closed . There may still be active connections in use after this method returns . When these connections are closed and returned t...
73
63
154,755
public synchronized void closeImmediatedly ( ) { close ( ) ; Iterator iterator = this . connectionsInUse . iterator ( ) ; while ( iterator . hasNext ( ) ) { PooledConnection connection = ( PooledConnection ) iterator . next ( ) ; SessionConnectionWrapper sessionWrapper = ( SessionConnectionWrapper ) this . sessionConne...
Closes this connection
107
4
154,756
public void setDriverClassName ( String driverClassName ) { if ( driverClassName . equals ( JDBCConnectionPoolDataSource . driver ) ) { return ; } /** @todo: Use a HSQLDB RuntimeException subclass */ throw new RuntimeException ( "This class only supports JDBC driver '" + JDBCConnectionPoolDataSource . driver + "'" ) ; ...
For compatibility .
79
3
154,757
@ Override public void toJSONString ( JSONStringer stringer ) throws JSONException { super . toJSONString ( stringer ) ; stringer . key ( "AGGREGATE_COLUMNS" ) . array ( ) ; for ( int ii = 0 ; ii < m_aggregateTypes . size ( ) ; ii ++ ) { stringer . object ( ) ; stringer . keySymbolValuePair ( Members . AGGREGATE_TYPE ....
Serialize to JSON . We only serialize the expressions and not the directions . We won t need them in the executor . The directions will be in the order by plan node in any case .
277
40
154,758
@ Override public void loadFromJSONObject ( JSONObject jobj , Database db ) throws JSONException { helpLoadFromJSONObject ( jobj , db ) ; JSONArray jarray = jobj . getJSONArray ( Members . AGGREGATE_COLUMNS . name ( ) ) ; int size = jarray . length ( ) ; for ( int i = 0 ; i < size ; i ++ ) { // We only expect one of th...
Deserialize a PartitionByPlanNode from JSON . Since we don t need the sort directions and we don t serialize them in toJSONString then we can t in general get them here .
315
41
154,759
@ Override public void run ( ) { Thread . currentThread ( ) . setName ( "Latency Watchdog" ) ; LOG . info ( String . format ( "Latency Watchdog enabled -- threshold:%d(ms) " + "wakeup_interval:%d(ms) min_log_interval:%d(ms)\n" , WATCHDOG_THRESHOLD , WAKEUP_INTERVAL , MIN_LOG_INTERVAL ) ) ; while ( true ) { for ( Entry ...
The watchdog thread will be invoked every WAKEUP_INTERVAL time to check if any thread that be monitored has not updated its time stamp more than WATCHDOG_THRESHOLD millisecond . Same stack trace messages are rate limited by MIN_LOG_INTERVAL .
363
56
154,760
public static ProcedurePartitionData fromPartitionInfoString ( String partitionInfoString ) { if ( partitionInfoString == null || partitionInfoString . trim ( ) . isEmpty ( ) ) { return new ProcedurePartitionData ( ) ; } String [ ] partitionInfoParts = new String [ 0 ] ; partitionInfoParts = partitionInfoString . split...
For Testing usage ONLY . From a partition information string to
316
11
154,761
@ Override public void runDDL ( String ddl ) { String modifiedDdl = transformDDL ( ddl ) ; printTransformedSql ( ddl , modifiedDdl ) ; super . runDDL ( modifiedDdl , false ) ; }
Modifies DDL statements in such a way that PostGIS results will match VoltDB results and then passes the remaining work to the base class version .
55
31
154,762
public void allHostNTProcedureCallback ( ClientResponse clientResponse ) { synchronized ( m_allHostCallbackLock ) { int hostId = Integer . parseInt ( clientResponse . getAppStatusString ( ) ) ; boolean removed = m_outstandingAllHostProcedureHostIds . remove ( hostId ) ; // log this for now... I don't expect it to ever ...
This is called when an all - host proc responds from a particular node . It completes the future when all of the
227
23
154,763
protected CompletableFuture < Map < Integer , ClientResponse > > callAllNodeNTProcedure ( String procName , Object ... params ) { // only one of these at a time if ( ! m_outstandingAllHostProc . compareAndSet ( false , true ) ) { throw new VoltAbortException ( new IllegalStateException ( "Only one AllNodeNTProcedure op...
Send an invocation directly to each host s CI mailbox . This ONLY works for NT procedures . Track responses and complete the returned future when they re all accounted for .
494
32
154,764
private void completeCall ( ClientResponseImpl response ) { // if we're keeping track, calculate result size if ( m_perCallStats . samplingProcedure ( ) ) { m_perCallStats . setResultSize ( response . getResults ( ) ) ; } m_statsCollector . endProcedure ( response . getStatus ( ) == ClientResponse . USER_ABORT , ( resp...
Send a response back to the proc caller . Refactored out of coreCall for both regular and exceptional paths .
254
23
154,765
public void processAnyCallbacksFromFailedHosts ( Set < Integer > failedHosts ) { synchronized ( m_allHostCallbackLock ) { failedHosts . stream ( ) . forEach ( i -> { if ( m_outstandingAllHostProcedureHostIds . contains ( i ) ) { ClientResponseImpl cri = new ClientResponseImpl ( ClientResponse . CONNECTION_LOST , new Vo...
For all - host NT procedures use site failures to call callbacks for hosts that will obviously never respond .
162
21
154,766
public final static void log ( int logger , int level , String statement ) { if ( logger < loggers . length ) { switch ( level ) { case trace : loggers [ logger ] . trace ( statement ) ; break ; case debug : loggers [ logger ] . debug ( statement ) ; break ; case error : loggers [ logger ] . error ( statement ) ; break...
All EE loggers will call this static method from C and specify the logger and level they want to log to . The level will be checked again in Java .
175
32
154,767
public static void restoreFile ( String sourceName , String destName ) throws IOException { RandomAccessFile source = new RandomAccessFile ( sourceName , "r" ) ; RandomAccessFile dest = new RandomAccessFile ( destName , "rw" ) ; while ( source . getFilePointer ( ) != source . length ( ) ) { int size = source . readInt ...
buggy database files had size == position == 0 at the end
178
13
154,768
String getHTMLForAdminPage ( Map < String , String > params ) { try { String template = m_htmlTemplates . get ( "admintemplate.html" ) ; for ( Entry < String , String > e : params . entrySet ( ) ) { String key = e . getKey ( ) . toUpperCase ( ) ; String value = e . getValue ( ) ; if ( key == null ) continue ; if ( valu...
Load a template for the admin page fill it out and return the value .
166
15
154,769
public void start ( ) throws InterruptedException , ExecutionException { Future < ? > task = es . submit ( handlePartitionChange ) ; task . get ( ) ; }
Start monitoring the leaders . This is a blocking operation .
36
11
154,770
public static Long update ( final long now ) { final long estNow = EstTime . m_now ; if ( estNow == now ) { return null ; } EstTime . m_now = now ; /* * Check if updating the estimated time was especially tardy. * I am concerned that the thread responsible for updating the estimated * time might be blocking on somethin...
Don t call this unless you have paused the updater and intend to update yourself
181
16
154,771
StatementDMQL compileMigrateStatement ( RangeVariable [ ] outerRanges ) { final Expression condition ; assert token . tokenType == Tokens . MIGRATE ; read ( ) ; readThis ( Tokens . FROM ) ; RangeVariable [ ] rangeVariables = { readSimpleRangeVariable ( StatementTypes . MIGRATE_WHERE ) } ; Table table = rangeVariables [...
Creates a MIGRATE - type statement from this parser context ( i . e . MIGRATE FROM tbl WHERE ...
316
28
154,772
StatementDMQL compileDeleteStatement ( RangeVariable [ ] outerRanges ) { Expression condition = null ; boolean truncate = false ; boolean restartIdentity = false ; switch ( token . tokenType ) { case Tokens . TRUNCATE : { read ( ) ; readThis ( Tokens . TABLE ) ; truncate = true ; break ; } case Tokens . DELETE : { read...
Creates a DELETE - type Statement from this parse context .
808
14
154,773
StatementDMQL compileUpdateStatement ( RangeVariable [ ] outerRanges ) { read ( ) ; Expression [ ] updateExpressions ; int [ ] columnMap ; boolean [ ] columnCheckList ; OrderedHashSet colNames = new OrderedHashSet ( ) ; HsqlArrayList exprList = new HsqlArrayList ( ) ; RangeVariable [ ] rangeVariables = { readSimpleRang...
Creates an UPDATE - type Statement from this parse context .
644
12
154,774
private void readMergeWhen ( OrderedHashSet insertColumnNames , OrderedHashSet updateColumnNames , HsqlArrayList insertExpressions , HsqlArrayList updateExpressions , RangeVariable [ ] targetRangeVars , RangeVariable sourceRangeVar ) { Table table = targetRangeVars [ 0 ] . rangeTable ; int columnCount = table . getColu...
Parses a WHEN clause from a MERGE statement . This can be either a WHEN MATCHED or WHEN NOT MATCHED clause or both and the appropriate values will be updated .
427
38
154,775
StatementDMQL compileCallStatement ( RangeVariable [ ] outerRanges , boolean isStrictlyProcedure ) { read ( ) ; if ( isIdentifier ( ) ) { checkValidCatalogName ( token . namePrePrefix ) ; RoutineSchema routineSchema = ( RoutineSchema ) database . schemaManager . findSchemaObject ( token . tokenString , session . getSch...
to do call argument name and type resolution
619
8
154,776
private SortAndSlice voltGetSortAndSliceForDelete ( RangeVariable [ ] rangeVariables ) { SortAndSlice sas = XreadOrderByExpression ( ) ; if ( sas == null || sas == SortAndSlice . noSort ) return SortAndSlice . noSort ; // Resolve columns in the ORDER BY clause. This code modified // from how compileDelete resolves colu...
This is a Volt extension to allow DELETE FROM tab ORDER BY c LIMIT 1 Adds a SortAndSlice object to the statement if the next tokens are ORDER BY LIMIT or OFFSET .
195
42
154,777
public ClassNameMatchStatus addPattern ( String classNamePattern ) { boolean matchFound = false ; if ( m_classList == null ) { m_classList = getClasspathClassFileNames ( ) ; } String preppedName = classNamePattern . trim ( ) ; // include only full classes // for nested classes, include the parent pattern int indexOfDol...
Add a pattern that matches classes from the classpath and add any matching classnames to m_classNameMatches .
442
24
154,778
private static void processPathPart ( String path , Set < String > classes ) { File rootFile = new File ( path ) ; if ( rootFile . isDirectory ( ) == false ) { return ; } File [ ] files = rootFile . listFiles ( ) ; for ( File f : files ) { // classes in the anonymous package if ( f . getName ( ) . endsWith ( ".class" )...
For a given classpath root scan it for packages and classes adding all found classnames to the given classes param .
175
23
154,779
static String getClasspathClassFileNames ( ) { String classpath = System . getProperty ( "java.class.path" ) ; String [ ] pathParts = classpath . split ( File . pathSeparator ) ; Set < String > classes = new TreeSet < String > ( ) ; for ( String part : pathParts ) { processPathPart ( part , classes ) ; } StringBuilder ...
Get a single string that contains all of the non - jar classfiles in the current classpath separated by newlines . Classfiles are represented by their Java dot names not filenames .
128
38
154,780
double getMemoryLimitSize ( String sizeStr ) { if ( sizeStr == null || sizeStr . length ( ) == 0 ) { return 0 ; } try { if ( sizeStr . charAt ( sizeStr . length ( ) - 1 ) == ' ' ) { // size as a percentage of total available memory int perc = Integer . parseInt ( sizeStr . substring ( 0 , sizeStr . length ( ) - 1 ) ) ;...
package - private for junit
260
6
154,781
public static void validatePath ( String path ) throws IllegalArgumentException { if ( path == null ) { throw new IllegalArgumentException ( "Path cannot be null" ) ; } if ( path . length ( ) == 0 ) { throw new IllegalArgumentException ( "Path length must be > 0" ) ; } if ( path . charAt ( 0 ) != ' ' ) { throw new Ille...
Validate the provided znode path string
499
8
154,782
protected void produceCopyForTransformation ( AbstractPlanNode copy ) { copy . m_outputSchema = m_outputSchema ; copy . m_hasSignificantOutputSchema = m_hasSignificantOutputSchema ; copy . m_outputColumnHints = m_outputColumnHints ; copy . m_estimatedOutputTupleCount = m_estimatedOutputTupleCount ; copy . m_estimatedPr...
Create a PlanNode that clones the configuration information but is not inserted in the plan graph and has a unique plan node id .
185
25
154,783
public void generateOutputSchema ( Database db ) { // default behavior: just copy the input schema // to the output schema assert ( m_children . size ( ) == 1 ) ; AbstractPlanNode childNode = m_children . get ( 0 ) ; childNode . generateOutputSchema ( db ) ; // Replace the expressions in our children's columns with TVE...
Generate the output schema for this node based on the output schemas of its children . The generated schema consists of the complete set of columns but is not yet ordered .
214
34
154,784
public void getTablesAndIndexes ( Map < String , StmtTargetTableScan > tablesRead , Collection < String > indexes ) { for ( AbstractPlanNode node : m_inlineNodes . values ( ) ) { node . getTablesAndIndexes ( tablesRead , indexes ) ; } for ( AbstractPlanNode node : m_children ) { node . getTablesAndIndexes ( tablesRead ...
Recursively build sets of tables read and index names used .
109
13
154,785
protected void getTablesAndIndexesFromSubqueries ( Map < String , StmtTargetTableScan > tablesRead , Collection < String > indexes ) { for ( AbstractExpression expr : findAllSubquerySubexpressions ( ) ) { assert ( expr instanceof AbstractSubqueryExpression ) ; AbstractSubqueryExpression subquery = ( AbstractSubqueryExp...
Collect read tables read and index names used in the current node subquery expressions .
125
16
154,786
public boolean isOutputOrdered ( List < AbstractExpression > sortExpressions , List < SortDirectionType > sortDirections ) { assert ( sortExpressions . size ( ) == sortDirections . size ( ) ) ; if ( m_children . size ( ) == 1 ) { return m_children . get ( 0 ) . isOutputOrdered ( sortExpressions , sortDirections ) ; } r...
Does the plan guarantee a result sorted according to the required sort order . The default implementation delegates the question to its child if there is only one child .
90
30
154,787
public final NodeSchema getTrueOutputSchema ( boolean resetBack ) throws PlanningErrorException { AbstractPlanNode child ; NodeSchema answer = null ; // // Note: This code is translated from the C++ code in // AbstractPlanNode::getOutputSchema. It's considerably // different there, but I think this has the corner // ca...
Find the true output schema . This may be in some child node . This seems to be the search order when constructing a plan node in the EE .
657
30
154,788
public void addAndLinkChild ( AbstractPlanNode child ) { assert ( child != null ) ; m_children . add ( child ) ; child . m_parents . add ( this ) ; }
Add a child and link this node child s parent .
41
11
154,789
public void setAndLinkChild ( int index , AbstractPlanNode child ) { assert ( child != null ) ; m_children . set ( index , child ) ; child . m_parents . add ( this ) ; }
Used to re - link the child without changing the order .
46
12
154,790
public void unlinkChild ( AbstractPlanNode child ) { assert ( child != null ) ; m_children . remove ( child ) ; child . m_parents . remove ( this ) ; }
Remove child from this node .
40
6
154,791
public boolean replaceChild ( AbstractPlanNode oldChild , AbstractPlanNode newChild ) { assert ( oldChild != null ) ; assert ( newChild != null ) ; int idx = 0 ; for ( AbstractPlanNode child : m_children ) { if ( child . equals ( oldChild ) ) { oldChild . m_parents . clear ( ) ; setAndLinkChild ( idx , newChild ) ; ret...
Replace an existing child with a new one preserving the child s position .
99
15
154,792
public void addIntermediary ( AbstractPlanNode node ) { // transfer this node's children to node Iterator < AbstractPlanNode > it = m_children . iterator ( ) ; while ( it . hasNext ( ) ) { AbstractPlanNode child = it . next ( ) ; it . remove ( ) ; // remove this.child from m_children assert child . getParentCount ( ) =...
Interject the provided node between this node and this node s current children
150
14
154,793
public boolean hasInlinedIndexScanOfTable ( String tableName ) { for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { AbstractPlanNode child = getChild ( i ) ; if ( child . hasInlinedIndexScanOfTable ( tableName ) == true ) { return true ; } } return false ; }
Refer to the override implementation on NestLoopIndexJoin node .
73
12
154,794
protected void findAllExpressionsOfClass ( Class < ? extends AbstractExpression > aeClass , Set < AbstractExpression > collected ) { // Check the inlined plan nodes for ( AbstractPlanNode inlineNode : getInlinePlanNodes ( ) . values ( ) ) { // For inline node we MUST go recursive to its children!!!!! inlineNode . findA...
Collect a unique list of expressions of a given type that this node has including its inlined nodes
142
19
154,795
public String toDOTString ( ) { StringBuilder sb = new StringBuilder ( ) ; // id [label=id: value-type <value-type-attributes>]; // id -> child_id; // id -> child_id; sb . append ( m_id ) . append ( " [label=\"" ) . append ( m_id ) . append ( ": " ) . append ( getPlanNodeType ( ) ) . append ( "\" " ) ; sb . append ( ge...
produce a file that can imported into graphviz for easier visualization
273
14
154,796
private String getValueTypeDotString ( ) { PlanNodeType pnt = getPlanNodeType ( ) ; if ( isInline ( ) ) { return "fontcolor=\"white\" style=\"filled\" fillcolor=\"red\"" ; } if ( pnt == PlanNodeType . SEND || pnt == PlanNodeType . RECEIVE || pnt == PlanNodeType . MERGERECEIVE ) { return "fontcolor=\"white\" style=\"fil...
maybe not worth polluting
112
5
154,797
public void getScanNodeList_recurse ( ArrayList < AbstractScanPlanNode > collected , HashSet < AbstractPlanNode > visited ) { if ( visited . contains ( this ) ) { assert ( false ) : "do not expect loops in plangraph." ; return ; } visited . add ( this ) ; for ( AbstractPlanNode n : m_children ) { n . getScanNodeList_re...
postorder adding scan nodes
129
5
154,798
public void getPlanNodeList_recurse ( ArrayList < AbstractPlanNode > collected , HashSet < AbstractPlanNode > visited ) { if ( visited . contains ( this ) ) { assert ( false ) : "do not expect loops in plangraph." ; return ; } visited . add ( this ) ; for ( AbstractPlanNode n : m_children ) { n . getPlanNodeList_recurs...
postorder add nodes
101
4
154,799
private static Object nullValueForType ( final Class < ? > expectedClz ) { if ( expectedClz == long . class ) { return VoltType . NULL_BIGINT ; } else if ( expectedClz == int . class ) { return VoltType . NULL_INTEGER ; } else if ( expectedClz == short . class ) { return VoltType . NULL_SMALLINT ; } else if ( expectedC...
Get the appropriate and compatible null value for a given parameter type .
147
13