idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
155,500
public void allocateLobForResult ( ResultLob result , InputStream inputStream ) { long resultLobId = result . getLobID ( ) ; CountdownInputStream countStream ; switch ( result . getSubType ( ) ) { case ResultLob . LobResultTypes . REQUEST_CREATE_BYTES : { long blobId ; long blobLength = result . getBlockLength ( ) ; if...
allocate storage for a new LOB
415
8
155,501
@ Override public void resolveColumnIndexes ( ) { // First, assert that our topology is sane and then // recursively resolve all child/inline column indexes IndexScanPlanNode index_scan = ( IndexScanPlanNode ) getInlinePlanNode ( PlanNodeType . INDEXSCAN ) ; assert ( m_children . size ( ) == 2 && index_scan == null ) ;...
order and TVE indexes for the output SchemaColumns .
650
13
155,502
public void resolveSortDirection ( ) { AbstractPlanNode outerTable = m_children . get ( 0 ) ; if ( m_joinType == JoinType . FULL ) { // Disable the usual optimizations for ordering join output by // outer table only. In case of FULL join, the unmatched inner table tuples // get appended to the end of the join's output ...
right now only consider the sort direction on the outer table
152
11
155,503
protected long discountEstimatedProcessedTupleCount ( AbstractPlanNode childNode ) { // Discount estimated processed tuple count for the outer child based on the number of // filter expressions this child has with a rapidly diminishing effect // that ranges from a discount of 0.09 (ORETATION_EQAUL) // or 0.045 (all oth...
Discount join node child estimates based on the number of its filters
541
13
155,504
public Serializable getObject ( ) { try { return InOutUtil . deserialize ( data ) ; } catch ( Exception e ) { throw Error . error ( ErrorCode . X_22521 , e . toString ( ) ) ; } }
This method is called from classes implementing the JDBC interfaces . Inside the engine it is used for conversion from a value of type OTHER to another type . It will throw if the OTHER is an instance of a classe that is not available .
53
48
155,505
@ VisibleForTesting static char [ ] [ ] createReplacementArray ( Map < Character , String > map ) { checkNotNull ( map ) ; // GWT specific check (do not optimize) if ( map . isEmpty ( ) ) { return EMPTY_REPLACEMENT_ARRAY ; } char max = Collections . max ( map . keySet ( ) ) ; char [ ] [ ] replacements = new char [ max ...
original character value .
133
4
155,506
public int getPrecision ( int param ) throws SQLException { checkRange ( param ) ; Type type = rmd . columnTypes [ -- param ] ; if ( type . isDateTimeType ( ) ) { return type . displaySize ( ) ; } else { long size = type . precision ; if ( size > Integer . MAX_VALUE ) { size = 0 ; } return ( int ) size ; } }
Retrieves the designated parameter s specified column size .
88
11
155,507
public String getParameterTypeName ( int param ) throws SQLException { checkRange ( param ) ; return rmd . columnTypes [ -- param ] . getNameString ( ) ; }
Retrieves the designated parameter s database - specific type name .
40
13
155,508
protected static TaskLog initializeTaskLog ( String voltroot , int pid ) { // Construct task log and start logging task messages File overflowDir = new File ( voltroot , "join_overflow" ) ; return ProClass . newInstanceOf ( "org.voltdb.rejoin.TaskLogImpl" , "Join" , ProClass . HANDLER_LOG , pid , overflowDir ) ; }
Load the pro task log
85
5
155,509
protected void restoreBlock ( RestoreWork rejoinWork , SiteProcedureConnection siteConnection ) { kickWatchdog ( true ) ; rejoinWork . restore ( siteConnection ) ; }
Received a datablock . Reset the watchdog timer and hand the block to the Site .
38
19
155,510
protected void returnToTaskQueue ( boolean sourcesReady ) { if ( sourcesReady ) { // If we've done something meaningful, go ahead and return ourselves to the queue immediately m_taskQueue . offer ( this ) ; } else { // Otherwise, avoid spinning too aggressively, so wait a millisecond before requeueing VoltDB . instance...
or after waiting a few milliseconds
102
6
155,511
static void putLong ( ByteBuffer buffer , long value ) { value = ( value << 1 ) ^ ( value >> 63 ) ; if ( value >>> 7 == 0 ) { buffer . put ( ( byte ) value ) ; } else { buffer . put ( ( byte ) ( ( value & 0x7F ) | 0x80 ) ) ; if ( value >>> 14 == 0 ) { buffer . put ( ( byte ) ( value >>> 7 ) ) ; } else { buffer . put ( ...
Writes a long value to the given buffer in LEB128 ZigZag encoded format
403
18
155,512
static void putInt ( ByteBuffer buffer , int value ) { value = ( value << 1 ) ^ ( value >> 31 ) ; if ( value >>> 7 == 0 ) { buffer . put ( ( byte ) value ) ; } else { buffer . put ( ( byte ) ( ( value & 0x7F ) | 0x80 ) ) ; if ( value >>> 14 == 0 ) { buffer . put ( ( byte ) ( value >>> 7 ) ) ; } else { buffer . put ( ( ...
Writes an int value to the given buffer in LEB128 - 64b9B ZigZag encoded format
223
23
155,513
static long getLong ( ByteBuffer buffer ) { long v = buffer . get ( ) ; long value = v & 0x7F ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 7 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 14 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & ...
Read an LEB128 - 64b9B ZigZag encoded long value from the given buffer
331
20
155,514
static int getInt ( ByteBuffer buffer ) { int v = buffer . get ( ) ; int value = v & 0x7F ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 7 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 14 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F...
Read an LEB128 - 64b9B ZigZag encoded int value from the given buffer
194
20
155,515
static public void main ( String [ ] sa ) throws IOException , TarMalformatException { if ( sa . length < 1 ) { System . out . println ( RB . singleton . getString ( RB . TARREADER_SYNTAX , TarReader . class . getName ( ) ) ) ; System . out . println ( RB . singleton . getString ( RB . LISTING_FORMAT ) ) ; System . exi...
Reads a specified tar file or stdin in order to either list or extract the file tar entries depending on the first argument being t or x using default read buffer blocks .
446
35
155,516
public static Date getDateFromUniqueId ( long uniqueId ) { long time = uniqueId >> ( COUNTER_BITS + PARTITIONID_BITS ) ; time += VOLT_EPOCH ; return new Date ( time ) ; }
Given a unique id return the time of its creation by examining the embedded timestamp .
52
16
155,517
public static Object createObject ( String classname ) throws ParseException { Class < ? > cl ; try { cl = Class . forName ( classname ) ; } catch ( ClassNotFoundException cnfe ) { throw new ParseException ( "Unable to find the class: " + classname ) ; } try { return cl . newInstance ( ) ; } catch ( Exception e ) { thr...
Create an Object from the classname and empty constructor .
119
11
155,518
public static Number createNumber ( String str ) throws ParseException { try { if ( str . indexOf ( ' ' ) != - 1 ) { return Double . valueOf ( str ) ; } return Long . valueOf ( str ) ; } catch ( NumberFormatException e ) { throw new ParseException ( e . getMessage ( ) ) ; } }
Create a number from a String . If a . is present it creates a Double otherwise a Long .
75
20
155,519
private boolean fixupACL ( List < Id > authInfo , List < ACL > acl ) { if ( skipACL ) { return true ; } if ( acl == null || acl . size ( ) == 0 ) { return false ; } Iterator < ACL > it = acl . iterator ( ) ; LinkedList < ACL > toAdd = null ; while ( it . hasNext ( ) ) { ACL a = it . next ( ) ; Id id = a . getId ( ) ; i...
This method checks out the acl making sure it isn t null or empty it has valid schemes and ids and expanding any relative ids that depend on the requestor s authentication information .
432
38
155,520
public boolean authenticate ( ClientAuthScheme scheme , String fromAddress ) { if ( m_done ) throw new IllegalStateException ( "this authentication request has a result" ) ; boolean authenticated = false ; try { authenticated = authenticateImpl ( scheme , fromAddress ) ; } catch ( Exception ex ) { m_authenticationFailu...
Perform the authentication request
86
5
155,521
public long run ( String symbol , TimestampType time , long seq_number , String exchange , int bidPrice , int bidSize , int askPrice , int askSize ) throws VoltAbortException { // convert bid and ask 0 values to null Integer bidPriceSafe = askPrice > 0 ? askPrice : null ; Integer askPriceSafe = askPrice > 0 ? askPrice ...
main method the procedure starts here .
429
7
155,522
public static < K extends Comparable < ? > , V > Builder < K , V > builder ( ) { return new Builder < K , V > ( ) ; }
Returns a new builder for an immutable range map .
35
10
155,523
void setLeaderState ( boolean isLeader ) { m_isLeader = isLeader ; // The leader doesn't truncate its own SP log; if promoted, // wipe out the SP portion of the existing log. This promotion // action always happens after repair is completed. if ( m_isLeader ) { if ( ! m_logSP . isEmpty ( ) ) { truncate ( m_logSP . getL...
leaders log differently
103
3
155,524
private void truncate ( long handle , boolean isSP ) { // MIN value means no work to do, is a startup condition if ( handle == Long . MIN_VALUE ) { return ; } Deque < RepairLog . Item > deq = null ; if ( isSP ) { deq = m_logSP ; if ( m_truncationHandle < handle ) { m_truncationHandle = handle ; notifyTxnCommitInterests...
trim unnecessary log messages .
164
6
155,525
public List < Iv2RepairLogResponseMessage > contents ( long requestId , boolean forMPI ) { List < Item > items = new LinkedList < Item > ( ) ; // All cases include the log of MP transactions items . addAll ( m_logMP ) ; // SP repair requests also want the SP transactions if ( ! forMPI ) { items . addAll ( m_logSP ) ; }...
produce the contents of the repair log .
382
9
155,526
public final synchronized void endFragment ( String stmtName , boolean isCoordinatorTask , boolean failed , boolean sampledStmt , long duration , int resultSize , int parameterSetSize ) { if ( stmtName == null ) { return ; } StatementStats stmtStats = m_stmtStatsMap . get ( stmtName ) ; if ( stmtStats == null ) { retur...
This function will be called after a statement finish running . It updates the data structures to maintain the statistics .
761
21
155,527
public synchronized Session newSession ( Database db , User user , boolean readonly , boolean forLog , int timeZoneSeconds ) { Session s = new Session ( db , user , ! forLog , ! forLog , readonly , sessionIdCount , timeZoneSeconds ) ; s . isProcessingLog = forLog ; sessionMap . put ( sessionIdCount , s ) ; sessionIdCou...
Binds the specified Session object into this SessionManager s active Session registry . This method is typically called internally as the final step when a successful connection has been made .
89
33
155,528
public Session getSysSessionForScript ( Database db ) { Session session = new Session ( db , db . getUserManager ( ) . getSysUser ( ) , false , false , false , 0 , 0 ) ; session . isProcessingScript = true ; return session ; }
Retrieves a new SYS Session .
58
9
155,529
public synchronized void closeAllSessions ( ) { // don't disconnect system user; need it to save database Session [ ] sessions = getAllSessions ( ) ; for ( int i = 0 ; i < sessions . length ; i ++ ) { sessions [ i ] . close ( ) ; } }
Closes all Sessions registered with this SessionManager .
62
10
155,530
public HostAndPort withDefaultPort ( int defaultPort ) { checkArgument ( isValidPort ( defaultPort ) ) ; if ( hasPort ( ) || port == defaultPort ) { return this ; } return new HostAndPort ( host , defaultPort , hasBracketlessColons ) ; }
Provide a default port if the parsed string contained only a host .
63
14
155,531
public Runnable writeCatalogJarToFile ( String path , String name , CatalogJarWriteMode mode ) throws IOException { File catalogFile = new VoltFile ( path , name ) ; File catalogTmpFile = new VoltFile ( path , name + ".tmp" ) ; if ( mode == CatalogJarWriteMode . CATALOG_UPDATE ) { // This means a @UpdateCore case, the ...
Write replace or update the catalog jar based on different cases . This function assumes any IOException should lead to fatal crash .
326
24
155,532
public Class < ? > classForProcedureOrUDF ( String procedureClassName ) throws LinkageError , ExceptionInInitializerError , ClassNotFoundException { return classForProcedureOrUDF ( procedureClassName , m_catalogInfo . m_jarfile . getLoader ( ) ) ; }
Given a class name in the catalog jar loads it from the jar even if the jar is served from an URL and isn t in the classpath .
67
30
155,533
public DeploymentType getDeployment ( ) { if ( m_memoizedDeployment == null ) { m_memoizedDeployment = CatalogUtil . getDeployment ( new ByteArrayInputStream ( m_catalogInfo . m_deploymentBytes ) ) ; // This should NEVER happen if ( m_memoizedDeployment == null ) { VoltDB . crashLocalVoltDB ( "The internal deployment b...
Get the JAXB XML Deployment object which is memoized
124
13
155,534
public boolean removeAfter ( Node node ) { if ( node == null || node . next == null ) { return false ; } if ( node . next == last ) { last = node ; } node . next = node . next . next ; return true ; }
Removes the given node to allow removel from iterators
54
13
155,535
protected ProcedurePartitionData parseCreateProcedureClauses ( ProcedureDescriptor descriptor , String clauses ) throws VoltCompilerException { // Nothing to do if there were no clauses. // Null means there's no partition data to return. // There's also no roles to add. if ( clauses == null || clauses . isEmpty ( ) ) {...
Parse and validate the substring containing ALLOW and PARTITION clauses for CREATE PROCEDURE .
376
21
155,536
public static void interactWithTheUser ( ) throws Exception { final SQLConsoleReader interactiveReader = new SQLConsoleReader ( new FileInputStream ( FileDescriptor . in ) , System . out ) ; interactiveReader . setBellEnabled ( false ) ; FileHistory historyFile = null ; try { // Maintain persistent history in ~/.sqlcmd...
The main loop for interactive mode .
395
7
155,537
static void executeScriptFiles ( List < FileInfo > filesInfo , SQLCommandLineReader parentLineReader , DDLParserCallback callback ) throws IOException { LineReaderAdapter adapter = null ; SQLCommandLineReader reader = null ; StringBuilder statements = new StringBuilder ( ) ; if ( ! m_interactive && callback == null ) {...
Reads a script file and executes its content . Note that the script file could be an inline batch i . e . a here document that is coming from the same input stream as the file directive .
714
40
155,538
private static void printUsage ( String msg ) { System . out . print ( msg ) ; System . out . println ( "\n" ) ; m_exitCode = - 1 ; printUsage ( ) ; }
General application support
44
3
155,539
static void printHelp ( OutputStream prtStr ) { try { InputStream is = SQLCommand . class . getResourceAsStream ( m_readme ) ; while ( is . available ( ) > 0 ) { byte [ ] bytes = new byte [ is . available ( ) ] ; // Fix for ENG-3440 is . read ( bytes , 0 , bytes . length ) ; prtStr . write ( bytes ) ; // For JUnit test...
Default visibility is for test purposes .
130
7
155,540
public static void main ( String args [ ] ) { System . setProperty ( "voltdb_no_logging" , "true" ) ; int exitCode = mainWithReturnCode ( args ) ; System . exit ( exitCode ) ; }
Application entry point
52
3
155,541
private synchronized void checkTimeout ( final long timeoutMs ) { final Entry < Integer , SendWork > oldest = m_outstandingWork . firstEntry ( ) ; if ( oldest != null ) { final long now = System . currentTimeMillis ( ) ; SendWork work = oldest . getValue ( ) ; if ( ( now - work . m_ts ) > timeoutMs ) { StreamSnapshotTi...
Called by the watchdog from the periodic work thread to check if the oldest unacked block is older than the timeout interval .
174
25
155,542
synchronized void clearOutstanding ( ) { if ( m_outstandingWork . isEmpty ( ) && ( m_outstandingWorkCount . get ( ) == 0 ) ) { return ; } rejoinLog . trace ( "Clearing outstanding work." ) ; for ( Entry < Integer , SendWork > e : m_outstandingWork . entrySet ( ) ) { e . getValue ( ) . discard ( ) ; } m_outstandingWork ...
Idempotent synchronized method to perform all cleanup of outstanding work so buffers aren t leaked .
114
19
155,543
@ Override public synchronized void receiveAck ( int blockIndex ) { SendWork work = m_outstandingWork . get ( blockIndex ) ; // releases the BBContainers and cleans up if ( work == null || work . m_ackCounter == null ) { rejoinLog . warn ( "Received invalid blockIndex ack for targetId " + m_targetId + " for index " + S...
Synchronized method to handle the arrival of an Ack .
249
12
155,544
synchronized ListenableFuture < Boolean > send ( StreamSnapshotMessageType type , int blockIndex , BBContainer chunk , boolean replicatedTable ) { SettableFuture < Boolean > sendFuture = SettableFuture . create ( ) ; rejoinLog . trace ( "Sending block " + blockIndex + " of type " + ( replicatedTable ? "REPLICATED " : "...
Send data to the rejoining node tracking what was sent for ack tracking . Synchronized to protect access to m_outstandingWork and to keep m_outstandingWorkCount in sync with m_outstandingWork .
242
46
155,545
public static String toSchemaWithoutInlineBatches ( String schema ) { StringBuilder sb = new StringBuilder ( schema ) ; int i = sb . indexOf ( batchSpecificComments ) ; if ( i != - 1 ) { sb . delete ( i , i + batchSpecificComments . length ( ) ) ; } i = sb . indexOf ( startBatch ) ; if ( i != - 1 ) { sb . delete ( i , ...
Given a schema strips out inline batch statements and associated comments .
159
12
155,546
final void shutdown ( ) throws InterruptedException { // stop the old proc call reaper m_timeoutReaperHandle . cancel ( false ) ; m_ex . shutdown ( ) ; if ( CoreUtils . isJunitTest ( ) ) { m_ex . awaitTermination ( 1 , TimeUnit . SECONDS ) ; } else { m_ex . awaitTermination ( 365 , TimeUnit . DAYS ) ; } m_network . shu...
Shutdown the VoltNetwork allowing the Ports to close and free resources like memory pools
130
16
155,547
public long getPartitionForParameter ( byte typeValue , Object value ) { if ( m_hashinator == null ) { return - 1 ; } return m_hashinator . getHashedPartitionForParameter ( typeValue , value ) ; }
This is used by clients such as CSVLoader which puts processing into buckets .
52
15
155,548
private void refreshPartitionKeys ( boolean topologyUpdate ) { long interval = System . currentTimeMillis ( ) - m_lastPartitionKeyFetched . get ( ) ; if ( ! m_useClientAffinity && interval < PARTITION_KEYS_INFO_REFRESH_FREQUENCY ) { return ; } try { ProcedureInvocation invocation = new ProcedureInvocation ( m_sysHandle...
Set up partitions .
343
4
155,549
public void addSortExpressions ( List < AbstractExpression > sortExprs , List < SortDirectionType > sortDirs ) { assert ( sortExprs . size ( ) == sortDirs . size ( ) ) ; for ( int i = 0 ; i < sortExprs . size ( ) ; ++ i ) { addSortExpression ( sortExprs . get ( i ) , sortDirs . get ( i ) ) ; } }
Add multiple sort expressions to the order - by
99
9
155,550
public void addSortExpression ( AbstractExpression sortExpr , SortDirectionType sortDir ) { assert ( sortExpr != null ) ; // PlanNodes all need private deep copies of expressions // so that the resolveColumnIndexes results // don't get bashed by other nodes or subsequent planner runs m_sortExpressions . add ( sortExpr ...
Add a sort expression to the order - by
94
9
155,551
static java . util . logging . Level getPriorityForLevel ( Level level ) { switch ( level ) { case DEBUG : return java . util . logging . Level . FINEST ; case ERROR : return java . util . logging . Level . SEVERE ; case FATAL : return java . util . logging . Level . SEVERE ; case INFO : return java . util . logging . ...
Convert the VoltLogger Level to the java . ulil . logging Level
122
16
155,552
void checkAddColumn ( ColumnSchema col ) { if ( table . isText ( ) && ! table . isEmpty ( session ) ) { throw Error . error ( ErrorCode . X_S0521 ) ; } if ( table . findColumn ( col . getName ( ) . name ) != - 1 ) { throw Error . error ( ErrorCode . X_42504 ) ; } if ( col . isPrimaryKey ( ) && table . hasPrimaryKey ( )...
Checks if the attributes of the Column argument c are compatible with the operation of adding such a Column to the Table argument table .
215
26
155,553
void makeNewTable ( OrderedHashSet dropConstraintSet , OrderedHashSet dropIndexSet ) { Table tn = table . moveDefinition ( session , table . tableType , null , null , null , - 1 , 0 , dropConstraintSet , dropIndexSet ) ; if ( tn . indexList . length == table . indexList . length ) { database . persistentStoreCollection...
Drops constriants and their indexes in table . Uses set of names .
130
16
155,554
Index addIndex ( int [ ] col , HsqlName name , boolean unique , boolean migrating ) { Index newindex ; if ( table . isEmpty ( session ) || table . isIndexingMutable ( ) ) { PersistentStore store = session . sessionData . getRowStore ( table ) ; newindex = table . createIndex ( store , name , col , null , null , unique ...
Because of the way indexes and column data are held in memory and on disk it is necessary to recreate the table when an index is added to a non - empty cached table .
251
35
155,555
void dropIndex ( String indexName ) { Index index ; index = table . getIndex ( indexName ) ; if ( table . isIndexingMutable ( ) ) { table . dropIndex ( session , indexName ) ; } else { OrderedHashSet indexSet = new OrderedHashSet ( ) ; indexSet . add ( table . getIndex ( indexName ) . getName ( ) ) ; Table tn = table ....
Because of the way indexes and column data are held in memory and on disk it is necessary to recreate the table when an index is added to or removed from a non - empty table .
224
37
155,556
void retypeColumn ( ColumnSchema oldCol , ColumnSchema newCol ) { boolean allowed = true ; int oldType = oldCol . getDataType ( ) . typeCode ; int newType = newCol . getDataType ( ) . typeCode ; if ( ! table . isEmpty ( session ) && oldType != newType ) { allowed = newCol . getDataType ( ) . canConvertFrom ( oldCol . g...
Allows changing the type or addition of an IDENTITY sequence .
754
13
155,557
void setColNullability ( ColumnSchema column , boolean nullable ) { Constraint c = null ; int colIndex = table . getColumnIndex ( column . getName ( ) . name ) ; if ( column . isNullable ( ) == nullable ) { return ; } if ( nullable ) { if ( column . isPrimaryKey ( ) ) { throw Error . error ( ErrorCode . X_42526 ) ; } t...
performs the work for changing the nullability of a column
269
12
155,558
void setColDefaultExpression ( int colIndex , Expression def ) { if ( def == null ) { table . checkColumnInFKConstraint ( colIndex , Constraint . SET_DEFAULT ) ; } table . setDefaultExpression ( colIndex , def ) ; }
performs the work for changing the default value of a column
60
12
155,559
public boolean setTableType ( Session session , int newType ) { int currentType = table . getTableType ( ) ; if ( currentType == newType ) { return false ; } switch ( newType ) { case TableBase . CACHED_TABLE : break ; case TableBase . MEMORY_TABLE : break ; default : return false ; } Table tn ; try { tn = table . move...
Changes the type of a table
199
6
155,560
Index addExprIndex ( int [ ] col , Expression [ ] indexExprs , HsqlName name , boolean unique , boolean migrating , Expression predicate ) { Index newindex ; if ( table . isEmpty ( session ) || table . isIndexingMutable ( ) ) { newindex = table . createAndAddExprIndexStructure ( name , col , indexExprs , unique , migra...
A VoltDB extended variant of addIndex that supports indexed generalized non - column expressions .
281
17
155,561
Index addIndex ( int [ ] col , HsqlName name , boolean unique , boolean migrating , Expression predicate ) { return addIndex ( col , name , unique , migrating ) . withPredicate ( predicate ) ; }
A VoltDB extended variant of addIndex that supports partial index predicate .
45
14
155,562
static public ParsedColInfo fromOrderByXml ( AbstractParsedStmt parsedStmt , VoltXMLElement orderByXml ) { // A generic adjuster that just calls finalizeValueTypes ExpressionAdjuster adjuster = new ExpressionAdjuster ( ) { @ Override public AbstractExpression adjust ( AbstractExpression expr ) { ExpressionUtil . finali...
Construct a ParsedColInfo from Volt XML .
111
10
155,563
static public ParsedColInfo fromOrderByXml ( AbstractParsedStmt parsedStmt , VoltXMLElement orderByXml , ExpressionAdjuster adjuster ) { // make sure everything is kosher assert ( orderByXml . name . equalsIgnoreCase ( "orderby" ) ) ; // get desc/asc String desc = orderByXml . attributes . get ( "desc" ) ; boolean desc...
Construct a ParsedColInfo from Volt XML . Allow caller to specify actions to finalize the parsed expression .
669
22
155,564
public SchemaColumn asSchemaColumn ( ) { String columnAlias = ( m_alias == null ) ? m_columnName : m_alias ; return new SchemaColumn ( m_tableName , m_tableAlias , m_columnName , columnAlias , m_expression , m_differentiator ) ; }
Return this as an instance of SchemaColumn
67
9
155,565
public static void crashVoltDB ( String reason , String traces [ ] , String filename , int lineno ) { VoltLogger hostLog = new VoltLogger ( "HOST" ) ; String fn = ( filename == null ) ? "unknown" : filename ; String re = ( reason == null ) ? "Fatal EE error." : reason ; hostLog . fatal ( re + " In " + fn + ":" + lineno...
Call VoltDB . crashVoltDB on behalf of the EE
148
13
155,566
public byte [ ] nextDependencyAsBytes ( final int dependencyId ) { final VoltTable vt = m_dependencyTracker . nextDependency ( dependencyId ) ; if ( vt != null ) { final ByteBuffer buf2 = PrivateVoltTableFactory . getTableDataReference ( vt ) ; int pos = buf2 . position ( ) ; byte [ ] bytes = new byte [ buf2 . limit ( ...
Called from the ExecutionEngine to request serialized dependencies .
122
12
155,567
public void loadCatalog ( long timestamp , String serializedCatalog ) { try { setupProcedure ( null ) ; m_fragmentContext = FragmentContext . CATALOG_LOAD ; coreLoadCatalog ( timestamp , getStringBytes ( serializedCatalog ) ) ; } finally { m_fragmentContext = FragmentContext . UNKNOWN ; } }
Pass the catalog to the engine
76
6
155,568
public final void updateCatalog ( final long timestamp , final boolean isStreamUpdate , final String diffCommands ) throws EEException { try { setupProcedure ( null ) ; m_fragmentContext = FragmentContext . CATALOG_UPDATE ; coreUpdateCatalog ( timestamp , isStreamUpdate , diffCommands ) ; } finally { m_fragmentContext ...
Pass diffs to apply to the EE s catalog to update it
87
13
155,569
public FastDeserializer executePlanFragments ( int numFragmentIds , long [ ] planFragmentIds , long [ ] inputDepIds , Object [ ] parameterSets , DeterminismHash determinismHash , String [ ] sqlTexts , boolean [ ] isWriteFrags , int [ ] sqlCRCs , long txnId , long spHandle , long lastCommittedSpHandle , long uniqueId , ...
Run multiple plan fragments
575
4
155,570
public synchronized void setFlushInterval ( long delay , long seconds ) { if ( m_flush != null ) { m_flush . cancel ( false ) ; m_flush = null ; } if ( seconds > 0 ) { m_flush = m_ses . scheduleAtFixedRate ( new Runnable ( ) { @ Override public void run ( ) { try { flush ( ) ; } catch ( Exception e ) { loaderLog . erro...
Set periodic flush interval and initial delay in seconds .
133
10
155,571
@ Override public synchronized void close ( ) { if ( isClosed ) { return ; } rollback ( false ) ; try { database . logger . writeToLog ( this , Tokens . T_DISCONNECT ) ; } catch ( HsqlException e ) { } sessionData . closeAllNavigators ( ) ; sessionData . persistentStoreCollection . clearAllTables ( ) ; sessionData . cl...
Closes this Session .
167
5
155,572
public void setIsolation ( int level ) { if ( isInMidTransaction ( ) ) { throw Error . error ( ErrorCode . X_25001 ) ; } if ( level == SessionInterface . TX_READ_UNCOMMITTED ) { isReadOnly = true ; } isolationMode = level ; if ( isolationMode != isolationModeDefault ) { database . logger . writeToLog ( this , getTransa...
sets ISOLATION for the next transaction only
96
9
155,573
void checkDDLWrite ( ) { checkReadWrite ( ) ; if ( isProcessingScript || isProcessingLog ) { return ; } if ( database . isFilesReadOnly ( ) ) { throw Error . error ( ErrorCode . DATABASE_IS_READONLY ) ; } }
This is used for creating new database objects such as tables .
64
12
155,574
void addDeleteAction ( Table table , Row row ) { // tempActionHistory.add("add delete action " + actionTimestamp); if ( abortTransaction ) { // throw Error.error(ErrorCode.X_40001); } database . txManager . addDeleteAction ( this , table , row ) ; }
Adds a delete action to the row and the transaction manager .
66
12
155,575
@ Override public synchronized void setAutoCommit ( boolean autocommit ) { if ( isClosed ) { return ; } if ( autocommit != isAutoCommit ) { commit ( false ) ; isAutoCommit = autocommit ; } }
Setter for the autocommit attribute .
58
10
155,576
@ Override public synchronized void commit ( boolean chain ) { // tempActionHistory.add("commit " + actionTimestamp); if ( isClosed ) { return ; } if ( ! isTransaction ) { isReadOnly = isReadOnlyDefault ; isolationMode = isolationModeDefault ; return ; } if ( ! database . txManager . commitTransaction ( this ) ) { // t...
Commits any uncommited transaction this Session may have open
121
12
155,577
@ Override public synchronized void rollback ( boolean chain ) { // tempActionHistory.add("rollback " + actionTimestamp); if ( isClosed ) { return ; } if ( ! isTransaction ) { isReadOnly = isReadOnlyDefault ; isolationMode = isolationModeDefault ; return ; } try { database . logger . writeToLog ( this , Tokens . T_ROLL...
Rolls back any uncommited transaction this Session may have open .
113
14
155,578
@ Override public synchronized void savepoint ( String name ) { int index = sessionContext . savepoints . getIndex ( name ) ; if ( index != - 1 ) { sessionContext . savepoints . remove ( name ) ; sessionContext . savepointTimestamps . remove ( index ) ; } sessionContext . savepoints . add ( name , ValuePool . getInt ( ...
Registers a transaction SAVEPOINT . A new SAVEPOINT with the name of an existing one replaces the old SAVEPOINT .
137
30
155,579
@ Override public synchronized void rollbackToSavepoint ( String name ) { if ( isClosed ) { return ; } int index = sessionContext . savepoints . getIndex ( name ) ; if ( index < 0 ) { throw Error . error ( ErrorCode . X_3B001 , name ) ; } database . txManager . rollbackSavepoint ( this , index ) ; try { database . logg...
Performs a partial transaction ROLLBACK to savepoint .
115
12
155,580
public synchronized void rollbackToSavepoint ( ) { if ( isClosed ) { return ; } String name = ( String ) sessionContext . savepoints . getKey ( 0 ) ; database . txManager . rollbackSavepoint ( this , 0 ) ; try { database . logger . writeToLog ( this , getSavepointRollbackSQL ( name ) ) ; } catch ( HsqlException e ) { }...
Performs a partial transaction ROLLBACK of current savepoint level .
88
14
155,581
@ Override public synchronized void releaseSavepoint ( String name ) { // remove this and all later savepoints int index = sessionContext . savepoints . getIndex ( name ) ; if ( index < 0 ) { throw Error . error ( ErrorCode . X_3B001 , name ) ; } while ( sessionContext . savepoints . size ( ) > index ) { sessionContext...
Releases a savepoint
114
5
155,582
public void setReadOnly ( boolean readonly ) { if ( ! readonly && database . databaseReadOnly ) { throw Error . error ( ErrorCode . DATABASE_IS_READONLY ) ; } if ( isInMidTransaction ( ) ) { throw Error . error ( ErrorCode . X_25001 ) ; } isReadOnly = readonly ; }
sets READ ONLY for next transaction only
78
7
155,583
private Result executeResultUpdate ( Result cmd ) { long id = cmd . getResultId ( ) ; int actionType = cmd . getActionType ( ) ; Result result = sessionData . getDataResult ( id ) ; if ( result == null ) { return Result . newErrorResult ( Error . error ( ErrorCode . X_24501 ) ) ; } Object [ ] pvals = cmd . getParameter...
Retrieves the result of inserting updating or deleting a row from an updatable result .
209
18
155,584
HsqlName getSchemaHsqlName ( String name ) { return name == null ? currentSchema : database . schemaManager . getSchemaHsqlName ( name ) ; }
If schemaName is null return the current schema name else return the HsqlName object for the schema . If schemaName does not exist throw .
39
29
155,585
public String getSchemaName ( String name ) { return name == null ? currentSchema . name : database . schemaManager . getSchemaName ( name ) ; }
Same as above but return string
36
6
155,586
public Table defineLocalTable ( HsqlName tableName , HsqlName [ ] colNames , Type [ ] colTypes ) { // I'm not sure the table type, here TableBase.CACHED_TABLE, matters // all that much. assert ( localTables != null ) ; Table newTable = TableUtil . newTable ( database , TableBase . CACHED_TABLE , tableName ) ; TableUtil...
Define a local table with the given name column names and column types .
143
15
155,587
public void updateLocalTable ( HsqlName queryName , Type [ ] finalTypes ) { assert ( localTables != null ) ; Table tbl = getLocalTable ( queryName . name ) ; assert ( tbl != null ) ; TableUtil . updateColumnTypes ( tbl , finalTypes ) ; }
Update the local table with new types . This is very dubious .
66
13
155,588
void logSequences ( ) { OrderedHashSet set = sessionData . sequenceUpdateSet ; if ( set == null || set . isEmpty ( ) ) { return ; } for ( int i = 0 , size = set . size ( ) ; i < size ; i ++ ) { NumberSequence sequence = ( NumberSequence ) set . get ( i ) ; database . logger . writeSequenceStatement ( this , sequence ) ...
SEQUENCE current values
104
5
155,589
public void addLiteralSchema ( String ddlText ) throws IOException { File temp = File . createTempFile ( "literalschema" , "sql" ) ; temp . deleteOnExit ( ) ; FileWriter out = new FileWriter ( temp ) ; out . write ( ddlText ) ; out . close ( ) ; addSchema ( URLEncoder . encode ( temp . getAbsolutePath ( ) , "UTF-8" ) )...
This is test code written by Ryan even though it was committed by John .
102
15
155,590
public void addSchema ( String schemaURL ) { try { schemaURL = URLDecoder . decode ( schemaURL , "UTF-8" ) ; } catch ( final UnsupportedEncodingException e ) { e . printStackTrace ( ) ; System . exit ( - 1 ) ; } assert ( m_schemas . contains ( schemaURL ) == false ) ; final File schemaFile = new File ( schemaURL ) ; as...
Add a schema based on a URL .
165
8
155,591
private static boolean isParameterized ( VoltXMLElement elm ) { final String name = elm . name ; if ( name . equals ( "value" ) ) { return elm . getBoolAttribute ( "isparam" , false ) ; } else if ( name . equals ( "vector" ) || name . equals ( "row" ) ) { return elm . children . stream ( ) . anyMatch ( ExpressionUtil :...
Helper to check if a VoltXMLElement contains parameter .
426
12
155,592
private static String getType ( Database db , VoltXMLElement elm ) { final String type = elm . getStringAttribute ( "valuetype" , "" ) ; if ( ! type . isEmpty ( ) ) { return type ; } else if ( elm . name . equals ( "columnref" ) ) { final String tblName = elm . getStringAttribute ( "table" , "" ) ; final int colIndex =...
Get the underlying type of the VoltXMLElement node . Need reference to the catalog for PVE
255
20
155,593
private static String guessParameterType ( Database db , VoltXMLElement elm ) { if ( ! isParameterized ( elm ) || ! elm . name . equals ( "operation" ) ) { return "" ; } else { final ExpressionType op = mapOfVoltXMLOpType . get ( elm . attributes . get ( "optype" ) ) ; assert op != null ; switch ( op ) { case CONJUNCTI...
Guess from a parent node what are the parameter type of its child node should one of its child node contain parameter .
350
24
155,594
public static boolean reduce ( AbstractExpression expr , Predicate < AbstractExpression > pred ) { final boolean current = pred . test ( expr ) ; if ( current ) { return true ; } else if ( expr == null ) { return pred . test ( null ) ; } else { return pred . test ( expr . getLeft ( ) ) || pred . test ( expr . getRight ...
Check if any node of given expression tree satisfies given predicate
112
11
155,595
public static Collection < AbstractExpression > uncombineAny ( AbstractExpression expr ) { ArrayDeque < AbstractExpression > out = new ArrayDeque < AbstractExpression > ( ) ; if ( expr != null ) { ArrayDeque < AbstractExpression > in = new ArrayDeque < AbstractExpression > ( ) ; // this chunk of code breaks the code in...
Convert one or more predicates potentially in an arbitrarily nested conjunction tree into a flattened collection . Similar to uncombine but for arbitrary tree shapes and with no guarantee of the result collection type or of any ordering within the collection . In fact it currently fills an ArrayDeque via a left = to - ...
202
79
155,596
public static List < TupleValueExpression > getTupleValueExpressions ( AbstractExpression input ) { ArrayList < TupleValueExpression > tves = new ArrayList < TupleValueExpression > ( ) ; // recursive stopping steps if ( input == null ) { return tves ; } else if ( input instanceof TupleValueExpression ) { tves . add ( (...
Recursively walk an expression and return a list of all the tuple value expressions it contains .
191
19
155,597
private static boolean subqueryRequiresScalarValueExpressionFromContext ( AbstractExpression parentExpr ) { if ( parentExpr == null ) { // No context: we are a top-level expression. E.g, an item on the // select list. In this case, assume the expression must be scalar. return true ; } // Exists and comparison operators...
Return true if we must insert a ScalarValueExpression between a subquery and its parent expression .
178
21
155,598
private static AbstractExpression addScalarValueExpression ( SelectSubqueryExpression expr ) { if ( expr . getSubqueryScan ( ) . getOutputSchema ( ) . size ( ) != 1 ) { throw new PlanningErrorException ( "Scalar subquery can have only one output column" ) ; } expr . changeToScalarExprType ( ) ; AbstractExpression scala...
Add a ScalarValueExpression on top of the SubqueryExpression
152
15
155,599
public ClientResponseImpl shouldAccept ( String name , AuthSystem . AuthUser user , final StoredProcedureInvocation task , final Procedure catProc ) { if ( user . isAuthEnabled ( ) ) { InvocationPermissionPolicy deniedPolicy = null ; InvocationPermissionPolicy . PolicyResult res = InvocationPermissionPolicy . PolicyRes...
For auth disabled user the first policy will return ALLOW breaking the loop .
253
15