Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ public class SimpleQuery {
public static void main(String[] args) {
// TODO(developer): Replace this query before running the sample.
String query =
"SELECT corpus, count(*) as corpus_count "
+ "FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
"SELECT name, SUM(number) as total_people "
+ "FROM `bigquery-public-data.usa_names.usa_1910_2013` "
+ "WHERE state = 'TX' "
+ "GROUP BY name, state "
+ "ORDER BY total_people DESC "
+ "LIMIT 100;";
simpleQuery(query);
}

Expand All @@ -51,8 +55,8 @@ public static void simpleQuery(String query) {
.iterateAll()
.forEach(
row -> {
System.out.print("corpus:" + row.get("corpus").getStringValue());
System.out.print(", count:" + row.get("corpus_count").getLongValue());
System.out.print("name:" + row.get("name").getStringValue());
System.out.print(", total_people:" + row.get("total_people").getLongValue());
System.out.println();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public void tearDown() {
@Test
public void testSimpleQuery() {
String query =
"SELECT corpus, count(*) as corpus_count "
+ "FROM `bigquery-public-data.samples.shakespeare` GROUP BY corpus;";
"SELECT name, SUM(number) as total_people "
+ "FROM `bigquery-public-data.usa_names.usa_1910_2013` "
+ "WHERE state = 'TX' "
+ "GROUP BY name, state "
+ "ORDER BY total_people DESC "
+ "LIMIT 100;";

SimpleQuery.simpleQuery(query);
assertThat(bout.toString()).contains("Query ran successfully");
Expand Down
Loading