idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
154,600 | private final < T > ImmutableList < Callable < T > > wrapTasks ( Collection < ? extends Callable < T > > tasks ) { ImmutableList . Builder < Callable < T > > builder = ImmutableList . builder ( ) ; for ( Callable < T > task : tasks ) { builder . add ( wrapTask ( task ) ) ; } return builder . build ( ) ; } | Wraps a collection of tasks . |
154,601 | public void loadProcedures ( CatalogContext catalogContext , boolean isInitOrReplay ) { m_defaultProcManager = catalogContext . m_defaultProcs ; m_defaultProcCache . clear ( ) ; m_plannerTool = catalogContext . m_ptool ; m_sysProcs = loadSystemProcedures ( catalogContext , m_site ) ; try { if ( isInitOrReplay ) { m_use... | Load procedures . |
154,602 | private static SQLPatternPart makeInnerProcedureModifierClausePattern ( boolean captureTokens ) { return SPF . oneOf ( SPF . clause ( SPF . token ( "allow" ) , SPF . group ( captureTokens , SPF . commaList ( SPF . userName ( ) ) ) ) , SPF . clause ( SPF . token ( "partition" ) , SPF . token ( "on" ) , SPF . token ( "ta... | Build a pattern segment to accept a single optional ALLOW or PARTITION clause to modify CREATE PROCEDURE statements . |
154,603 | static SQLPatternPart unparsedProcedureModifierClauses ( ) { return SPF . capture ( SPF . repeat ( makeInnerProcedureModifierClausePattern ( false ) ) ) . withFlags ( SQLPatternFactory . ADD_LEADING_SPACE_TO_CHILD ) ; } | Build a pattern segment to recognize all the ALLOW or PARTITION modifier clauses of a CREATE PROCEDURE statement . |
154,604 | private static SQLPatternPart makeInnerStreamModifierClausePattern ( boolean captureTokens ) { return SPF . oneOf ( SPF . clause ( SPF . token ( "export" ) , SPF . token ( "to" ) , SPF . token ( "target" ) , SPF . group ( captureTokens , SPF . databaseObjectName ( ) ) ) , SPF . clause ( SPF . token ( "partition" ) , SP... | Build a pattern segment to accept a single optional EXPORT or PARTITION clause to modify CREATE STREAM statements . |
154,605 | private static SQLPatternPart unparsedStreamModifierClauses ( ) { return SPF . capture ( SPF . repeat ( makeInnerStreamModifierClausePattern ( false ) ) ) . withFlags ( SQLPatternFactory . ADD_LEADING_SPACE_TO_CHILD ) ; } | Build a pattern segment to recognize all the EXPORT or PARTITION modifier clauses of a CREATE STREAM statement . |
154,606 | private static List < String > parseExecParameters ( String paramText ) { final String SafeParamStringValuePattern = "#(SQL_PARSER_SAFE_PARAMSTRING)" ; ArrayList < String > originalString = new ArrayList < > ( ) ; Matcher stringMatcher = SingleQuotedString . matcher ( paramText ) ; StringBuilder safeText = new StringBu... | to the extent that comments are supported they have already been stripped out . |
154,607 | public static ParseRecallResults parseRecallStatement ( String statement , int lineMax ) { Matcher matcher = RecallToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; String lineNumberText = matcher . group ( 2 ) ; String error ; if ( OneWhitespace . mat... | Parse RECALL statement for sqlcmd . |
154,608 | public static List < FileInfo > parseFileStatement ( FileInfo parentContext , String statement ) { Matcher fileMatcher = FileToken . matcher ( statement ) ; if ( ! fileMatcher . lookingAt ( ) ) { return null ; } String remainder = statement . substring ( fileMatcher . end ( ) , statement . length ( ) ) ; List < FileInf... | Parse FILE statement for sqlcmd . |
154,609 | public static String parseShowStatementSubcommand ( String statement ) { Matcher matcher = ShowToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { String trailings = matcher . group... | Parse a SHOW or LIST statement for sqlcmd . |
154,610 | public static String parseHelpStatement ( String statement ) { Matcher matcher = HelpToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { String trailings = matcher . group ( 3 ) + "... | Parse HELP statement for sqlcmd . The sub - command will be if the user just typed HELP . |
154,611 | public static String getDigitsFromHexLiteral ( String paramString ) { Matcher matcher = SingleQuotedHexLiteral . matcher ( paramString ) ; if ( matcher . matches ( ) ) { return matcher . group ( 1 ) ; } return null ; } | Given a parameter string if it s of the form x 0123456789ABCDEF return a string containing just the digits . Otherwise return null . |
154,612 | public static long hexDigitsToLong ( String hexDigits ) throws SQLParser . Exception { if ( hexDigits . length ( ) > 16 ) { throw new SQLParser . Exception ( "Too many hexadecimal digits for BIGINT value" ) ; } if ( hexDigits . length ( ) == 0 ) { throw new SQLParser . Exception ( "Zero hexadecimal digits is invalid fo... | Given a string of hex digits produce a long value assuming a 2 s complement representation . |
154,613 | public static ExecuteCallResults parseExecuteCall ( String statement , Map < String , Map < Integer , List < String > > > procedures ) throws SQLParser . Exception { assert ( procedures != null ) ; return parseExecuteCallInternal ( statement , procedures ) ; } | Parse EXECUTE procedure call . |
154,614 | private static ExecuteCallResults parseExecuteCallInternal ( String statement , Map < String , Map < Integer , List < String > > > procedures ) throws SQLParser . Exception { Matcher matcher = ExecuteCallPreamble . matcher ( statement ) ; if ( ! matcher . lookingAt ( ) ) { return null ; } String commandWordTerminator =... | Private implementation of parse EXECUTE procedure call . Also supports short - circuiting procedure lookup for testing . |
154,615 | public static boolean appearsToBeValidDDLBatch ( String batch ) { BufferedReader reader = new BufferedReader ( new StringReader ( batch ) ) ; String line ; try { while ( ( line = reader . readLine ( ) ) != null ) { if ( isWholeLineComment ( line ) ) { continue ; } line = line . trim ( ) ; if ( line . equals ( "" ) ) co... | Make sure that the batch starts with an appropriate DDL verb . We do not look further than the first token of the first non - comment and non - whitespace line . |
154,616 | public static String parseEchoStatement ( String statement ) { Matcher matcher = EchoToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { return matcher . group ( 2 ) ; } return "" ;... | Parse ECHO statement for sqlcmd . The result will be if the user just typed ECHO . |
154,617 | public static String parseEchoErrorStatement ( String statement ) { Matcher matcher = EchoErrorToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { return matcher . group ( 2 ) ; } r... | Parse ECHOERROR statement for sqlcmd . The result will be if the user just typed ECHOERROR . |
154,618 | public static String parseDescribeStatement ( String statement ) { Matcher matcher = DescribeToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { String trailings = matcher . group (... | Parse DESCRIBE statement for sqlcmd . The result will be if the user just typed DESCRIBE or DESC . |
154,619 | void resolveColumnRefernecesInUnionOrderBy ( ) { int orderCount = sortAndSlice . getOrderLength ( ) ; if ( orderCount == 0 ) { return ; } String [ ] unionColumnNames = getColumnNames ( ) ; for ( int i = 0 ; i < orderCount ; i ++ ) { Expression sort = ( Expression ) sortAndSlice . exprList . get ( i ) ; Expression e = s... | Only simple column reference or column position allowed |
154,620 | public void setTableColumnNames ( HashMappedList list ) { if ( resultTable != null ) { ( ( TableDerived ) resultTable ) . columnList = list ; return ; } leftQueryExpression . setTableColumnNames ( list ) ; } | Used in views after full type resolution |
154,621 | public void setAsTopLevel ( ) { if ( compileContext . getSequences ( ) . length > 0 ) { throw Error . error ( ErrorCode . X_42598 ) ; } isTopLevel = true ; setReturningResultSet ( ) ; } | Not for views . Only used on root node . |
154,622 | void setReturningResultSet ( ) { if ( unionCorresponding ) { persistenceScope = TableBase . SCOPE_SESSION ; columnMode = TableBase . COLUMNS_UNREFERENCED ; return ; } leftQueryExpression . setReturningResultSet ( ) ; } | Sets the scope to SESSION for the QueryExpression object that creates the table |
154,623 | public void schedulePeriodicStats ( ) { Runnable statsPrinter = new Runnable ( ) { public void run ( ) { printStatistics ( ) ; } } ; m_scheduler . scheduleWithFixedDelay ( statsPrinter , m_config . displayinterval , m_config . displayinterval , TimeUnit . SECONDS ) ; } | Add a task to the scheduler to print statistics to the console at regular intervals . |
154,624 | public synchronized void printResults ( ) throws Exception { ClientStats stats = m_fullStatsContext . fetch ( ) . getStats ( ) ; System . out . print ( HORIZONTAL_RULE ) ; System . out . println ( " Client Workload Statistics" ) ; System . out . println ( HORIZONTAL_RULE ) ; System . out . printf ( "Average throughput:... | Prints some summary statistics about performance . |
154,625 | private void shutdown ( ) { m_scheduler . shutdown ( ) ; try { m_scheduler . awaitTermination ( 60 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } try { m_client . drain ( ) ; m_client . close ( ) ; } catch ( IOException | InterruptedException e ) { e . printStackTrace ( ) ; } ... | Perform various tasks to end the demo cleanly . |
154,626 | private void requestAd ( ) { long deviceId = Math . abs ( m_rand . nextLong ( ) ) % AdBrokerBenchmark . NUM_DEVICES ; GeographyPointValue point = getRandomPoint ( ) ; try { m_client . callProcedure ( new NullCallback ( ) , "GetHighestBidForLocation" , deviceId , point ) ; } catch ( IOException e ) { e . printStackTrace... | Invoke the stored procedure GetHighestBidForLocation which given a random point returns the id of the bid that has the highest dollar amount . |
154,627 | public void promoteSinglePartitionInfo ( HashMap < AbstractExpression , Set < AbstractExpression > > valueEquivalence , Set < Set < AbstractExpression > > eqSets ) { assert ( getScanPartitioning ( ) != null ) ; if ( getScanPartitioning ( ) . getCountOfPartitionedTables ( ) == 0 || getScanPartitioning ( ) . requiresTwoF... | upgrade single partitioning expression to parent level add the info to equality sets and input value equivalence |
154,628 | private void updateEqualSets ( Set < AbstractExpression > values , HashMap < AbstractExpression , Set < AbstractExpression > > valueEquivalence , Set < Set < AbstractExpression > > eqSets , AbstractExpression tveKey , AbstractExpression spExpr ) { boolean hasLegacyValues = false ; if ( eqSets . contains ( values ) ) { ... | Because HashSet stored a legacy hashcode for the non - final object . |
154,629 | public boolean getIsReplicated ( ) { for ( StmtTableScan tableScan : m_subqueryStmt . allScans ( ) ) { if ( ! tableScan . getIsReplicated ( ) ) { return false ; } } return true ; } | The subquery is replicated if all tables from the FROM clause defining this subquery are replicated |
154,630 | public TupleValueExpression getOutputExpression ( int index ) { SchemaColumn schemaCol = getSchemaColumn ( index ) ; TupleValueExpression tve = new TupleValueExpression ( getTableAlias ( ) , getTableAlias ( ) , schemaCol . getColumnAlias ( ) , schemaCol . getColumnAlias ( ) , index ) ; return tve ; } | Produce a tuple value expression for a column produced by this subquery |
154,631 | static private ComparisonExpression rangeFilterFromPrefixLike ( AbstractExpression leftExpr , ExpressionType rangeComparator , String comparand ) { ConstantValueExpression cve = new ConstantValueExpression ( ) ; cve . setValueType ( VoltType . STRING ) ; cve . setValue ( comparand ) ; cve . setValueSize ( comparand . l... | Construct the upper or lower bound expression that is implied by a prefix LIKE operator given its required elements . |
154,632 | public NodeSchema resetTableName ( String tbName , String tbAlias ) { m_columns . forEach ( sc -> sc . reset ( tbName , tbAlias , sc . getColumnName ( ) , sc . getColumnAlias ( ) ) ) ; m_columnsMapHelper . forEach ( ( k , v ) -> k . reset ( tbName , tbAlias , k . getColumnName ( ) , k . getColumnAlias ( ) ) ) ; return ... | Substitute table name only for all schema columns and map entries |
154,633 | public void addColumn ( SchemaColumn column ) { int size = m_columns . size ( ) ; m_columnsMapHelper . put ( column , size ) ; m_columns . add ( column ) ; } | Add a column to this schema . |
154,634 | public SchemaColumn find ( String tableName , String tableAlias , String columnName , String columnAlias ) { SchemaColumn col = new SchemaColumn ( tableName , tableAlias , columnName , columnAlias ) ; int index = findIndexOfColumn ( col ) ; if ( index != - 1 ) { return m_columns . get ( index ) ; } return null ; } | Retrieve the SchemaColumn that matches the provided arguments . |
154,635 | void sortByTveIndex ( int fromIndex , int toIndex ) { Collections . sort ( m_columns . subList ( fromIndex , toIndex ) , TVE_IDX_COMPARE ) ; } | Sort a sub - range of the schema columns by TVE index . All elements must be TupleValueExpressions . Modification is made in - place . |
154,636 | public boolean equalsOnlyNames ( NodeSchema otherSchema ) { if ( otherSchema == null ) { return false ; } if ( otherSchema . size ( ) != size ( ) ) { return false ; } for ( int colIndex = 0 ; colIndex < size ( ) ; colIndex ++ ) { SchemaColumn col1 = otherSchema . getColumn ( colIndex ) ; SchemaColumn col2 = m_columns .... | names are the same . Don t worry about the differentiator field . |
154,637 | NodeSchema copyAndReplaceWithTVE ( ) { NodeSchema copy = new NodeSchema ( ) ; int colIndex = 0 ; for ( SchemaColumn column : m_columns ) { copy . addColumn ( column . copyAndReplaceWithTVE ( colIndex ) ) ; ++ colIndex ; } return copy ; } | Returns a copy of this NodeSchema but with all non - TVE expressions replaced with an appropriate TVE . This is used primarily when generating a node s output schema based on its childrens schema ; we want to carry the columns across but leave any non - TVE expressions behind . |
154,638 | public boolean harmonize ( NodeSchema otherSchema , String schemaKindName ) { if ( size ( ) != otherSchema . size ( ) ) { throw new PlanningErrorException ( "The " + schemaKindName + "schema and the statement output schemas have different lengths." ) ; } boolean changedSomething = false ; for ( int idx = 0 ; idx < size... | Modifies this schema such that its columns can accommodate both values of its own types and that of otherSchema . Does not modify otherSchema . |
154,639 | void set ( final long valueIteratedTo , final long valueIteratedFrom , final long countAtValueIteratedTo , final long countInThisIterationStep , final long totalCountToThisValue , final long totalValueToThisValue , final double percentile , final double percentileLevelIteratedTo , double integerToDoubleValueConversionR... | Set is all - or - nothing to avoid the potential for accidental omission of some values ... |
154,640 | public List < AbstractExpression > bindingToIndexedExpression ( AbstractExpression expr ) { if ( m_originalValue == null || ! m_originalValue . equals ( expr ) ) { return null ; } List < AbstractExpression > result = new ArrayList < AbstractExpression > ( ) ; result . add ( this ) ; return result ; } | query in which that constant differs . |
154,641 | Object getParameterAtIndex ( int partitionIndex ) { try { if ( serializedParams != null ) { return ParameterSet . getParameterAtIndex ( partitionIndex , serializedParams . duplicate ( ) ) ; } else { return params . get ( ) . getParam ( partitionIndex ) ; } } catch ( Exception ex ) { throw new RuntimeException ( "Invali... | Read into an serialized parameter buffer to extract a single parameter |
154,642 | public void flattenToBufferForOriginalVersion ( ByteBuffer buf ) throws IOException { assert ( ( params != null ) || ( serializedParams != null ) ) ; int startPosition = buf . position ( ) ; buf . put ( ProcedureInvocationType . ORIGINAL . getValue ( ) ) ; SerializationHelper . writeVarbinary ( getProcNameBytes ( ) , b... | Serializes this SPI in the original serialization version . This is currently used by DR . |
154,643 | public synchronized void submit ( long offset ) { if ( submittedOffset == - 1L && offset >= 0 ) { committedOffsets [ idx ( offset ) ] = safeOffset = submittedOffset = offset ; } if ( firstOffset == - 1L ) { firstOffset = offset ; } if ( ( offset - safeOffset ) >= committedOffsets . length ) { offerOffset = offset ; try... | submit an offset while consuming a message and record the maximal submitted offset |
154,644 | public synchronized long commit ( long offset ) { if ( offset <= submittedOffset && offset > safeOffset ) { int ggap = ( int ) Math . min ( committedOffsets . length , offset - safeOffset ) ; if ( ggap == committedOffsets . length ) { LOGGER . rateLimitedLog ( LOG_SUPPRESSION_INTERVAL_SECONDS , Level . WARN , null , "C... | VoltDB . It will be recorded in committedOffsets and calculate the offset - safeOffset which is safe to commit to Kafka |
154,645 | public void log ( long now , Level level , Throwable cause , String stemformat , Object ... args ) { if ( now - m_lastLogTime > m_maxLogIntervalMillis ) { synchronized ( this ) { if ( now - m_lastLogTime > m_maxLogIntervalMillis ) { String message = formatMessage ( cause , stemformat , args ) ; switch ( level ) { case ... | This variant delays the formatting of the string message until it is actually logged |
154,646 | private void sendFirstFragResponse ( ) { if ( ELASTICLOG . isDebugEnabled ( ) ) { ELASTICLOG . debug ( "P" + m_partitionId + " sending first fragment response to coordinator " + CoreUtils . hsIdToString ( m_coordinatorHsId ) ) ; } RejoinMessage msg = new RejoinMessage ( m_mailbox . getHSId ( ) , RejoinMessage . Type . ... | Notify the coordinator that this site has received the first fragment message |
154,647 | private void runForBlockingDataTransfer ( SiteProcedureConnection siteConnection ) { boolean sourcesReady = false ; RestoreWork restoreWork = m_dataSink . poll ( m_snapshotBufferAllocator ) ; if ( restoreWork != null ) { restoreBlock ( restoreWork , siteConnection ) ; sourcesReady = true ; } if ( m_dataSink . isEOF ( )... | Blocking transfer all partitioned table data and notify the coordinator . |
154,648 | public < T > T getService ( URI bundleURI , Class < T > svcClazz ) { return m_bundles . getService ( bundleURI , svcClazz ) ; } | Gets the service from the given bundle jar uri . Loads and starts the bundle if it isn t yet loaded |
154,649 | public void setPos ( int pos ) { position = pos ; NodeAVL n = nPrimaryNode ; while ( n != null ) { ( ( NodeAVLDisk ) n ) . iData = position ; n = n . nNext ; } } | Sets the file position for the row |
154,650 | void setNewNodes ( ) { int indexcount = tTable . getIndexCount ( ) ; nPrimaryNode = new NodeAVLDisk ( this , 0 ) ; NodeAVL n = nPrimaryNode ; for ( int i = 1 ; i < indexcount ; i ++ ) { n . nNext = new NodeAVLDisk ( this , i ) ; n = n . nNext ; } } | used in CachedDataRow |
154,651 | public void write ( RowOutputInterface out ) { try { writeNodes ( out ) ; if ( hasDataChanged ) { out . writeData ( rowData , tTable . colTypes ) ; out . writeEnd ( ) ; hasDataChanged = false ; } } catch ( IOException e ) { } } | Used exclusively by Cache to save the row to disk . New implementation in 1 . 7 . 2 writes out only the Node data if the table row data has not changed . This situation accounts for the majority of invocations as for each row deleted or inserted the Nodes for several other rows will change . |
154,652 | private void writeNodes ( RowOutputInterface out ) throws IOException { out . writeSize ( storageSize ) ; NodeAVL n = nPrimaryNode ; while ( n != null ) { n . write ( out ) ; n = n . nNext ; } hasNodesChanged = false ; } | Writes the Nodes immediately after the row size . |
154,653 | public void serializeToBuffer ( ByteBuffer b ) { assert ( getSerializedSize ( ) <= b . remaining ( ) ) ; b . putInt ( getSerializedSize ( ) - 4 ) ; b . put ( ( byte ) getExceptionType ( ) . ordinal ( ) ) ; if ( m_message != null ) { final byte messageBytes [ ] = m_message . getBytes ( ) ; b . putInt ( messageBytes . le... | Serialize this exception to the supplied byte buffer |
154,654 | protected void populateColumnSchema ( ArrayList < ColumnInfo > columns ) { columns . add ( new ColumnInfo ( "TIMESTAMP" , VoltType . BIGINT ) ) ; columns . add ( new ColumnInfo ( VoltSystemProcedure . CNAME_HOST_ID , VoltSystemProcedure . CTYPE_ID ) ) ; columns . add ( new ColumnInfo ( "HOSTNAME" , VoltType . STRING ) ... | Called from the constructor to generate the column schema at run time . Derived classes need to override this method in order to specify the columns they will be adding . The first line must always be a call the superclasses version of populateColumnSchema in order to ensure the columns are add to the list in the right... |
154,655 | public Object [ ] [ ] getStatsRows ( boolean interval , final Long now ) { this . now = now ; synchronized ( this ) { Iterator < Object > i = getStatsRowKeyIterator ( interval ) ; ArrayList < Object [ ] > rows = new ArrayList < Object [ ] > ( ) ; while ( i . hasNext ( ) ) { Object rowKey = i . next ( ) ; Object rowValu... | Get the latest stat values as an array of arrays of objects suitable for insertion into an VoltTable |
154,656 | protected void updateStatsRow ( Object rowKey , Object rowValues [ ] ) { rowValues [ 0 ] = now ; rowValues [ 1 ] = m_hostId ; rowValues [ 2 ] = m_hostname ; } | Update the parameter array with the latest values . This is similar to populateColumnSchema in that it must be overriden by derived classes and the derived class implementation must call the super classes implementation . |
154,657 | public long deserialize ( DataTree dt , Map < Long , Long > sessions ) throws IOException { List < File > snapList = findNValidSnapshots ( 100 ) ; if ( snapList . size ( ) == 0 ) { return - 1L ; } File snap = null ; boolean foundValid = false ; for ( int i = 0 ; i < snapList . size ( ) ; i ++ ) { snap = snapList . get ... | deserialize a data tree from the most recent snapshot |
154,658 | public void deserialize ( DataTree dt , Map < Long , Long > sessions , InputArchive ia ) throws IOException { FileHeader header = new FileHeader ( ) ; header . deserialize ( ia , "fileheader" ) ; if ( header . getMagic ( ) != SNAP_MAGIC ) { throw new IOException ( "mismatching magic headers " + header . getMagic ( ) + ... | deserialize the datatree from an inputarchive |
154,659 | public File findMostRecentSnapshot ( ) throws IOException { List < File > files = findNValidSnapshots ( 1 ) ; if ( files . size ( ) == 0 ) { return null ; } return files . get ( 0 ) ; } | find the most recent snapshot in the database . |
154,660 | public List < File > findNRecentSnapshots ( int n ) throws IOException { List < File > files = Util . sortDataDir ( snapDir . listFiles ( ) , "snapshot" , false ) ; int i = 0 ; List < File > list = new ArrayList < File > ( ) ; for ( File f : files ) { if ( i == n ) break ; i ++ ; list . add ( f ) ; } return list ; } | find the last n snapshots . this does not have any checks if the snapshot might be valid or not |
154,661 | protected void serialize ( DataTree dt , Map < Long , Long > sessions , OutputArchive oa , FileHeader header ) throws IOException { if ( header == null ) throw new IllegalStateException ( "Snapshot's not open for writing: uninitialized header" ) ; header . serialize ( oa , "fileheader" ) ; SerializeUtils . serializeSna... | serialize the datatree and sessions |
154,662 | public synchronized void serialize ( DataTree dt , Map < Long , Long > sessions , File snapShot ) throws IOException { if ( ! close ) { OutputStream sessOS = new BufferedOutputStream ( new FileOutputStream ( snapShot ) ) ; CheckedOutputStream crcOut = new CheckedOutputStream ( sessOS , new Adler32 ( ) ) ; OutputArchive... | serialize the datatree and session into the file snapshot |
154,663 | public static Datum sampleSystemNow ( final boolean medium , final boolean large ) { Datum d = generateCurrentSample ( ) ; if ( d == null ) return null ; historyS . addLast ( d ) ; if ( historyS . size ( ) > historySize ) historyS . removeFirst ( ) ; if ( medium ) { historyM . addLast ( d ) ; if ( historyM . size ( ) >... | Synchronously collect memory stats . |
154,664 | public static synchronized void asyncSampleSystemNow ( final boolean medium , final boolean large ) { if ( mode == GetRSSMode . PS ) { if ( thread != null ) { if ( thread . isAlive ( ) ) return ; else thread = null ; } thread = new Thread ( new Runnable ( ) { public void run ( ) { sampleSystemNow ( medium , large ) ; }... | Fire off a thread to asynchronously collect stats . |
154,665 | private static synchronized void initialize ( ) { PlatformProperties pp = PlatformProperties . getPlatformProperties ( ) ; String processName = java . lang . management . ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; String pidString = processName . substring ( 0 , processName . indexOf ( '@' ) ) ; pid = Int... | Get the process id the total memory size and determine the best way to get the RSS on an ongoing basis . |
154,666 | private static long getRSSFromProcFS ( ) { try { File statFile = new File ( String . format ( "/proc/%d/stat" , pid ) ) ; FileInputStream fis = new FileInputStream ( statFile ) ; try { BufferedReader r = new BufferedReader ( new InputStreamReader ( fis ) ) ; String stats = r . readLine ( ) ; String [ ] parts = stats . ... | Get the RSS using the procfs . If procfs is not around this will return - 1 ; |
154,667 | private static synchronized Datum generateCurrentSample ( ) { if ( testStatsProducer != null ) { return testStatsProducer . getCurrentStatsData ( ) ; } if ( ! initialized ) initialize ( ) ; long rss = - 1 ; switch ( mode ) { case MACOSX_NATIVE : rss = ExecutionEngine . nativeGetRSS ( ) ; break ; case PROCFS : rss = get... | Poll the operating system and generate a Datum |
154,668 | public static synchronized String getGoogleChartURL ( int minutes , int width , int height , String timeLabel ) { ArrayDeque < Datum > history = historyS ; if ( minutes > 2 ) history = historyM ; if ( minutes > 30 ) history = historyL ; HTMLChartHelper chart = new HTMLChartHelper ( ) ; chart . width = width ; chart . h... | Get a URL that uses the Google Charts API to show a chart of memory usage history . |
154,669 | public static void main ( String [ ] args ) { int repeat = 1000 ; long start , duration , correct ; double per ; String processName = java . lang . management . ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; String pidString = processName . substring ( 0 , processName . indexOf ( '@' ) ) ; pid = Integer . val... | Manual performance testing code for getting stats . |
154,670 | void rollbackPartial ( Session session , int start , long timestamp ) { Object [ ] list = session . rowActionList . getArray ( ) ; int limit = session . rowActionList . size ( ) ; if ( start == limit ) { return ; } for ( int i = start ; i < limit ; i ++ ) { RowAction action = ( RowAction ) list [ i ] ; if ( action != n... | rollback the row actions from start index in list and the given timestamp |
154,671 | public boolean canRead ( Session session , Row row ) { synchronized ( row ) { RowAction action = row . rowAction ; if ( action == null ) { return true ; } return action . canRead ( session ) ; } } | functional unit - accessibility of rows |
154,672 | public void setTransactionInfo ( CachedObject object ) { Row row = ( Row ) object ; if ( row . rowAction != null ) { return ; } RowAction rowact = ( RowAction ) rowActionMap . get ( row . position ) ; row . rowAction = rowact ; } | add transaction info to a row just loaded from the cache . called only for CACHED tables |
154,673 | void mergeRolledBackTransaction ( Object [ ] list , int start , int limit ) { for ( int i = start ; i < limit ; i ++ ) { RowAction rowact = ( RowAction ) list [ i ] ; if ( rowact == null || rowact . type == RowActionBase . ACTION_NONE || rowact . type == RowActionBase . ACTION_DELETE_FINAL ) { continue ; } Row row = ro... | merge a given list of transaction rollback action with given timestamp |
154,674 | void addToCommittedQueue ( Session session , Object [ ] list ) { synchronized ( committedTransactionTimestamps ) { committedTransactions . addLast ( list ) ; committedTransactionTimestamps . addLast ( session . actionTimestamp ) ; } } | add a list of actions to the end of queue |
154,675 | void mergeExpiredTransactions ( Session session ) { long timestamp = getFirstLiveTransactionTimestamp ( ) ; while ( true ) { long commitTimestamp = 0 ; Object [ ] actions = null ; synchronized ( committedTransactionTimestamps ) { if ( committedTransactionTimestamps . isEmpty ( ) ) { break ; } commitTimestamp = committe... | expire all committed transactions that are no longer in scope |
154,676 | void endTransaction ( Session session ) { try { writeLock . lock ( ) ; long timestamp = session . transactionTimestamp ; synchronized ( liveTransactionTimestamps ) { session . isTransaction = false ; int index = liveTransactionTimestamps . indexOf ( timestamp ) ; liveTransactionTimestamps . remove ( index ) ; } mergeEx... | remove session from queue when a transaction ends and expire any committed transactions that are no longer required . remove transactions ended before the first timestamp in liveTransactionsSession queue |
154,677 | RowAction [ ] getRowActionList ( ) { try { writeLock . lock ( ) ; Session [ ] sessions = database . sessionManager . getAllSessions ( ) ; int [ ] tIndex = new int [ sessions . length ] ; RowAction [ ] rowActions ; int rowActionCount = 0 ; { int actioncount = 0 ; for ( int i = 0 ; i < sessions . length ; i ++ ) { action... | Return an array of all row actions sorted by System Change No . |
154,678 | public DoubleIntIndex getTransactionIDList ( ) { writeLock . lock ( ) ; try { DoubleIntIndex lookup = new DoubleIntIndex ( 10 , false ) ; lookup . setKeysSearchTarget ( ) ; Iterator it = this . rowActionMap . keySet ( ) . iterator ( ) ; for ( ; it . hasNext ( ) ; ) { lookup . addUnique ( it . nextInt ( ) , 0 ) ; } retu... | Return a lookup of all row ids for cached tables in transactions . For auto - defrag as currently there will be no RowAction entries at the time of defrag . |
154,679 | public void convertTransactionIDs ( DoubleIntIndex lookup ) { writeLock . lock ( ) ; try { RowAction [ ] list = new RowAction [ rowActionMap . size ( ) ] ; Iterator it = this . rowActionMap . values ( ) . iterator ( ) ; for ( int i = 0 ; it . hasNext ( ) ; i ++ ) { list [ i ] = ( RowAction ) it . next ( ) ; } rowAction... | Convert row ID s for cached table rows in transactions |
154,680 | protected VoltMessage instantiate_local ( byte messageType ) { VoltMessage message = null ; switch ( messageType ) { case INITIATE_TASK_ID : message = new InitiateTaskMessage ( ) ; break ; case INITIATE_RESPONSE_ID : message = new InitiateResponseMessage ( ) ; break ; case FRAGMENT_TASK_ID : message = new FragmentTaskM... | Overridden by subclasses to create message types unknown by voltcore |
154,681 | void clearStructures ( ) { if ( schemaManager != null ) { schemaManager . clearStructures ( ) ; } granteeManager = null ; userManager = null ; nameManager = null ; schemaManager = null ; sessionManager = null ; dbInfo = null ; } | Clears the data structuress making them elligible for garbage collection . |
154,682 | public Result getScript ( boolean indexRoots ) { Result r = Result . newSingleColumnResult ( "COMMAND" , Type . SQL_VARCHAR ) ; String [ ] list = getSettingsSQL ( ) ; addRows ( r , list ) ; list = getGranteeManager ( ) . getSQL ( ) ; addRows ( r , list ) ; list = schemaManager . getSQLArray ( ) ; addRows ( r , list ) ;... | Returns the schema and authorisation statements for the database . |
154,683 | private Expression readWindowSpecification ( int tokenT , Expression aggExpr ) { SortAndSlice sortAndSlice = null ; readThis ( Tokens . OPENBRACKET ) ; List < Expression > partitionByList = new ArrayList < > ( ) ; if ( token . tokenType == Tokens . PARTITION ) { read ( ) ; readThis ( Tokens . BY ) ; while ( true ) { Ex... | This is a minimal parsing of the Window Specification . We only use partition by and order by lists . There is a lot of complexity in the full SQL specification which we don t parse at all . |
154,684 | private ExpressionLogical XStartsWithPredicateRightPart ( Expression left ) { readThis ( Tokens . WITH ) ; if ( token . tokenType == Tokens . QUESTION ) { Expression right = XreadRowValuePredicand ( ) ; if ( left . isParam ( ) && right . isParam ( ) ) { throw Error . error ( ErrorCode . X_42567 ) ; } Expression l = new... | Scan the right - side string value return a STARTS WITH Expression for generating XML |
154,685 | Expression XreadRowValueConstructor ( ) { Expression e ; e = XreadExplicitRowValueConstructorOrNull ( ) ; if ( e != null ) { return e ; } e = XreadRowOrCommonValueExpression ( ) ; if ( e != null ) { return e ; } return XreadBooleanValueExpression ( ) ; } | ISSUE - XreadCommonValueExpression and XreadBooleanValueExpression should merge |
154,686 | Expression XreadExplicitRowValueConstructorOrNull ( ) { Expression e ; switch ( token . tokenType ) { case Tokens . OPENBRACKET : { read ( ) ; int position = getPosition ( ) ; int brackets = readOpenBrackets ( ) ; switch ( token . tokenType ) { case Tokens . TABLE : case Tokens . VALUES : case Tokens . SELECT : rewind ... | must be called in conjusnction with <parenthesized .. |
154,687 | private Expression readCaseWhen ( final Expression l ) { readThis ( Tokens . WHEN ) ; Expression condition = null ; if ( l == null ) { condition = XreadBooleanValueExpression ( ) ; } else { while ( true ) { Expression newCondition = XreadPredicateRightPart ( l ) ; if ( l == newCondition ) { newCondition = new Expressio... | Reads part of a CASE .. WHEN expression |
154,688 | private Expression readCaseWhenExpression ( ) { Expression l = null ; read ( ) ; readThis ( Tokens . OPENBRACKET ) ; l = XreadBooleanValueExpression ( ) ; readThis ( Tokens . COMMA ) ; Expression thenelse = XreadRowValueExpression ( ) ; readThis ( Tokens . COMMA ) ; thenelse = new ExpressionOp ( OpTypes . ALTERNATIVE ,... | reads a CASEWHEN expression |
154,689 | private Expression readCastExpression ( ) { boolean isConvert = token . tokenType == Tokens . CONVERT ; read ( ) ; readThis ( Tokens . OPENBRACKET ) ; Expression l = this . XreadValueExpressionOrNull ( ) ; if ( isConvert ) { readThis ( Tokens . COMMA ) ; } else { readThis ( Tokens . AS ) ; } Type typeObject = readTypeD... | Reads a CAST or CONVERT expression |
154,690 | private Expression readNullIfExpression ( ) { read ( ) ; readThis ( Tokens . OPENBRACKET ) ; Expression c = XreadValueExpression ( ) ; readThis ( Tokens . COMMA ) ; Expression thenelse = new ExpressionOp ( OpTypes . ALTERNATIVE , new ExpressionValue ( ( Object ) null , ( Type ) null ) , c ) ; c = new ExpressionLogical ... | Reads a NULLIF expression |
154,691 | private Expression readCoalesceExpression ( ) { Expression c = null ; read ( ) ; readThis ( Tokens . OPENBRACKET ) ; Expression leaf = null ; while ( true ) { Expression current = XreadValueExpression ( ) ; if ( leaf != null && token . tokenType == Tokens . CLOSEBRACKET ) { readThis ( Tokens . CLOSEBRACKET ) ; leaf . s... | Reads a COALESE or IFNULL expression |
154,692 | StatementDMQL compileCursorSpecification ( ) { QueryExpression queryExpression = XreadQueryExpression ( ) ; queryExpression . setAsTopLevel ( ) ; queryExpression . resolve ( session ) ; if ( token . tokenType == Tokens . FOR ) { read ( ) ; if ( token . tokenType == Tokens . READ ) { read ( ) ; readThis ( Tokens . ONLY ... | Retrieves a SELECT or other query expression Statement from this parse context . |
154,693 | public long toLong ( ) { byte [ ] data = getBytes ( ) ; if ( data == null || data . length <= 0 || data . length > 8 ) { throw Error . error ( ErrorCode . X_42585 ) ; } byte [ ] dataWithLeadingZeros = new byte [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; int lenDiff = 8 - data . length ; for ( int j = lenDiff ; j < 8 ; ++ j... | Given a sequence of bytes that would otherwise be a VARBINARY constant return a long value with the understanding that the caller has determined that this value is in a numeric context . |
154,694 | public static void main ( String args [ ] ) { Statement stmts [ ] = null ; try { stmts = getStatements ( args [ 0 ] ) ; } catch ( Throwable e ) { System . out . println ( e . getMessage ( ) ) ; return ; } for ( Statement s : stmts ) { System . out . print ( s . statement ) ; } } | Run the parser as a stand - alone tool sending output to standard out . |
154,695 | void watchPartition ( int pid , ExecutorService es , boolean shouldBlock ) throws InterruptedException , ExecutionException { String dir = LeaderElector . electionDirForPartition ( VoltZK . leaders_initiators , pid ) ; m_callbacks . put ( pid , new PartitionCallback ( pid ) ) ; BabySitter babySitter ; if ( shouldBlock ... | Watch the partition ZK dir in the leader appointer . |
154,696 | private int getInitialPartitionCount ( ) throws IllegalAccessException { AppointerState currentState = m_state . get ( ) ; if ( currentState != AppointerState . INIT && currentState != AppointerState . CLUSTER_START ) { throw new IllegalAccessException ( "Getting cached partition count after cluster " + "startup" ) ; }... | Gets the initial cluster partition count on startup . This can only be called during initialization . Calling this after initialization throws because the partition count may not reflect the actual partition count in the cluster . |
154,697 | public void updatePartitionLeader ( int partitionId , long newMasterHISD , boolean isLeaderMigrated ) { PartitionCallback cb = m_callbacks . get ( partitionId ) ; if ( cb != null && cb . m_currentLeader != newMasterHISD ) { cb . m_previousLeader = cb . m_currentLeader ; cb . m_currentLeader = newMasterHISD ; cb . m_isL... | update the partition call back with current master and replica |
154,698 | public int compare ( String a , String b ) { int i ; if ( collator == null ) { i = a . compareTo ( b ) ; } else { i = collator . compare ( a , b ) ; } return ( i == 0 ) ? 0 : ( i < 0 ? - 1 : 1 ) ; } | returns - 1 0 or + 1 |
154,699 | int get ( int rowSize ) { if ( lookup . size ( ) == 0 ) { return - 1 ; } int index = lookup . findFirstGreaterEqualKeyIndex ( rowSize ) ; if ( index == - 1 ) { return - 1 ; } requestCount ++ ; requestSize += rowSize ; int length = lookup . getValue ( index ) ; int difference = length - rowSize ; int key = lookup . getK... | Returns the position of a free block or 0 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.