and speculatively query those first.
435745
Call<Map<String, Long>> newBucketedTraceIdCall(
    QueryRequest request, TimestampRange timestampRange, int traceIndexFetchSize) {
    // trace_by_service_span adds special empty-string span name in order to search by all
    String spanName = null != request.spanName() ? request.spanName() : "";
    Long minDuration = request.minDuration(), maxDuration = request.maxDuration();
    int startBucket = CassandraUtil.durationIndexBucket(timestampRange.startMillis * 1000);
    int endBucket = CassandraUtil.durationIndexBucket(timestampRange.endMillis * 1000);
    if (startBucket > endBucket) {
      throw new IllegalArgumentException(
        "Start bucket (" + startBucket + ") > end bucket (" + endBucket + ")");
    }

    // "" isn't a real value. it is used to template bucketed calls and replaced later
    String serviceName = null != request.serviceName() ? request.serviceName() : "";

    // TODO: ideally, the buckets are traversed backwards, only spawning queries for older buckets
    // if younger buckets are empty. This will be an async continuation, punted for now.
    List<SelectTraceIdsFromServiceSpan.Input> serviceSpans = new ArrayList<>();
    List<SelectTraceIdsFromServiceRemoteService.Input> serviceRemoteServices = new ArrayList<>();
    String remoteService = request.remoteServiceName();
    for (int bucket = endBucket; bucket >= startBucket; bucket--) {
      boolean addSpanQuery = true;
      if (remoteService != null) {
        if (traceIdsFromServiceRemoteService == null) {
          throw new IllegalArgumentException("remoteService=" + remoteService
            + " unsupported due to missing table " + TABLE_SERVICE_REMOTE_SERVICES);
        }
        serviceRemoteServices.add(
          traceIdsFromServiceRemoteService.newInput(
            serviceName,
            remoteService,
            bucket,
            timestampRange,
            traceIndexFetchSize));
        // If the remote service query can satisfy the request, don't make a redundant span query
        addSpanQuery = !spanName.isEmpty() || minDuration != null;
      }
      if (!addSpanQuery) continue;

      serviceSpans.add(
        traceIdsFromServiceSpan.newInput(
          serviceName,
          spanName,
          bucket,
          minDuration,
          maxDuration,
          timestampRange,
          traceIndexFetchSize));
    }

    if ("".equals(serviceName)) {
      // If we have no service name, we have to lookup service names before running trace ID queries
      Call<List<String>> serviceNames = getServiceNames();
      if (serviceRemoteServices.isEmpty()) {
        return serviceNames.flatMap(traceIdsFromServiceSpan.newFlatMapper(serviceSpans));
      } else if (serviceSpans.isEmpty()) {
        return serviceNames.flatMap(
          traceIdsFromServiceRemoteService.newFlatMapper(serviceRemoteServices));
      }
      return serviceNames.flatMap(new AggregateFlatMapper<>(
        traceIdsFromServiceSpan.newFlatMapper(serviceSpans),
        traceIdsFromServiceRemoteService.newFlatMapper(serviceRemoteServices)
      ));
    }
    if (serviceRemoteServices.isEmpty()) {
      return traceIdsFromServiceSpan.newCall(serviceSpans);
    } else if (serviceSpans.isEmpty()) {
      return traceIdsFromServiceRemoteService.newCall(serviceRemoteServices);
    } else {
      return new IntersectMaps<>(asList(
        traceIdsFromServiceSpan.newCall(serviceSpans),
        traceIdsFromServiceRemoteService.newCall(serviceRemoteServices)
      ));
    }
  }
744073
private void init() {
        assertUnlocked();
        
        lock.lock();
        try {
            httpSender.init(cfg);

            LOG.info(
                "Starting with "
                    + DEFAULT_REQ_PROC_COUNT + " request processors");

            procThreads = new RequestProcessor[DEFAULT_REQ_PROC_COUNT];

            for (int i = 0; i < procThreads.length; i++) {
                procThreads[i] = new RequestProcessor(i);
                procThreads[i].start();
            }

        } finally {
            lock.unlock();
        }
    }
