[TARGET query(QueryJobConfiguration, JobOption...)]
5683
public void runQuery() throws InterruptedException {
    // [START bigquery_query]
    // BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
    String query = "SELECT corpus FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
    QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query).build();

    // Print the results.
    for (FieldValueList row : bigquery.query(queryConfig).iterateAll()) {
      for (FieldValue val : row) {
        System.out.printf("%s,", val.toString());
      }
      System.out.printf("\n");
    }
    // [END bigquery_query]
  }
1149575
def process_snapshot_job(query = {}, report_email = nil, postback_url = nil, options = {})
      data = options
      data['query'] = query
      process_job(:snapshot, data, report_email, postback_url)
    end
1234765
function queryGruntTask() {
        var target = isDebug() ? 'debug' : 'release';

        for (var i = 0, n = _supportCommand.length; i < n; i++) {
            if (null != _cmdline.match(_supportCommand[i].regexp)) {
                return _supportCommand[i].prefix + (_supportCommand[i].no_target ? "" : target);
            }
        }
        return null;
    }
554260
private void parseInputQuery(String query) {
    List<String> projectedColumns = new ArrayList<>();
    if (StringUtils.isNotBlank(query)) {
      String queryLowerCase = query.toLowerCase();
      int startIndex = queryLowerCase.indexOf("select ") + 7;
      int endIndex = queryLowerCase.indexOf(" from ");
      if (startIndex >= 0 && endIndex >= 0) {
        String columnProjection = query.substring(startIndex, endIndex);
        this.setInputColumnProjection(columnProjection);
        // parse the select list
        StringBuffer sb = new StringBuffer();
        int bracketCount = 0;
        for (int i = 0; i < columnProjection.length(); i++) {
          char c = columnProjection.charAt(i);
          if (c == '(') {
            bracketCount++;
          }

          if (c == ')') {
            bracketCount--;
          }

          if (bracketCount != 0) {
            sb.append(c);
          } else {
            if (c != ',') {
              sb.append(c);
            } else {
              projectedColumns.add(sb.toString());
              sb = new StringBuffer();
            }
          }
        }
        projectedColumns.add(sb.toString());
      }
    }

    if (this.isSelectAllColumns()) {
      List<String> columnList = this.getMetadataColumnList();
      for (String columnName : columnList) {
        ColumnAttributes col = new ColumnAttributes();
        col.setColumnName(columnName);
        col.setAliasName(columnName);
        col.setSourceColumnName(columnName);
        this.addToColumnAliasMap(col);
      }
    } else {
      for (String projectedColumn : projectedColumns) {
        String column = projectedColumn.trim();
        String alias = null;
        String sourceColumn = column;
        int spaceOccurences = StringUtils.countMatches(column.trim(), " ");
        if (spaceOccurences > 0) {
          // separate column and alias if they are separated by "as"
          // or space
          int lastSpaceIndex = column.toLowerCase().lastIndexOf(" as ");
          sourceColumn = column.substring(0, lastSpaceIndex);
          alias = column.substring(lastSpaceIndex + 4);
        }

        // extract column name if projection has table name in it
        String columnName = sourceColumn;
        if (sourceColumn.contains(".")) {
          columnName = sourceColumn.substring(sourceColumn.indexOf(".") + 1);
        }

        ColumnAttributes col = new ColumnAttributes();
        col.setColumnName(columnName);
        col.setAliasName(alias);
        col.setSourceColumnName(sourceColumn);
        this.addToColumnAliasMap(col);
      }
    }
  }
687468
def select(query)
      op = Operation.new(@sdb, :select, "select * from #{name} where #{query}")
      op.inject([]){|items,(results, operation)|
        batch_items = results[:items].map{|pair|
          item = pair.values.first
          item.merge!({'itemName()' => pair.keys.first})
          item
        }
        items.concat(batch_items)
      }
    end
1086898
function validateQuery(query) {
		Assert.ok(((query) && ((typeof query) === 'object')),
			'The Query object was not set?');
		Assert.ok(((query.QueryString) && ((typeof query.QueryString) === 'string')),
			'The query string was not set?');
		Assert.ok(((query.ResultConfiguration) && ((typeof query.ResultConfiguration) === 'object')),
			'The result configuation in the query object was not set?');
		Assert.ok(((query.ResultConfiguration.OutputLocation) && ((typeof query.ResultConfiguration.OutputLocation) === 'string')),
			'The output location of the result configuration in the query object was not set?');
		return query;
}
179854
public List<JobExecutionInfo> queryByJobName(String name, int resultsLimit) throws RemoteInvocationException {
    JobExecutionQuery query = new JobExecutionQuery();
    query.setIdType(QueryIdTypeEnum.JOB_NAME);
    query.setId(JobExecutionQuery.Id.create(name));
    query.setIncludeTaskExecutions(false);
    query.setLimit(resultsLimit);

    return executeQuery(query);
  }
