idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
155,000
public String describe ( Session session ) { try { return describeImpl ( session ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return e . toString ( ) ; } }
Retrieves a String representation of this object .
155,001
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
155,002
private static List < Expression > getDisplayColumnsForSetOp ( QueryExpression queryExpr ) { assert ( queryExpr != null ) ; if ( queryExpr . getLeftQueryExpression ( ) == null ) { assert ( queryExpr instanceof QuerySpecification ) ; QuerySpecification select = ( QuerySpecification ) queryExpr ; return select . displayC...
Return a list of the display columns for the left most statement from a set op
155,003
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
155,004
public static Object getObjectFromString ( VoltType type , String value ) throws ParseException { Object ret = null ; switch ( type ) { case TINYINT : case SMALLINT : case INTEGER : case BIGINT : ret = Long . valueOf ( value ) ; break ; case FLOAT : ret = Double . valueOf ( value ) ; break ; case STRING : ret = value ;...
Returns a casted object of the input value string based on the given type
155,005
public static VoltType getNumericLiteralType ( VoltType vt , String value ) { try { Long . parseLong ( value ) ; } catch ( NumberFormatException e ) { 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 .
155,006
private static void writeLength ( ByteBuffer buf , int length ) { assert ( length >= 0 ) ; assert ( length == ( length & ( ~ length + 1 ) ) ) ; byte log2size = ( byte ) ( 32 - Integer . numberOfLeadingZeros ( length ) ) ; buf . put ( log2size ) ; }
Over - clever way to store lots of lengths in a single byte Length must be a power of two > = 0 .
155,007
public OpsAgent getAgent ( OpsSelector selector ) { OpsAgent agent = m_agents . get ( selector ) ; assert ( agent != null ) ; return agent ; }
Return the OpsAgent for the specified selector .
155,008
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 .
155,009
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
155,010
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
155,011
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
155,012
void addExportedTable ( String tableName , String targetName , boolean isStream ) { assert tableName != null && ! tableName . trim ( ) . isEmpty ( ) ; assert targetName != null && ! targetName . trim ( ) . isEmpty ( ) ; targetName = targetName . toUpperCase ( ) ; if ( isStream ) { NavigableSet < String > tableGroup = m...
Track an exported table
155,013
static < E > ImmutableList < E > asImmutableList ( Object [ ] elements , int length ) { switch ( length ) { case 0 : return of ( ) ; case 1 : @ SuppressWarnings ( "unchecked" ) ImmutableList < E > list = new SingletonImmutableList < E > ( ( E ) elements [ 0 ] ) ; return list ; default : if ( length < elements . length ...
Views the array as an immutable list . Copies if the specified range does not cover the complete array . Does not check for nulls .
155,014
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 .
155,015
static long calculateAverage ( long currAvg , long currInvoc , long rowAvg , long rowInvoc ) { long currTtl = currAvg * currInvoc ; long rowTtl = rowAvg * rowInvoc ; if ( ( currInvoc + rowInvoc ) == 0L ) { return 0L ; } else { return ( currTtl + rowTtl ) / ( currInvoc + rowInvoc ) ; } }
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
155,016
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 .
155,017
private static void storeRecentConnectionSettings ( Hashtable settings ) { try { if ( recentSettings == null ) { setHomeDir ( ) ; if ( homedir == null ) { return ; } recentSettings = new File ( homedir , fileName ) ; if ( ! recentSettings . exists ( ) ) { } } if ( settings == null || settings . size ( ) == 0 ) { return...
Here s a non - secure method of storing recent connection settings .
155,018
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 .
155,019
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 .
155,020
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 .
155,021
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
155,022
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 .
155,023
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 .
155,024
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 .
155,025
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 .
155,026
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
155,027
public void recordValue ( final long value ) throws ArrayIndexOutOfBoundsException { long criticalValueAtEnter = recordingPhaser . writerCriticalSectionEnter ( ) ; try { activeHistogram . recordValue ( value ) ; } finally { recordingPhaser . writerCriticalSectionExit ( criticalValueAtEnter ) ; } }
Record a value
155,028
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 .
155,029
public void repairSurvivors ( ) { if ( this . m_promotionResult . isCancelled ( ) ) { repairLogger . debug ( m_whoami + "Skipping repair message creation for cancelled Term." ) ; return ; } int queued = 0 ; if ( repairLogger . isDebugEnabled ( ) ) { repairLogger . debug ( m_whoami + "received all repair logs and is rep...
Send missed - messages to survivors .
155,030
void init ( ResultMetaData meta , HsqlProperties props ) throws SQLException { resultMetaData = meta ; columnCount = resultMetaData . getColumnCount ( ) ; useColumnName = ( props == null ) ? true : props . isPropertyTrue ( "get_column_name" , true ) ; }
Initializes this JDBCResultSetMetaData object from the specified Result and HsqlProperties objects .
155,031
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
155,032
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 .
155,033
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 .
155,034
public void initialize ( ) throws Exception { List < Long > acctList = new ArrayList < Long > ( config . custcount * 2 ) ; List < String > stList = new ArrayList < String > ( config . custcount * 2 ) ; System . out . println ( "generating " + config . custcount + " customers..." ) ; for ( int c = 0 ; c < config . custc...
this gets run once before the benchmark begins
155,035
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 .
155,036
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 .
155,037
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 .
155,038
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 .
155,039
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 .
155,040
public boolean isNullable ( ) { boolean isNullable = super . isNullable ( ) ; if ( isNullable ) { if ( dataType . isDomainType ( ) ) { return dataType . userTypeModifier . isNullable ( ) ; } } return isNullable ; }
Is column nullable .
155,041
Object getDefaultValue ( Session session ) { return defaultExpression == null ? null : defaultExpression . getValue ( session , dataType ) ; }
Returns default value in the session context .
155,042
Object getGeneratedValue ( Session session ) { return generatingExpression == null ? null : generatingExpression . getValue ( session , dataType ) ; }
Returns generated value in the session context .
155,043
public String getDefaultSQL ( ) { String ddl = null ; ddl = defaultExpression == null ? null : defaultExpression . getSQL ( ) ; return ddl ; }
Returns SQL for default value .
155,044
Expression getDefaultExpression ( ) { if ( defaultExpression == null ) { if ( dataType . isDomainType ( ) ) { return dataType . userTypeModifier . getDefaultClause ( ) ; } return null ; } else { return defaultExpression ; } }
Returns default expression for the column .
155,045
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 .
155,046
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 .
155,047
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...
155,048
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
155,049
public void setDriverClassName ( String driverClassName ) { if ( driverClassName . equals ( JDBCConnectionPoolDataSource . driver ) ) { return ; } throw new RuntimeException ( "This class only supports JDBC driver '" + JDBCConnectionPoolDataSource . driver + "'" ) ; }
For compatibility .
155,050
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 . name ( ) ,...
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 .
155,051
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 ++ ) { assert ( i == 0 ) ; JSONObject tempObj...
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 .
155,052
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 < Thread , ...
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 .
155,053
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
155,054
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 .
155,055
public void allHostNTProcedureCallback ( ClientResponse clientResponse ) { synchronized ( m_allHostCallbackLock ) { int hostId = Integer . parseInt ( clientResponse . getAppStatusString ( ) ) ; boolean removed = m_outstandingAllHostProcedureHostIds . remove ( hostId ) ; if ( ! removed ) { tmLog . error ( String . forma...
This is called when an all - host proc responds from a particular node . It completes the future when all of the
155,056
protected CompletableFuture < Map < Integer , ClientResponse > > callAllNodeNTProcedure ( String procName , Object ... params ) { if ( ! m_outstandingAllHostProc . compareAndSet ( false , true ) ) { throw new VoltAbortException ( new IllegalStateException ( "Only one AllNodeNTProcedure operation can be running at a tim...
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 .
155,057
private void completeCall ( ClientResponseImpl response ) { if ( m_perCallStats . samplingProcedure ( ) ) { m_perCallStats . setResultSize ( response . getResults ( ) ) ; } m_statsCollector . endProcedure ( response . getStatus ( ) == ClientResponse . USER_ABORT , ( response . getStatus ( ) != ClientResponse . USER_ABO...
Send a response back to the proc caller . Refactored out of coreCall for both regular and exceptional paths .
155,058
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 .
155,059
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 .
155,060
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
155,061
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 .
155,062
public void start ( ) throws InterruptedException , ExecutionException { Future < ? > task = es . submit ( handlePartitionChange ) ; task . get ( ) ; }
Start monitoring the leaders . This is a blocking operation .
155,063
public static Long update ( final long now ) { final long estNow = EstTime . m_now ; if ( estNow == now ) { return null ; } EstTime . m_now = now ; if ( now - estNow > ESTIMATED_TIME_WARN_INTERVAL ) { if ( lastErrorReport > now ) { lastErrorReport = now ; } if ( now - lastErrorReport > maxErrorReportInterval ) { lastEr...
Don t call this unless you have paused the updater and intend to update yourself
155,064
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 ...
155,065
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 .
155,066
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 .
155,067
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 .
155,068
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
155,069
private SortAndSlice voltGetSortAndSliceForDelete ( RangeVariable [ ] rangeVariables ) { SortAndSlice sas = XreadOrderByExpression ( ) ; if ( sas == null || sas == SortAndSlice . noSort ) return SortAndSlice . noSort ; for ( int i = 0 ; i < sas . exprList . size ( ) ; ++ i ) { Expression e = ( Expression ) sas . exprLi...
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 .
155,070
public ClassNameMatchStatus addPattern ( String classNamePattern ) { boolean matchFound = false ; if ( m_classList == null ) { m_classList = getClasspathClassFileNames ( ) ; } String preppedName = classNamePattern . trim ( ) ; int indexOfDollarSign = classNamePattern . indexOf ( '$' ) ; if ( indexOfDollarSign >= 0 ) { ...
Add a pattern that matches classes from the classpath and add any matching classnames to m_classNameMatches .
155,071
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 ) { if ( f . getName ( ) . endsWith ( ".class" ) ) { String className = f . getName ...
For a given classpath root scan it for packages and classes adding all found classnames to the given classes param .
155,072
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 .
155,073
double getMemoryLimitSize ( String sizeStr ) { if ( sizeStr == null || sizeStr . length ( ) == 0 ) { return 0 ; } try { if ( sizeStr . charAt ( sizeStr . length ( ) - 1 ) == '%' ) { int perc = Integer . parseInt ( sizeStr . substring ( 0 , sizeStr . length ( ) - 1 ) ) ; if ( perc < 0 || perc > 99 ) { throw new IllegalA...
package - private for junit
155,074
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
155,075
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 .
155,076
public void generateOutputSchema ( Database db ) { assert ( m_children . size ( ) == 1 ) ; AbstractPlanNode childNode = m_children . get ( 0 ) ; childNode . generateOutputSchema ( db ) ; m_hasSignificantOutputSchema = false ; m_outputSchema = childNode . getOutputSchema ( ) . copyAndReplaceWithTVE ( ) ; }
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 .
155,077
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 .
155,078
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 .
155,079
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 .
155,080
public final NodeSchema getTrueOutputSchema ( boolean resetBack ) throws PlanningErrorException { AbstractPlanNode child ; NodeSchema answer = null ; for ( child = this ; child != null ; child = ( child . getChildCount ( ) == 0 ) ? null : child . getChild ( 0 ) ) { NodeSchema childSchema ; if ( child . m_hasSignificant...
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 .
155,081
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 .
155,082
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 .
155,083
public void unlinkChild ( AbstractPlanNode child ) { assert ( child != null ) ; m_children . remove ( child ) ; child . m_parents . remove ( this ) ; }
Remove child from this node .
155,084
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 .
155,085
public void addIntermediary ( AbstractPlanNode node ) { Iterator < AbstractPlanNode > it = m_children . iterator ( ) ; while ( it . hasNext ( ) ) { AbstractPlanNode child = it . next ( ) ; it . remove ( ) ; assert child . getParentCount ( ) == 1 ; child . clearParents ( ) ; node . addAndLinkChild ( child ) ; } assert (...
Interject the provided node between this node and this node s current children
155,086
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 .
155,087
protected void findAllExpressionsOfClass ( Class < ? extends AbstractExpression > aeClass , Set < AbstractExpression > collected ) { for ( AbstractPlanNode inlineNode : getInlinePlanNodes ( ) . values ( ) ) { inlineNode . findAllExpressionsOfClass ( aeClass , collected ) ; } NodeSchema schema = getOutputSchema ( ) ; if...
Collect a unique list of expressions of a given type that this node has including its inlined nodes
155,088
public String toDOTString ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( m_id ) . append ( " [label=\"" ) . append ( m_id ) . append ( ": " ) . append ( getPlanNodeType ( ) ) . append ( "\" " ) ; sb . append ( getValueTypeDotString ( ) ) ; sb . append ( "];\n" ) ; for ( AbstractPlanNode node : m_inlineN...
produce a file that can imported into graphviz for easier visualization
155,089
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
155,090
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
155,091
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
155,092
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 .
155,093
private static Object convertStringToPrimitiveOrPrimitiveWrapper ( String value , final Class < ? > expectedClz ) throws VoltTypeException { value = value . trim ( ) ; if ( value . equals ( Constants . CSV_NULL ) ) return nullValueForType ( expectedClz ) ; String commaFreeValue = thousandSeparator . matcher ( value ) ....
Given a string covert it to a primitive type or boxed type of the primitive type or return null .
155,094
private static Object tryToMakeCompatibleArray ( final Class < ? > expectedComponentClz , final Class < ? > inputComponentClz , Object param ) throws VoltTypeException { int inputLength = Array . getLength ( param ) ; if ( inputComponentClz == expectedComponentClz ) { return param ; } else if ( inputLength == 0 ) { ret...
Factored out code to handle array parameter types .
155,095
final static public VoltTable [ ] getResultsFromRawResults ( String procedureName , Object result ) throws InvocationTargetException { if ( result == null ) { return new VoltTable [ 0 ] ; } if ( result instanceof VoltTable [ ] ) { VoltTable [ ] retval = ( VoltTable [ ] ) result ; for ( VoltTable table : retval ) { if (...
Given the results of a procedure convert it into a sensible array of VoltTables .
155,096
public static void main ( String [ ] args ) { if ( args . length > 1 ) { printUsage ( ) ; } if ( args . length == 0 || ( args . length == 1 && args [ 0 ] . equals ( "--full" ) ) ) { System . out . println ( getFullVersion ( ) ) ; System . exit ( 0 ) ; } if ( args [ 0 ] . equals ( "--short" ) ) System . out . println ( ...
Prints the current version revision and build date to the standard out .
155,097
void setFinal ( boolean isFinal ) throws IOException { if ( isFinal != m_isFinal ) { if ( PBDSegment . setFinal ( m_file , isFinal ) ) { if ( ! isFinal ) { m_fc . force ( true ) ; } } else if ( PBDSegment . isFinal ( m_file ) && ! isFinal ) { throw new IOException ( "Could not remove the final attribute from " + m_file...
Set or clear segment as final i . e . whether segment is complete and logically immutable .
155,098
public static String createParticipantNode ( ZooKeeper zk , String dir , String prefix , byte [ ] data ) throws KeeperException , InterruptedException { createRootIfNotExist ( zk , dir ) ; String node = zk . create ( ZKUtil . joinZKPath ( dir , prefix + "_" ) , data , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQU...
Provide a way for clients to create nodes which comply with the leader election format without participating in a leader election
155,099
synchronized public void shutdown ( ) throws InterruptedException , KeeperException { m_shutdown = true ; es . shutdown ( ) ; es . awaitTermination ( 365 , TimeUnit . DAYS ) ; }
Deletes the ephemeral node . Make sure that no future watches will fire .