idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
155,900 | 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 |
155,901 | public static Collection < AbstractExpression > uncombineAny ( AbstractExpression expr ) { ArrayDeque < AbstractExpression > out = new ArrayDeque < AbstractExpression > ( ) ; if ( expr != null ) { ArrayDeque < AbstractExpression > in = new ArrayDeque < AbstractExpression > ( ) ; in . add ( expr ) ; AbstractExpression i... | 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 - ... |
155,902 | public static List < TupleValueExpression > getTupleValueExpressions ( AbstractExpression input ) { ArrayList < TupleValueExpression > tves = new ArrayList < TupleValueExpression > ( ) ; if ( input == null ) { return tves ; } else if ( input instanceof TupleValueExpression ) { tves . add ( ( TupleValueExpression ) inpu... | Recursively walk an expression and return a list of all the tuple value expressions it contains . |
155,903 | private static boolean subqueryRequiresScalarValueExpressionFromContext ( AbstractExpression parentExpr ) { if ( parentExpr == null ) { return true ; } if ( parentExpr . getExpressionType ( ) == ExpressionType . OPERATOR_EXISTS || parentExpr instanceof ComparisonExpression ) { return false ; } if ( parentExpr instanceo... | Return true if we must insert a ScalarValueExpression between a subquery and its parent expression . |
155,904 | 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 |
155,905 | 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 . |
155,906 | @ SuppressWarnings ( "deprecation" ) public VoltTable [ ] run ( SystemProcedureExecutionContext ctx , String username , String remoteHost , String xmlConfig ) { long oldLevels = 0 ; if ( ctx . isLowestSiteId ( ) ) { hostLog . info ( String . format ( "%s from %s changed the log4j settings" , username , remoteHost ) ) ;... | Change the operational log configuration . |
155,907 | public void add ( String item , String value ) { int maxChar = MaxLenInZChoice ; if ( item . length ( ) < MaxLenInZChoice ) { maxChar = item . length ( ) ; } super . add ( item . substring ( 0 , maxChar ) ) ; values . addElement ( value ) ; } | restrict strings for the choice to MaxLenInZChoice characters |
155,908 | private int findValue ( String s ) { for ( int i = 0 ; i < values . size ( ) ; i ++ ) { if ( s . equals ( values . elementAt ( i ) ) ) { return i ; } } return - 1 ; } | find for a given value the index in values |
155,909 | public static ByteBuffer getNextChunk ( byte [ ] schemaBytes , ByteBuffer buf , CachedByteBufferAllocator resultBufferAllocator ) { buf . position ( buf . position ( ) + 4 ) ; int length = schemaBytes . length + buf . remaining ( ) ; ByteBuffer outputBuffer = resultBufferAllocator . allocate ( length ) ; outputBuffer .... | Assemble the chunk so that it can be used to construct the VoltTable that will be passed to EE . |
155,910 | private RestoreWork processMessage ( DecodedContainer msg , CachedByteBufferAllocator resultBufferAllocator ) { if ( msg == null ) { return null ; } RestoreWork restoreWork = null ; try { if ( msg . m_msgType == StreamSnapshotMessageType . FAILURE ) { VoltDB . crashLocalVoltDB ( "Rejoin source sent failure message." , ... | Process a message pulled off from the network thread and discard the container once it s processed . |
155,911 | public static void copyFile ( String fromPath , String toPath ) throws Exception { File inputFile = new File ( fromPath ) ; File outputFile = new File ( toPath ) ; com . google_voltpatches . common . io . Files . copy ( inputFile , outputFile ) ; } | Simple code to copy a file from one place to another ... Java should have this built in ... stupid java ... |
155,912 | public static String parseRevisionString ( String fullBuildString ) { String build = "" ; String [ ] splitted = fullBuildString . split ( "=" , 2 ) ; if ( splitted . length == 2 ) { build = splitted [ 1 ] . trim ( ) ; if ( build . length ( ) == 0 ) { return null ; } return build ; } Pattern p = Pattern . compile ( "-(\... | Check that RevisionStrings are properly formatted . |
155,913 | public static Object [ ] parseVersionString ( String versionString ) { if ( versionString == null ) { return null ; } if ( versionString . matches ( "\\s" ) ) { return null ; } String [ ] split = versionString . split ( "\\." ) ; if ( split . length == 0 ) { return null ; } Object [ ] v = new Object [ split . length ] ... | Parse a version string in the form of x . y . z . It doesn t require that there are exactly three parts in the version . Each part must be separated by a dot . |
155,914 | public static int compareVersions ( Object [ ] left , Object [ ] right ) { if ( left == null || right == null ) { throw new IllegalArgumentException ( "Invalid versions" ) ; } for ( int i = 0 ; i < left . length ; i ++ ) { if ( right . length == i ) { return 1 ; } if ( left [ i ] instanceof Integer ) { if ( right [ i ]... | Compare two versions . Version should be represented as an array of integers . |
155,915 | public static boolean isPro ( ) { if ( m_isPro == null ) { if ( ! Boolean . parseBoolean ( System . getProperty ( "community" , "false" ) ) ) { m_isPro = ProClass . load ( "org.voltdb.CommandLogImpl" , "Command logging" , ProClass . HANDLER_IGNORE ) . hasProClass ( ) ; } else { m_isPro = false ; } } return m_isPro . bo... | check if we re running pro code |
155,916 | public static final long cheesyBufferCheckSum ( ByteBuffer buffer ) { final int mypos = buffer . position ( ) ; buffer . position ( 0 ) ; long checksum = 0 ; if ( buffer . hasArray ( ) ) { final byte bytes [ ] = buffer . array ( ) ; final int end = buffer . arrayOffset ( ) + mypos ; for ( int ii = buffer . arrayOffset ... | I heart commutativity |
155,917 | public static < T > T [ ] concatAll ( final T [ ] empty , Iterable < T [ ] > arrayList ) { assert ( empty . length == 0 ) ; if ( arrayList . iterator ( ) . hasNext ( ) == false ) { return empty ; } int len = 0 ; for ( T [ ] subArray : arrayList ) { len += subArray . length ; } int pos = 0 ; T [ ] result = Arrays . copy... | Concatenate an list of arrays of typed - objects |
155,918 | public static long getMBRss ( Client client ) { assert ( client != null ) ; long rssMax = 0 ; try { ClientResponse r = client . callProcedure ( "@Statistics" , "MEMORY" , 0 ) ; VoltTable stats = r . getResults ( ) [ 0 ] ; stats . resetRowPosition ( ) ; while ( stats . advanceRow ( ) ) { long rss = stats . getLong ( "RS... | Get the resident set size in mb for the voltdb server on the other end of the client . If the client is connected to multiple servers return the max individual rss across the cluster . |
155,919 | public static < K , V > Multimap < K , V > zipToMap ( List < K > keys , List < V > values ) { if ( keys . isEmpty ( ) || values . isEmpty ( ) ) { return null ; } Iterator < K > keyIter = keys . iterator ( ) ; Iterator < V > valueIter = values . iterator ( ) ; ArrayListMultimap < K , V > result = ArrayListMultimap . cre... | Zip the two lists up into a multimap |
155,920 | public static < K > List < K > zip ( Collection < Deque < K > > stuff ) { final List < K > result = Lists . newArrayList ( ) ; Iterator < Deque < K > > iter = stuff . iterator ( ) ; while ( iter . hasNext ( ) ) { final K next = iter . next ( ) . poll ( ) ; if ( next != null ) { result . add ( next ) ; } else { iter . r... | Aggregates the elements from each of the given deque . It takes one element from the head of each deque in each loop and put them into a single list . This method modifies the deques in - place . |
155,921 | public static < K extends Comparable < ? > , V > ListMultimap < K , V > sortedArrayListMultimap ( ) { Map < K , Collection < V > > map = Maps . newTreeMap ( ) ; return Multimaps . newListMultimap ( map , new Supplier < List < V > > ( ) { public List < V > get ( ) { return Lists . newArrayList ( ) ; } } ) ; } | Create an ArrayListMultimap that uses TreeMap as the container map so order is preserved . |
155,922 | public static StoredProcedureInvocation roundTripForCL ( StoredProcedureInvocation invocation ) throws IOException { if ( invocation . getSerializedParams ( ) != null ) { return invocation ; } ByteBuffer buf = ByteBuffer . allocate ( invocation . getSerializedSize ( ) ) ; invocation . flattenToBuffer ( buf ) ; buf . fl... | Serialize and then deserialize an invocation so that it has serializedParams set for command logging if the invocation is sent to a local site . |
155,923 | public static Map < Integer , byte [ ] > getBinaryPartitionKeys ( TheHashinator hashinator ) { Map < Integer , byte [ ] > partitionMap = new HashMap < > ( ) ; VoltTable partitionKeys = null ; if ( hashinator == null ) { partitionKeys = TheHashinator . getPartitionKeys ( VoltType . VARBINARY ) ; } else { partitionKeys =... | Get VARBINARY partition keys for the specified topology . |
155,924 | public static Properties readPropertiesFromCredentials ( String credentials ) { Properties props = new Properties ( ) ; File propFD = new File ( credentials ) ; if ( ! propFD . exists ( ) || ! propFD . isFile ( ) || ! propFD . canRead ( ) ) { throw new IllegalArgumentException ( "Credentials file " + credentials + " is... | Get username and password from credentials file . |
155,925 | public static int writeDeferredSerialization ( ByteBuffer mbuf , DeferredSerialization ds ) throws IOException { int written = 0 ; try { final int objStartPosition = mbuf . position ( ) ; ds . serialize ( mbuf ) ; written = mbuf . position ( ) - objStartPosition ; } finally { ds . cancel ( ) ; } return written ; } | Serialize the deferred serializer data into byte buffer |
155,926 | public NodeAVL getNode ( int index ) { NodeAVL n = nPrimaryNode ; while ( index -- > 0 ) { n = n . nNext ; } return n ; } | Returns the Node for a given Index using the ordinal position of the Index within the Table Object . |
155,927 | NodeAVL getNextNode ( NodeAVL n ) { if ( n == null ) { n = nPrimaryNode ; } else { n = n . nNext ; } return n ; } | Returns the Node for the next Index on this database row given the Node for any Index . |
155,928 | private boolean listACLEquals ( List < ACL > lista , List < ACL > listb ) { if ( lista . size ( ) != listb . size ( ) ) { return false ; } for ( int i = 0 ; i < lista . size ( ) ; i ++ ) { ACL a = lista . get ( i ) ; ACL b = listb . get ( i ) ; if ( ! a . equals ( b ) ) { return false ; } } return true ; } | compare two list of acls . if there elements are in the same order and the same size then return true else return false |
155,929 | public synchronized Long convertAcls ( List < ACL > acls ) { if ( acls == null ) return - 1L ; Long ret = aclKeyMap . get ( acls ) ; if ( ret != null ) return ret ; long val = incrementIndex ( ) ; longKeyMap . put ( val , acls ) ; aclKeyMap . put ( acls , val ) ; return val ; } | converts the list of acls to a list of longs . |
155,930 | public synchronized List < ACL > convertLong ( Long longVal ) { if ( longVal == null ) return null ; if ( longVal == - 1L ) return Ids . OPEN_ACL_UNSAFE ; List < ACL > acls = longKeyMap . get ( longVal ) ; if ( acls == null ) { LOG . error ( "ERROR: ACL not available for long " + longVal ) ; throw new RuntimeException ... | converts a list of longs to a list of acls . |
155,931 | public long approximateDataSize ( ) { long result = 0 ; for ( Map . Entry < String , DataNode > entry : nodes . entrySet ( ) ) { DataNode value = entry . getValue ( ) ; synchronized ( value ) { result += entry . getKey ( ) . length ( ) ; result += ( value . data == null ? 0 : value . data . length ) ; } } return result... | Get the size of the nodes based on path and data length . |
155,932 | boolean isSpecialPath ( String path ) { if ( rootZookeeper . equals ( path ) || procZookeeper . equals ( path ) || quotaZookeeper . equals ( path ) ) { return true ; } return false ; } | is the path one of the special paths owned by zookeeper . |
155,933 | public void updateCount ( String lastPrefix , int diff ) { String statNode = Quotas . statPath ( lastPrefix ) ; DataNode node = nodes . get ( statNode ) ; StatsTrack updatedStat = null ; if ( node == null ) { LOG . error ( "Missing count node for stat " + statNode ) ; return ; } synchronized ( node ) { updatedStat = ne... | update the count of this stat datanode |
155,934 | public void deleteNode ( String path , long zxid ) throws KeeperException . NoNodeException { int lastSlash = path . lastIndexOf ( '/' ) ; String parentName = path . substring ( 0 , lastSlash ) ; String childName = path . substring ( lastSlash + 1 ) ; DataNode node = nodes . get ( path ) ; if ( node == null ) { throw n... | remove the path from the datatree |
155,935 | private void getCounts ( String path , Counts counts ) { DataNode node = getNode ( path ) ; if ( node == null ) { return ; } String [ ] children = null ; int len = 0 ; synchronized ( node ) { Set < String > childs = node . getChildren ( ) ; if ( childs != null ) { children = childs . toArray ( new String [ childs . siz... | this method gets the count of nodes and the bytes under a subtree |
155,936 | private void updateQuotaForPath ( String path ) { Counts c = new Counts ( ) ; getCounts ( path , c ) ; StatsTrack strack = new StatsTrack ( ) ; strack . setBytes ( c . bytes ) ; strack . setCount ( c . count ) ; String statPath = Quotas . quotaZookeeper + path + "/" + Quotas . statNode ; DataNode node = getNode ( statP... | update the quota for the given path |
155,937 | private void traverseNode ( String path ) { DataNode node = getNode ( path ) ; String children [ ] = null ; synchronized ( node ) { Set < String > childs = node . getChildren ( ) ; if ( childs != null ) { children = childs . toArray ( new String [ childs . size ( ) ] ) ; } } if ( children != null ) { if ( children . le... | this method traverses the quota path and update the path trie and sets |
155,938 | private void setupQuota ( ) { String quotaPath = Quotas . quotaZookeeper ; DataNode node = getNode ( quotaPath ) ; if ( node == null ) { return ; } traverseNode ( quotaPath ) ; } | this method sets up the path trie and sets up stats for quota nodes |
155,939 | public void dumpEphemerals ( PrintWriter pwriter ) { Set < Long > keys = ephemerals . keySet ( ) ; pwriter . println ( "Sessions with Ephemerals (" + keys . size ( ) + "):" ) ; for ( long k : keys ) { pwriter . print ( "0x" + Long . toHexString ( k ) ) ; pwriter . println ( ":" ) ; HashSet < String > tmp = ephemerals .... | Write a text dump of all the ephemerals in the datatree . |
155,940 | public int getCount ( ) throws InterruptedException , KeeperException { return ByteBuffer . wrap ( m_zk . getData ( m_path , false , null ) ) . getInt ( ) ; } | Returns the current count |
155,941 | public boolean isCountedDown ( ) throws InterruptedException , KeeperException { if ( countedDown ) return true ; int count = ByteBuffer . wrap ( m_zk . getData ( m_path , false , null ) ) . getInt ( ) ; if ( count > 0 ) return false ; countedDown = true ; return true ; } | Returns if already counted down to zero |
155,942 | private void copyTableSchemaFromShared ( ) { for ( SchemaColumn scol : m_sharedScan . getOutputSchema ( ) ) { SchemaColumn copy = new SchemaColumn ( scol . getTableName ( ) , getTableAlias ( ) , scol . getColumnName ( ) , scol . getColumnAlias ( ) , scol . getExpression ( ) , scol . getDifferentiator ( ) ) ; addOutputC... | Copy the table schema from the shared part to here . We have to repair the table aliases . |
155,943 | public void harmonizeOutputSchema ( ) { boolean changedCurrent ; boolean changedBase ; boolean changedRecursive = false ; NodeSchema currentSchema = getOutputSchema ( ) ; NodeSchema baseSchema = getBestCostBasePlan ( ) . rootPlanGraph . getTrueOutputSchema ( false ) ; NodeSchema recursiveSchema = ( getBestCostRecursive... | We have just planned the base query and perhaps the recursive query . We need to make sure that the output schema of the scan and the output schemas of the base and recursive plans are all compatible . |
155,944 | private static void complete ( AbstractFuture < ? > future ) { boolean maskExecutorExceptions = future . maskExecutorExceptions ; Listener next = null ; outer : while ( true ) { future . releaseWaiters ( ) ; future . afterDone ( ) ; next = future . clearListeners ( next ) ; future = null ; while ( next != null ) { List... | Unblocks all threads and runs all listeners . |
155,945 | public void addPath ( String path ) { if ( path == null ) { return ; } String [ ] pathComponents = path . split ( "/" ) ; TrieNode parent = rootNode ; String part = null ; if ( pathComponents . length <= 1 ) { throw new IllegalArgumentException ( "Invalid path " + path ) ; } for ( int i = 1 ; i < pathComponents . lengt... | add a path to the path trie |
155,946 | public void deletePath ( String path ) { if ( path == null ) { return ; } String [ ] pathComponents = path . split ( "/" ) ; TrieNode parent = rootNode ; String part = null ; if ( pathComponents . length <= 1 ) { throw new IllegalArgumentException ( "Invalid path " + path ) ; } for ( int i = 1 ; i < pathComponents . le... | delete a path from the trie |
155,947 | public String findMaxPrefix ( String path ) { if ( path == null ) { return null ; } if ( "/" . equals ( path ) ) { return path ; } String [ ] pathComponents = path . split ( "/" ) ; TrieNode parent = rootNode ; List < String > components = new ArrayList < String > ( ) ; if ( pathComponents . length <= 1 ) { throw new I... | return the largest prefix for the input path . |
155,948 | public static VoltTable tableFromShorthand ( String schema ) { String name = "T" ; VoltTable . ColumnInfo [ ] columns = null ; Matcher nameMatcher = m_namePattern . matcher ( schema ) ; if ( nameMatcher . find ( ) ) { name = nameMatcher . group ( ) . trim ( ) ; } Matcher columnDataMatcher = m_columnsPattern . matcher (... | Parse the shorthand according to the syntax as described in the class comment . |
155,949 | private static void swap ( Object [ ] w , int a , int b ) { Object t = w [ a ] ; w [ a ] = w [ b ] ; w [ b ] = t ; } | Swaps the a th and b th elements of the specified Row array . |
155,950 | synchronized void insertRowInTable ( final VoltBulkLoaderRow nextRow ) throws InterruptedException { m_partitionRowQueue . put ( nextRow ) ; if ( m_partitionRowQueue . size ( ) == m_minBatchTriggerSize ) { m_es . execute ( new Runnable ( ) { public void run ( ) { try { while ( m_partitionRowQueue . size ( ) >= m_minBat... | Synchronized so that when the a single batch is filled up we only queue one task to drain the queue . The task will drain the queue until it doesn t contain a single batch . |
155,951 | public static List < Field > getFields ( Class < ? > startClass ) { List < Field > currentClassFields = new ArrayList < Field > ( ) ; currentClassFields . addAll ( Arrays . asList ( startClass . getDeclaredFields ( ) ) ) ; Class < ? > parentClass = startClass . getSuperclass ( ) ; if ( parentClass != null ) { List < Fi... | get all the fields including parents |
155,952 | public static synchronized void initialize ( int myHostId , CatalogContext catalogContext , HostMessenger messenger ) throws BundleException , IOException { ImporterStatsCollector statsCollector = new ImporterStatsCollector ( myHostId ) ; ImportManager em = new ImportManager ( myHostId , messenger , statsCollector ) ; ... | Create the singleton ImportManager and initialize . |
155,953 | private synchronized void create ( CatalogContext catalogContext ) { try { Map < String , ImportConfiguration > newProcessorConfig = loadNewConfigAndBundles ( catalogContext ) ; restartImporters ( newProcessorConfig ) ; } catch ( final Exception e ) { VoltDB . crashLocalVoltDB ( "Error creating import processor" , true... | This creates a import connector from configuration provided . |
155,954 | private Map < String , ImportConfiguration > loadNewConfigAndBundles ( CatalogContext catalogContext ) { Map < String , ImportConfiguration > newProcessorConfig ; ImportType importElement = catalogContext . getDeployment ( ) . getImport ( ) ; if ( importElement == null || importElement . getConfiguration ( ) . isEmpty ... | Parses importer configs and loads the formatters and bundles needed into memory . This is used to generate a new configuration either to load or to compare with existing . |
155,955 | private boolean loadImporterBundle ( Properties moduleProperties ) { String importModuleName = moduleProperties . getProperty ( ImportDataProcessor . IMPORT_MODULE ) ; String attrs [ ] = importModuleName . split ( "\\|" ) ; String bundleJar = attrs [ 1 ] ; String moduleType = attrs [ 0 ] ; try { AbstractImporterFactory... | Checks if the module for importer has been loaded in the memory . If bundle doesn t exists it loades one and updates the mapping records of the bundles . |
155,956 | protected static void printCaughtException ( String exceptionMessage ) { if ( ++ countCaughtExceptions <= MAX_CAUGHT_EXCEPTION_MESSAGES ) { System . out . println ( exceptionMessage ) ; } if ( countCaughtExceptions == MAX_CAUGHT_EXCEPTION_MESSAGES ) { System . out . println ( "In NonVoltDBBackend, reached limit of " + ... | Print a message about an Exception that was caught ; but limit the number of such print messages so that the console is not swamped by them . |
155,957 | protected List < String > getAllColumns ( String tableName ) { List < String > columns = new ArrayList < String > ( ) ; try { ResultSet rs = dbconn . getMetaData ( ) . getColumns ( null , null , tableName . toLowerCase ( ) , null ) ; while ( rs . next ( ) ) { columns . add ( rs . getString ( 4 ) ) ; } } catch ( SQLExce... | Returns all column names for the specified table in the order defined in the DDL . |
155,958 | protected List < String > getPrimaryKeys ( String tableName ) { List < String > pkCols = new ArrayList < String > ( ) ; try { ResultSet rs = dbconn . getMetaData ( ) . getPrimaryKeys ( null , null , tableName . toLowerCase ( ) ) ; while ( rs . next ( ) ) { pkCols . add ( rs . getString ( 4 ) ) ; } } catch ( SQLExceptio... | Returns all primary key column names for the specified table in the order defined in the DDL . |
155,959 | protected List < String > getNonPrimaryKeyColumns ( String tableName ) { List < String > columns = getAllColumns ( tableName ) ; columns . removeAll ( getPrimaryKeys ( tableName ) ) ; return columns ; } | Returns all non - primary - key column names for the specified table in the order defined in the DDL . |
155,960 | protected String transformQuery ( String query , QueryTransformer ... qts ) { String result = query ; for ( QueryTransformer qt : qts ) { result = transformQuery ( result , qt ) ; } return result ; } | Calls the transformQuery method above multiple times for each specified QueryTransformer . |
155,961 | static protected void printTransformedSql ( String originalSql , String modifiedSql ) { if ( transformedSqlFileWriter != null && ! originalSql . equals ( modifiedSql ) ) { try { transformedSqlFileWriter . write ( "original SQL: " + originalSql + "\n" ) ; transformedSqlFileWriter . write ( "modified SQL: " + modifiedSql... | Prints the original and modified SQL statements to the Transformed SQL output file assuming that that file is defined ; and only if the original and modified SQL are not the same i . e . only if some transformation has indeed taken place . |
155,962 | private static SQLPatternPart makeGroup ( boolean capture , String captureLabel , SQLPatternPart part ) { boolean alreadyGroup = ( part . m_flags & ( SQLPatternFactory . GROUP | SQLPatternFactory . CAPTURE ) ) != 0 ; SQLPatternPart retPart = alreadyGroup ? new SQLPatternPartElement ( part ) : part ; if ( capture ) { re... | Make a capturing or non - capturing group |
155,963 | public static HSQLInterface loadHsqldb ( ParameterStateManager psMgr ) { TimeZone . setDefault ( TimeZone . getTimeZone ( "GMT+0" ) ) ; String name = "hsqldbinstance-" + String . valueOf ( instanceId ) + "-" + String . valueOf ( System . currentTimeMillis ( ) ) ; instanceId ++ ; HsqlProperties props = new HsqlPropertie... | Load up an HSQLDB in - memory instance . |
155,964 | public VoltXMLDiff runDDLCommandAndDiff ( HSQLDDLInfo stmtInfo , String ddl ) throws HSQLParseException { String expectedTableAffected = null ; boolean expectFailure = false ; Set < String > existingTableNames = null ; if ( stmtInfo != null ) { if ( stmtInfo . cascade ) { existingTableNames = getTableNames ( ) ; } if (... | Modify the current schema with a SQL DDL command and get the diff which represents the changes . |
155,965 | public void runDDLCommand ( String ddl ) throws HSQLParseException { sessionProxy . clearLocalTables ( ) ; Result result = sessionProxy . executeDirectStatement ( ddl ) ; if ( result . hasError ( ) ) { throw new HSQLParseException ( result . getMainString ( ) ) ; } } | Modify the current schema with a SQL DDL command . |
155,966 | private void fixupInStatementExpressions ( VoltXMLElement expr ) throws HSQLParseException { if ( doesExpressionReallyMeanIn ( expr ) ) { inFixup ( expr ) ; } for ( VoltXMLElement child : expr . children ) { fixupInStatementExpressions ( child ) ; } } | Recursively find all in - lists subquery row comparisons found in the XML and munge them into the simpler thing we want to pass to the AbstractParsedStmt . |
155,967 | private void inFixup ( VoltXMLElement inElement ) { inElement . name = "operation" ; inElement . attributes . put ( "optype" , "in" ) ; VoltXMLElement rowElem = null ; VoltXMLElement tableElem = null ; VoltXMLElement subqueryElem = null ; VoltXMLElement valueElem = null ; for ( VoltXMLElement child : inElement . childr... | Take an equality - test expression that represents in - list and munge it into the simpler thing we want to output to the AbstractParsedStmt for its AbstractExpression classes . |
155,968 | @ SuppressWarnings ( "unused" ) private void printTables ( ) { try { String schemaName = sessionProxy . getSchemaName ( null ) ; System . out . println ( "*** Tables For Schema: " + schemaName + " ***" ) ; } catch ( HsqlException caught ) { caught . printStackTrace ( ) ; } HashMappedList hsqlTables = getHSQLTables ( ) ... | Debug - only method that prints out the names of all tables in the current schema . |
155,969 | public VoltXMLElement getXMLForTable ( String tableName ) throws HSQLParseException { VoltXMLElement xml = emptySchema . duplicate ( ) ; HashMappedList hsqlTables = getHSQLTables ( ) ; for ( int i = 0 ; i < hsqlTables . size ( ) ; i ++ ) { Table table = ( Table ) hsqlTables . get ( i ) ; String candidateTableName = tab... | Get a serialized XML representation of a particular table . |
155,970 | private void calculateTrackers ( Collection < TopicPartition > partitions ) { Map < TopicPartition , CommitTracker > trackers = new HashMap < > ( ) ; trackers . putAll ( m_trackerMap . get ( ) ) ; Map < TopicPartition , AtomicLong > lastCommittedOffSets = new HashMap < > ( ) ; lastCommittedOffSets . putAll ( m_lastComm... | add trackers for new topic - partition in this importer |
155,971 | private void seek ( List < TopicPartition > seekList ) { for ( TopicPartition tp : seekList ) { AtomicLong lastCommittedOffset = m_lastCommittedOffSets . get ( ) . get ( tp ) ; if ( lastCommittedOffset != null && lastCommittedOffset . get ( ) > - 1L ) { AtomicLong lastSeeked = m_lastSeekedOffSets . get ( tp ) ; if ( la... | Move offsets to correct positions for next poll |
155,972 | public static String toZeroPaddedString ( long value , int precision , int maxSize ) { StringBuffer sb = new StringBuffer ( ) ; if ( value < 0 ) { value = - value ; } String s = Long . toString ( value ) ; if ( s . length ( ) > precision ) { s = s . substring ( precision ) ; } for ( int i = s . length ( ) ; i < precisi... | If necessary adds zeros to the beginning of a value so that the total length matches the given precision otherwise trims the right digits . Then if maxSize is smaller than precision trims the right digits to maxSize . Negative values are treated as positive |
155,973 | public static String toLowerSubset ( String source , char substitute ) { int len = source . length ( ) ; StringBuffer sb = new StringBuffer ( len ) ; char ch ; for ( int i = 0 ; i < len ; i ++ ) { ch = source . charAt ( i ) ; if ( ! Character . isLetterOrDigit ( ch ) ) { sb . append ( substitute ) ; } else if ( ( i == ... | Returns a string with non alphanumeric chars converted to the substitute character . A digit first character is also converted . By sqlbob |
155,974 | public static String arrayToString ( Object array ) { int len = Array . getLength ( array ) ; int last = len - 1 ; StringBuffer sb = new StringBuffer ( 2 * ( len + 1 ) ) ; sb . append ( '{' ) ; for ( int i = 0 ; i < len ; i ++ ) { sb . append ( Array . get ( array , i ) ) ; if ( i != last ) { sb . append ( ',' ) ; } } ... | Builds a bracketed CSV list from the array |
155,975 | public static void appendPair ( StringBuffer b , String s1 , String s2 , String separator , String terminator ) { b . append ( s1 ) ; b . append ( separator ) ; b . append ( s2 ) ; b . append ( terminator ) ; } | Appends a pair of string to the string buffer using the separator between and terminator at the end |
155,976 | public static int rightTrimSize ( String s ) { int i = s . length ( ) ; while ( i > 0 ) { i -- ; if ( s . charAt ( i ) != ' ' ) { return i + 1 ; } } return 0 ; } | Returns the size of substring that does not contain any trailing spaces |
155,977 | public static int skipSpaces ( String s , int start ) { int limit = s . length ( ) ; int i = start ; for ( ; i < limit ; i ++ ) { if ( s . charAt ( i ) != ' ' ) { break ; } } return i ; } | Skips any spaces at or after start and returns the index of first non - space character ; |
155,978 | public static String [ ] split ( String s , String separator ) { HsqlArrayList list = new HsqlArrayList ( ) ; int currindex = 0 ; for ( boolean more = true ; more ; ) { int nextindex = s . indexOf ( separator , currindex ) ; if ( nextindex == - 1 ) { nextindex = s . length ( ) ; more = false ; } list . add ( s . substr... | Splits the string into an array using the separator . If separator is not found in the string the whole string is returned in the array . |
155,979 | protected void populateColumnSchema ( ArrayList < ColumnInfo > columns ) { super . populateColumnSchema ( columns ) ; columns . add ( new ColumnInfo ( VoltSystemProcedure . CNAME_SITE_ID , VoltSystemProcedure . CTYPE_ID ) ) ; columns . add ( new ColumnInfo ( Columns . PARTITION_ID , VoltType . BIGINT ) ) ; columns . ad... | Check cluster . py and checkstats . py if order of the columns is changed |
155,980 | private void offerInternal ( Mailbox mailbox , Item item , long handle ) { m_bufferedReads . add ( item ) ; releaseBufferedReads ( mailbox , handle ) ; } | SPI offers a new message . |
155,981 | public long sizeInBytes ( ) throws IOException { long memoryBlockUsage = 0 ; for ( StreamBlock b : m_memoryDeque ) { memoryBlockUsage += b . totalSize ( ) ; } return memoryBlockUsage + m_reader . sizeInBytes ( ) - ( StreamBlock . HEADER_SIZE * m_reader . getNumObjects ( ) ) ; } | Only used in tests should be removed . |
155,982 | public void truncateToSequenceNumber ( final long truncationSeqNo ) throws IOException { assert ( m_memoryDeque . isEmpty ( ) ) ; m_persistentDeque . parseAndTruncate ( new BinaryDequeTruncator ( ) { public TruncatorResponse parse ( BBContainer bbc ) { ByteBuffer b = bbc . b ( ) ; ByteOrder endianness = b . order ( ) ;... | See PDB segment layout at beginning of this file . |
155,983 | public int set ( int pos ) { while ( pos >= capacity ) { doubleCapacity ( ) ; } if ( pos >= limitPos ) { limitPos = pos + 1 ; } int windex = pos >> 5 ; int mask = 0x80000000 >>> ( pos & 0x1F ) ; int word = map [ windex ] ; int result = ( word & mask ) == 0 ? 0 : 1 ; map [ windex ] = ( word | mask ) ; return result ; } | Sets pos and returns old value |
155,984 | public static void and ( byte [ ] map , int pos , byte source , int count ) { int shift = pos & 0x07 ; int mask = ( source & 0xff ) >>> shift ; int innermask = 0xff >> shift ; int index = pos / 8 ; if ( count < 8 ) { innermask = innermask >>> ( 8 - count ) ; innermask = innermask << ( 8 - count ) ; } mask &= innermask ... | AND count bits from source with map contents starting at pos |
155,985 | public static void or ( byte [ ] map , int pos , byte source , int count ) { int shift = pos & 0x07 ; int mask = ( source & 0xff ) >>> shift ; int index = pos / 8 ; if ( index >= map . length ) { return ; } byte b = ( byte ) ( map [ index ] | mask ) ; map [ index ] = b ; if ( shift == 0 ) { return ; } shift = 8 - shift... | OR count bits from source with map contents starting at pos |
155,986 | public synchronized boolean addUnsorted ( int key , int value ) { if ( count == capacity ) { if ( fixedSize ) { return false ; } else { doubleCapacity ( ) ; } } if ( sorted && count != 0 ) { if ( sortOnValues ) { if ( value < values [ count - 1 ] ) { sorted = false ; } } else { if ( value < keys [ count - 1 ] ) { sorte... | Adds a pair into the table . |
155,987 | public synchronized boolean addUnique ( int key , int value ) { if ( count == capacity ) { if ( fixedSize ) { return false ; } else { doubleCapacity ( ) ; } } if ( ! sorted ) { fastQuickSort ( ) ; } targetSearchValue = sortOnValues ? value : key ; int i = binaryEmptySlotSearch ( ) ; if ( i == - 1 ) { return false ; } h... | Adds a pair ensuring no duplicate key xor value already exists in the current search target column . |
155,988 | private int binaryFirstSearch ( ) { int low = 0 ; int high = count ; int mid = 0 ; int compare = 0 ; int found = count ; while ( low < high ) { mid = ( low + high ) / 2 ; compare = compare ( mid ) ; if ( compare < 0 ) { high = mid ; } else if ( compare > 0 ) { low = mid + 1 ; } else { high = mid ; found = mid ; } } ret... | Returns the index of the lowest element == the given search target or - 1 |
155,989 | private int binaryGreaterSearch ( ) { int low = 0 ; int high = count ; int mid = 0 ; int compare = 0 ; while ( low < high ) { mid = ( low + high ) / 2 ; compare = compare ( mid ) ; if ( compare < 0 ) { high = mid ; } else { low = mid + 1 ; } } return low == count ? - 1 : low ; } | Returns the index of the lowest element > the given search target |
155,990 | private int binarySlotSearch ( ) { int low = 0 ; int high = count ; int mid = 0 ; int compare = 0 ; while ( low < high ) { mid = ( low + high ) / 2 ; compare = compare ( mid ) ; if ( compare <= 0 ) { high = mid ; } else { low = mid + 1 ; } } return low ; } | Returns the index of the lowest element > = the given search target or count |
155,991 | private int binaryEmptySlotSearch ( ) { int low = 0 ; int high = count ; int mid = 0 ; int compare = 0 ; while ( low < high ) { mid = ( low + high ) / 2 ; compare = compare ( mid ) ; if ( compare < 0 ) { high = mid ; } else if ( compare > 0 ) { low = mid + 1 ; } else { return - 1 ; } } return low ; } | Returns the index of the lowest element > the given search target or count or - 1 if target is found |
155,992 | private int compare ( int i ) { if ( sortOnValues ) { if ( targetSearchValue > values [ i ] ) { return 1 ; } else if ( targetSearchValue < values [ i ] ) { return - 1 ; } } else { if ( targetSearchValue > keys [ i ] ) { return 1 ; } else if ( targetSearchValue < keys [ i ] ) { return - 1 ; } } return 0 ; } | Check if targeted column value in the row indexed i is less than the search target object . |
155,993 | private boolean lessThan ( int i , int j ) { if ( sortOnValues ) { if ( values [ i ] < values [ j ] ) { return true ; } } else { if ( keys [ i ] < keys [ j ] ) { return true ; } } return false ; } | Check if row indexed i is less than row indexed j |
155,994 | public static void setFontSize ( String inFontSize ) { Float stageFloat = new Float ( inFontSize ) ; float fontSize = stageFloat . floatValue ( ) ; Font fonttTree = fOwner . tTree . getFont ( ) . deriveFont ( fontSize ) ; fOwner . tTree . setFont ( fonttTree ) ; Font fontTxtCommand = fOwner . txtCommand . getFont ( ) .... | Displays a color chooser and Sets the selected color . |
155,995 | public Host lookup ( final String hostName ) { final Map < String , Host > cache = this . refresh ( ) ; Host h = cache . get ( hostName ) ; if ( h == null ) { h = new Host ( ) ; } if ( h . patternsApplied ) { return h ; } for ( final Map . Entry < String , Host > e : cache . entrySet ( ) ) { if ( ! isHostPattern ( e . ... | Locate the configuration for a specific host request . |
155,996 | public static ListeningExecutorService getCachedSingleThreadExecutor ( String name , long keepAlive ) { return MoreExecutors . listeningDecorator ( new ThreadPoolExecutor ( 0 , 1 , keepAlive , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( ) , CoreUtils . getThreadFactory ( null , name , SMALL_STACK_S... | Get a single thread executor that caches its thread meaning that the thread will terminate after keepAlive milliseconds . A new thread will be created the next time a task arrives and that will be kept around for keepAlive milliseconds . On creation no thread is allocated the first task creates a thread . |
155,997 | public static ListeningExecutorService getBoundedSingleThreadExecutor ( String name , int capacity ) { LinkedBlockingQueue < Runnable > lbq = new LinkedBlockingQueue < Runnable > ( capacity ) ; ThreadPoolExecutor tpe = new ThreadPoolExecutor ( 1 , 1 , 0L , TimeUnit . MILLISECONDS , lbq , CoreUtils . getThreadFactory ( ... | Create a bounded single threaded executor that rejects requests if more than capacity requests are outstanding . |
155,998 | public static ThreadPoolExecutor getBoundedThreadPoolExecutor ( int maxPoolSize , long keepAliveTime , TimeUnit unit , ThreadFactory tFactory ) { return new ThreadPoolExecutor ( 0 , maxPoolSize , keepAliveTime , unit , new SynchronousQueue < Runnable > ( ) , tFactory ) ; } | Create a bounded thread pool executor . The work queue is synchronous and can cause RejectedExecutionException if there is no available thread to take a new task . |
155,999 | public static ExecutorService getQueueingExecutorService ( final Queue < Runnable > taskQueue ) { return new ExecutorService ( ) { public void execute ( Runnable command ) { taskQueue . offer ( command ) ; } public void shutdown ( ) { throw new UnsupportedOperationException ( ) ; } public List < Runnable > shutdownNow ... | Create an ExceutorService that places tasks in an existing task queue for execution . Used to create a bridge for using ListenableFutures in classes already built around a queue . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.