code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
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();
} | java |
public void loadProcedures(CatalogContext catalogContext, boolean isInitOrReplay)
{
m_defaultProcManager = catalogContext.m_defaultProcs;
// default proc caches clear on catalog update
m_defaultProcCache.clear();
m_plannerTool = catalogContext.m_ptool;
// reload all system p... | java |
private static SQLPatternPart makeInnerProcedureModifierClausePattern(boolean captureTokens)
{
return
SPF.oneOf(
SPF.clause(
SPF.token("allow"),
SPF.group(captureTokens, SPF.commaList(SPF.userName()))
),
SPF.... | java |
static SQLPatternPart unparsedProcedureModifierClauses()
{
// Force the leading space to go inside the repeat block.
return SPF.capture(SPF.repeat(makeInnerProcedureModifierClausePattern(false))).withFlags(SQLPatternFactory.ADD_LEADING_SPACE_TO_CHILD);
} | java |
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())
... | java |
private static SQLPatternPart unparsedStreamModifierClauses() {
// Force the leading space to go inside the repeat block.
return SPF.capture(SPF.repeat(makeInnerStreamModifierClausePattern(false))).withFlags(SQLPatternFactory.ADD_LEADING_SPACE_TO_CHILD);
} | java |
private static List<String> parseExecParameters(String paramText)
{
final String SafeParamStringValuePattern = "#(SQL_PARSER_SAFE_PARAMSTRING)";
// Find all quoted strings.
// Mask out strings that contain whitespace or commas
// that must not be confused with parameter separators.
... | java |
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 erro... | java |
public static List<FileInfo> parseFileStatement(FileInfo parentContext, String statement)
{
Matcher fileMatcher = FileToken.matcher(statement);
if (! fileMatcher.lookingAt()) {
// This input does not start with FILE,
// so it's not a file command, it's something else.
... | java |
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... | java |
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... | java |
public static String getDigitsFromHexLiteral(String paramString) {
Matcher matcher = SingleQuotedHexLiteral.matcher(paramString);
if (matcher.matches()) {
return matcher.group(1);
}
return null;
} | java |
public static long hexDigitsToLong(String hexDigits) throws SQLParser.Exception {
// BigInteger.longValue() will truncate to the lowest 64 bits,
// so we need to explicitly check if there's too many digits.
if (hexDigits.length() > 16) {
throw new SQLParser.Exception("Too many hexad... | java |
public static ExecuteCallResults parseExecuteCall(
String statement,
Map<String,Map<Integer, List<String>>> procedures) throws SQLParser.Exception
{
assert(procedures != null);
return parseExecuteCallInternal(statement, procedures);
} | java |
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;
... | java |
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;
... | java |
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.g... | java |
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 mat... | java |
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 trail... | java |
void resolveColumnRefernecesInUnionOrderBy() {
int orderCount = sortAndSlice.getOrderLength();
if (orderCount == 0) {
return;
}
String[] unionColumnNames = getColumnNames();
for (int i = 0; i < orderCount; i++) {
Expression sort = (Expression) sortAndS... | java |
public void setTableColumnNames(HashMappedList list) {
if (resultTable != null) {
((TableDerived) resultTable).columnList = list;
return;
}
leftQueryExpression.setTableColumnNames(list);
} | java |
public void setAsTopLevel() {
if (compileContext.getSequences().length > 0) {
throw Error.error(ErrorCode.X_42598);
}
isTopLevel = true;
setReturningResultSet();
} | java |
void setReturningResultSet() {
if (unionCorresponding) {
persistenceScope = TableBase.SCOPE_SESSION;
columnMode = TableBase.COLUMNS_UNREFERENCED;
return;
}
leftQueryExpression.setReturningResultSet();
} | java |
public void schedulePeriodicStats() {
Runnable statsPrinter = new Runnable() {
@Override
public void run() { printStatistics(); }
};
m_scheduler.scheduleWithFixedDelay(statsPrinter,
m_config.displayinterval,
m_config.displayinterval,
... | java |
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... | java |
private void shutdown() {
// Stop the stats printer, the bid generator and the nibble deleter.
m_scheduler.shutdown();
try {
m_scheduler.awaitTermination(60, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
... | java |
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) {
... | java |
public void promoteSinglePartitionInfo(
HashMap<AbstractExpression, Set<AbstractExpression>> valueEquivalence,
Set< Set<AbstractExpression> > eqSets) {
assert(getScanPartitioning() != null);
if (getScanPartitioning().getCountOfPartitionedTables() == 0 ||
getScanPa... | java |
private void updateEqualSets(Set<AbstractExpression> values,
HashMap<AbstractExpression, Set<AbstractExpression>> valueEquivalence,
Set< Set<AbstractExpression> > eqSets,
AbstractExpression tveKey, AbstractExpression spExpr) {
boolean hasLegacyValues = false;
if (eqSe... | java |
@Override
public boolean getIsReplicated() {
for (StmtTableScan tableScan : m_subqueryStmt.allScans()) {
if ( ! tableScan.getIsReplicated()) {
return false;
}
}
return true;
} | java |
public TupleValueExpression getOutputExpression(int index) {
SchemaColumn schemaCol = getSchemaColumn(index);
TupleValueExpression tve = new TupleValueExpression(getTableAlias(), getTableAlias(),
schemaCol.getColumnAlias(), schemaCol.getColumnAlias(), index);
return tve;
} | java |
static private ComparisonExpression rangeFilterFromPrefixLike(AbstractExpression leftExpr, ExpressionType rangeComparator, String comparand) {
ConstantValueExpression cve = new ConstantValueExpression();
cve.setValueType(VoltType.STRING);
cve.setValue(comparand);
cve.setValueSize(compara... | java |
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 this... | java |
public void addColumn(SchemaColumn column) {
int size = m_columns.size();
m_columnsMapHelper.put(column, size);
m_columns.add(column);
} | java |
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_colu... | java |
void sortByTveIndex(int fromIndex, int toIndex) {
Collections.sort(m_columns.subList(fromIndex, toIndex), TVE_IDX_COMPARE);
} | java |
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.g... | java |
NodeSchema copyAndReplaceWithTVE() {
NodeSchema copy = new NodeSchema();
int colIndex = 0;
for (SchemaColumn column : m_columns) {
copy.addColumn(column.copyAndReplaceWithTVE(colIndex));
++colIndex;
}
return copy;
} | java |
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.");
}
bool... | java |
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 integerToDouble... | java |
@Override
public List<AbstractExpression> bindingToIndexedExpression(AbstractExpression expr) {
if (m_originalValue == null || ! m_originalValue.equals(expr)) {
return null;
}
// This parameter's value was matched, so return this as one bound parameter.
List<AbstractExpre... | java |
Object getParameterAtIndex(int partitionIndex) {
try {
if (serializedParams != null) {
return ParameterSet.getParameterAtIndex(partitionIndex, serializedParams.duplicate());
} else {
return params.get().getParam(partitionIndex);
}
}
... | java |
public void flattenToBufferForOriginalVersion(ByteBuffer buf) throws IOException
{
assert((params != null) || (serializedParams != null));
// for self-check assertion
int startPosition = buf.position();
buf.put(ProcedureInvocationType.ORIGINAL.getValue());
SerializationHel... | java |
@Override
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) >... | java |
@Override
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... | java |
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, stemform... | java |
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.... | java |
private void runForBlockingDataTransfer(SiteProcedureConnection siteConnection)
{
boolean sourcesReady = false;
RestoreWork restoreWork = m_dataSink.poll(m_snapshotBufferAllocator);
if (restoreWork != null) {
restoreBlock(restoreWork, siteConnection);
sourcesReady = t... | java |
public <T> T getService(URI bundleURI, Class<T> svcClazz) {
return m_bundles.getService(bundleURI, svcClazz);
} | java |
public void setPos(int pos) {
position = pos;
NodeAVL n = nPrimaryNode;
while (n != null) {
((NodeAVLDisk) n).iData = position;
n = n.nNext;
}
} | java |
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;
}
} | java |
public void write(RowOutputInterface out) {
try {
writeNodes(out);
if (hasDataChanged) {
out.writeData(rowData, tTable.colTypes);
out.writeEnd();
hasDataChanged = false;
}
} catch (IOException e) {}
} | java |
private void writeNodes(RowOutputInterface out) throws IOException {
out.writeSize(storageSize);
NodeAVL n = nPrimaryNode;
while (n != null) {
n.write(out);
n = n.nNext;
}
hasNodesChanged = false;
} | java |
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(messageByt... | java |
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", ... | java |
public Object[][] getStatsRows(boolean interval, final Long now) {
this.now = now;
/*
* Synchronizing on this allows derived classes to maintain thread safety
*/
synchronized (this) {
Iterator<Object> i = getStatsRowKeyIterator(interval);
ArrayList<Objec... | java |
protected void updateStatsRow(Object rowKey, Object rowValues[]) {
rowValues[0] = now;
rowValues[1] = m_hostId;
rowValues[2] = m_hostname;
} | java |
@Override
public long deserialize(DataTree dt, Map<Long, Long> sessions)
throws IOException {
// we run through 100 snapshots (not all of them)
// if we cannot get it running within 100 snapshots
// we should give up
List<File> snapList = findNValidSnapshots(100);
... | java |
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 "
... | java |
@Override
public File findMostRecentSnapshot() throws IOException {
List<File> files = findNValidSnapshots(1);
if (files.size() == 0) {
return null;
}
return files.get(0);
} | java |
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++;
... | java |
protected void serialize(DataTree dt,Map<Long, Long> sessions,
OutputArchive oa, FileHeader header) throws IOException {
// this is really a programmatic error and not something that can
// happen at runtime
if(header==null)
throw new IllegalStateException(
... | java |
@Override
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(sessO... | java |
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... | java |
public static synchronized void asyncSampleSystemNow(final boolean medium, final boolean large) {
// slow mode starts an async thread
if (mode == GetRSSMode.PS) {
if (thread != null) {
if (thread.isAlive()) return;
else thread = null;
}
... | java |
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 = Inte... | java |
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 s... | java |
private static synchronized Datum generateCurrentSample() {
// Code used to fake system statistics by tests
if (testStatsProducer!=null) {
return testStatsProducer.getCurrentStatsData();
}
// get this info once
if (!initialized) initialize();
long rss = -1;
... | java |
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.widt... | java |
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 = I... | java |
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 =... | java |
public boolean canRead(Session session, Row row) {
synchronized (row) {
RowAction action = row.rowAction;
if (action == null) {
return true;
}
return action.canRead(session);
}
} | java |
public void setTransactionInfo(CachedObject object) {
Row row = (Row) object;
if (row.rowAction != null) {
return;
}
RowAction rowact = (RowAction) rowActionMap.get(row.position);
row.rowAction = rowact;
} | java |
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) {... | java |
void addToCommittedQueue(Session session, Object[] list) {
synchronized (committedTransactionTimestamps) {
// add the txList according to commit timestamp
committedTransactions.addLast(list);
// get session commit timestamp
committedTransactionTimestamps.addLas... | java |
void mergeExpiredTransactions(Session session) {
long timestamp = getFirstLiveTransactionTimestamp();
while (true) {
long commitTimestamp = 0;
Object[] actions = null;
synchronized (committedTransactionTimestamps) {
if (committedTransact... | java |
void endTransaction(Session session) {
try {
writeLock.lock();
long timestamp = session.transactionTimestamp;
synchronized (liveTransactionTimestamps) {
session.isTransaction = false;
int index = liveTransactionTimestamps.indexOf(timestamp)... | java |
RowAction[] getRowActionList() {
try {
writeLock.lock();
Session[] sessions = database.sessionManager.getAllSessions();
int[] tIndex = new int[sessions.length];
RowAction[] rowActions;
int rowActionCount = 0;
{
... | java |
public DoubleIntIndex getTransactionIDList() {
writeLock.lock();
try {
DoubleIntIndex lookup = new DoubleIntIndex(10, false);
lookup.setKeysSearchTarget();
Iterator it = this.rowActionMap.keySet().iterator();
for (; it.hasNext(); ) {
l... | java |
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] = (RowAc... | java |
@Override
protected VoltMessage instantiate_local(byte messageType)
{
// instantiate a new message instance according to the id
VoltMessage message = null;
switch (messageType) {
case INITIATE_TASK_ID:
message = new InitiateTaskMessage();
break;
c... | java |
void clearStructures() {
if (schemaManager != null) {
schemaManager.clearStructures();
}
granteeManager = null;
userManager = null;
nameManager = null;
schemaManager = null;
sessionManager = null;
dbInfo = null;
} | java |
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);
// schemas and schema objects such as tabl... | java |
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.... | java |
private ExpressionLogical XStartsWithPredicateRightPart(Expression left) {
readThis(Tokens.WITH);
if (token.tokenType == Tokens.QUESTION) { // handle user parameter case
Expression right = XreadRowValuePredicand();
if (left.isParam() && right.isParam()) { // again make sure... | java |
Expression XreadRowValueConstructor() {
Expression e;
e = XreadExplicitRowValueConstructorOrNull();
if (e != null) {
return e;
}
e = XreadRowOrCommonValueExpression();
if (e != null) {
return e;
}
return XreadBooleanValueExpre... | java |
Expression XreadExplicitRowValueConstructorOrNull() {
Expression e;
switch (token.tokenType) {
case Tokens.OPENBRACKET : {
read();
int position = getPosition();
int brackets = readOpenBrackets();
switch (token.tokenType) {
... | java |
private Expression readCaseWhen(final Expression l) {
readThis(Tokens.WHEN);
Expression condition = null;
if (l == null) {
condition = XreadBooleanValueExpression();
} else {
while (true) {
Expression newCondition = XreadPredicateRightPart(l);
... | java |
private Expression readCaseWhenExpression() {
Expression l = null;
read();
readThis(Tokens.OPENBRACKET);
l = XreadBooleanValueExpression();
readThis(Tokens.COMMA);
Expression thenelse = XreadRowValueExpression();
readThis(Tokens.COMMA);
thenelse = n... | java |
private Expression readCastExpression() {
boolean isConvert = token.tokenType == Tokens.CONVERT;
read();
readThis(Tokens.OPENBRACKET);
Expression l = this.XreadValueExpressionOrNull();
if (isConvert) {
readThis(Tokens.COMMA);
} else {
readThis(... | java |
private Expression readNullIfExpression() {
// turn into a CASEWHEN
read();
readThis(Tokens.OPENBRACKET);
Expression c = XreadValueExpression();
readThis(Tokens.COMMA);
Expression thenelse =
new ExpressionOp(OpTypes.ALTERNATIVE,
... | java |
private Expression readCoalesceExpression() {
Expression c = null;
// turn into a CASEWHEN
read();
readThis(Tokens.OPENBRACKET);
Expression leaf = null;
while (true) {
Expression current = XreadValueExpression();
if (leaf != null && token.toke... | java |
StatementDMQL compileCursorSpecification() {
QueryExpression queryExpression = XreadQueryExpression();
queryExpression.setAsTopLevel();
queryExpression.resolve(session);
if (token.tokenType == Tokens.FOR) {
read();
if (token.tokenType == Tokens.READ) {
... | java |
public long toLong() {
byte[] data = getBytes();
if (data == null || data.length <= 0 || data.length > 8) {
// Assume that we're in a numeric context and that the user
// made a typo entering a hex string.
throw Error.error(ErrorCode.X_42585); // malformed numeric con... | java |
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)... | java |
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;
... | java |
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 " ... | java |
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 = newMaste... | java |
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);
} | java |
int get(int rowSize) {
if (lookup.size() == 0) {
return -1;
}
int index = lookup.findFirstGreaterEqualKeyIndex(rowSize);
if (index == -1) {
return -1;
}
// statistics for successful requests only - to be used later for midSize
requestCo... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.