1127144
def queries_start_with(queries, prefixes):
    """"""
    for query in sqlparse.split(queries):
        if query and query_starts_with(query, prefixes) is True:
            return True
    return False
1064701
def or_(self, first_qe, *qes):
        ''' 
        '''
        self.__query_obj.or_(first_qe, *qes)
        return self
456602
public TResult queryForEq(String fieldName, Object value) {
		return queryForEq(fieldName, value, null, null, null);
	}
535619
protected function beforeStart()
    {
        // If no explicit request was given (via Enlighten::setRequest), create one based on the current PHP globals
        if (empty($this->request)) {
            $this->setRequest(Request::extractFromEnvironment());
        }

        $this->bootstrapRouter();
    }
18850
private function startup()
	{
		$this->registerSigHandlers();
		$this->pruneDeadWorkers();
		Resque_Event::trigger('beforeFirstFork', $this);
		$this->registerWorker();
	}
1104171
def demand
      if @initial
        retval = @initial.to_type( typecode ).simplify # !!!
        offset = INT.new 0
      else
        retval = @value.subst( @index => INT.new( 0 ) ).simplify # !!!
        offset = INT.new 1
      end
      offset.upto @index.size - 1 do |i|
        sub = @value.subst @index => INT.new( i )
        retval.assign @block.subst(@var1 => retval, @var2 => sub)
      end
      retval
    end
63870
def build_and_start(query, directory):
    """"""

    Async(target=grep, args=[query, directory]).start()
294176
protected void _before(SarlCapacityUses uses, IExtraLanguageGeneratorContext context) {
		// Rename the function in order to produce the good features at the calls.
		for (final JvmTypeReference capacity : uses.getCapacities()) {
			final JvmType type = capacity.getType();
			if (type instanceof JvmDeclaredType) {
				computeCapacityFunctionMarkers((JvmDeclaredType) type);
			}
		}
	}
114190
def search_prospects(self, search_type, query, offset=None, orgoffset=None):
        
        
        params = {'q': query}
        if offset and orgoffset:
            params['orgOffset'] = orgoffset
            params['timeOffset'] = offset
          
        return self._call('search/%s' % search_type, params)
1059869
def first
      reply = read_preference.with_node(cluster) do |node|
        node.query(
          operation.database,
          operation.collection,
          operation.selector,
          query_options(
            fields: operation.fields,
            flags: operation.flags,
            skip: operation.skip,
            limit: -1
          )
        )
      end
      reply.documents.first
    end
425617
protected void beforeStartElement() {
        beforeMarkup();
        if (stack.length <= depth + 1) {
            // Allocate more space for the stack:
            int[] newStack = new int[stack.length * 2];
            System.arraycopy(stack, 0, newStack, 0, stack.length);
            stack = newStack;
        }
        stack[depth + 1] = 0; // nothing written yet
    }
825425
function promisePrompt(questions) {
    return new Promise(function(resolve, reject) {
        inquirer.prompt(questions, function(results) {
            resolve(results);
        });
    });
}
380969
public function first()
    {
        $results = $this->get();

        if (is_array($results) && array_key_exists(0, $results)) {
            return $results[0];
        }

        // No entries were returned, return false
        return false;
    }
1351486
def first(self, default=None, as_dict=False, as_ordereddict=False):
        """"""

        # Try to get a record, or return/raise default.
        try:
            record = self[0]
        except IndexError:
            if isexception(default):
                raise default
            return default

        # Cast and return.
        if as_dict:
            return record.as_dict()
        elif as_ordereddict:
            return record.as_dict(ordered=True)
        else:
            return record
977957
def find(self, *queries, **kwargs):
        
        kwargs["deep"] = True
        kwargs["roots"] = False
        if "one" not in kwargs:
            kwargs["one"] = first
        return self.select(*queries, **kwargs)