javav2/example_code/athena/src/main/java/aws/example/athena/StartQueryExample.java
/**
     * This code calls Athena and retrieves the results of a query.
     * The query must be in a completed state before the results can be retrieved and
     * paginated. The first row of results are the column headers.
     */
This code calls Athena and retrieves the results of a query.
The query must be in a completed state before the results can be retrieved and
paginated. The first row of results are the column headers.
This code calls Athena and retrieves the results of a query . The query must be in a completed state before the results can be retrieved and paginated . The first row of results are the column headers .
private static void processResultRows(AthenaClient athenaClient, String queryExecutionId) {
        GetQueryResultsRequest getQueryResultsRequest = GetQueryResultsRequest.builder()
                .queryExecutionId(queryExecutionId).build();
        GetQueryResultsIterable getQueryResultsResults = athenaClient.getQueryResultsPaginator(getQueryResultsRequest);
        for (GetQueryResultsResponse Resultresult : getQueryResultsResults) {
            List<ColumnInfo> columnInfoList = Resultresult.resultSet().resultSetMetadata().columnInfo();
            List<Row> results = Resultresult.resultSet().rows();
            processRow(results, columnInfoList);
        }
    }
private static void processResultRows ( AthenaClient athenaClient , String queryExecutionId ) { GetQueryResultsRequest getQueryResultsRequest = GetQueryResultsRequest . builder ( ) . queryExecutionId ( queryExecutionId ) . build ( ) ; GetQueryResultsIterable getQueryResultsResults = athenaClient . getQueryResultsPaginator ( getQueryResultsRequest ) ; for ( GetQueryResultsResponse Resultresult : getQueryResultsResults ) { List < ColumnInfo > columnInfoList = Resultresult . resultSet ( ) . resultSetMetadata ( ) . columnInfo ( ) ; List < Row > results = Resultresult . resultSet ( ) . rows ( ) ; processRow ( results , columnInfoList ) ; } }
This code calls Athena and retrieves the results of a query.
This code calls Athena and retrieves the results of a query .
// Max Results can be set but if its not set, // it will choose the maximum page size // As of the writing of this code, the maximum value is 1000 // .withMaxResults(1000)