233140
public void executeJob() {
        AbstractApplicationContext springContext = SpringContext.getContext(springConfigurationClass);
        CinchJob cinchJob = springContext.getBean(CinchJob.class);

        cinchJob.execute(this);
    }
714201
public ResultSet executeQuery(ReadContext context, Options.QueryOption... options) {
    return context.executeQuery(this, options);
  }
337025
private void setupQuery(Query query, Object[] paramValues, Type[] paramTypes, Integer offset, Integer limit){
    	if (paramValues != null && paramTypes != null){
        	query.setParameters(paramValues, paramTypes);
    	}
    	if (offset != null){
        	query.setFirstResult(offset);
    	}
    	if (limit != null){
        	query.setMaxResults(limit);
    	}
    }
1320466
@Override
    public Cursor onQuery(T helper, SQLiteDatabase db, MatcherPattern target, QueryParameters parameter) {
        Cursor result = null;

        SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
        builder.setTables(target.getTableInfo().getName());
        builder.setProjectionMap(target.getTableInfo().getProjectionMap());

        // where
        switch (target.getMimeTypeVnd().getSubType()) {

            case ITEM:
                // Add item selection criteria (using StringBuilder via appendWhere)
                // URI parameter type not set at this level of the class hierarchy, but it is
                // assumed to be numeric so value not escaped.
                builder.appendWhere(target.getTableInfo().getIdColumnInfo().getColumnName());
                builder.appendWhere("=");
                builder.appendWhere(parameter.getUri().getPathSegments().get(1));
                break;

            case DIRECTORY:
            default:
                break;
        }

        // orderBy
        String orderBy = getSortOrderStringForQuery(target, parameter);

        result = builder.query(db, parameter.getProjection(), parameter.getSelection(), parameter.getSelectionArgs(),
            null, null, orderBy);
        return result;
    }
970532
def execute_query(cmd, client, application, analytics_query, start_time=None, end_time=None, offset='1h', resource_group_name=None):
    """"""
    from .vendored_sdks.applicationinsights.models import QueryBody
    targets = get_query_targets(cmd.cli_ctx, application, resource_group_name)
    return client.query.execute(targets[0], QueryBody(query=analytics_query, timespan=get_timespan(cmd.cli_ctx, start_time, end_time, offset), applications=targets[1:]))
796365
function fetchJobConfigurationStrategy(job) {
    var deferred = q.defer(),
      options = _.extend(defaultOptions, {
        url: [serverUrl, 'job', job, 'config.xml'].join('/')
      });

    request(options, function(e, r, b) {
      verboseLogRequest(options);
      verboseLogResponse(r);
      if (hasError(e, r)) {
        return deferred.reject(e);
      }
      var strategy = r.statusCode === 200 ? 'update' : 'create';
      grunt.log.ok(strategy + ': ' + job);
      deferred.resolve({
        strategy: strategy,
        jobName: job
      });
    });
    return deferred.promise;
  }
300009
private List<JobExecutionInfo> executeQuery(JobExecutionQuery query) throws RemoteInvocationException {
    JobExecutionQueryResult result = this.client.get(query);

    if (result != null && result.hasJobExecutions()) {
      return result.getJobExecutions();
    }
    return Collections.emptyList();
  }
126114
private void handleExpressionQuery(final TSDB tsdb, final HttpQuery query) {
    final net.opentsdb.query.pojo.Query v2_query = 
        JSON.parseToObject(query.getContent(), net.opentsdb.query.pojo.Query.class);
    v2_query.validate();

    checkAuthorization(tsdb, query.channel(), v2_query);

    final QueryExecutor executor = new QueryExecutor(tsdb, v2_query);
    executor.execute(query);
  }
839795
@Override
	public JobExecutionResult execute(String jobName) throws Exception {
		Plan plan = createProgramPlan(jobName);
		this.optimizerPlan = compiler.compile(plan);

		// do not go on with anything now!
		throw new ProgramAbortException();
	}
948142
public ListenableFuture<Map<JobId, Job>> jobs(@Nullable final String jobQuery) {
    return jobs(jobQuery, null);
  }