```j影音a import com.google.cloud.bigquery.BigQuery; import com.google.cloud.bigquery.BigQueryException; import com.google.cloud.bigquery.BigQueryOptions; import com.google.cloud.bigquery.Job; import com.google.cloud.bigquery.JobInfo; import com.google.cloud.bigquery.QueryJobConfiguration; import com.google.cloud.bigquery.TableResult; public class QueryUsingLegacySql { public static void main(String[] args) { // TODO(developer): Replace these variables before running the sample. String query = String.format( "SELECT accountNumber, bankCode FROM `bigquery-public-data.transactions.us_states`" + " WHERE accountNumber LIKE '%06530465%'"); String projectId = "bigquery-public-data"; queryUsingLegacySql(projectId, query); } public static void queryUsingLegacySql(String projectId, String query) { try { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService(); QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query) .setUseLegacySql(true) .build(); // Example query to find customers by name from the "us_states" dataset. Job job = bigquery.create(JobInfo.of(queryConfig)); // Wait for the query to complete. job = job.waitFor(); // Check for errors if (job.isDone()) { TableResult results = job.getQueryResults(); results .iterateAll() .forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString()))); } else { System.out.println("Job not executed since it no longer exists."); } } catch (BigQueryException | InterruptedException e) { System.out.println("Query not performed \n" + e.toString()); } } } ``` 威胁情报联动驱动全链路网络最佳实践