<commit_before>//snippet-sourcedescription:[StartQueryExample.kt demonstrates how to submit a query to Amazon Athena for execution, wait until the results are available, and then process the results.]
//snippet-keyword:[AWS SDK for Kotlin]
//snippet-keyword:[Code Sample]
//snippet-keyword:[Amazon Athena]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[07/14/2021]
//snippet-sourceauthor:[scmacdon - aws]

/*
   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   SPDX-License-Identifier: Apache-2.0
*/

package com.kotlin.athena

//snippet-start:[athena.kotlin.StartQueryExample.import]
import aws.sdk.kotlin.runtime.AwsServiceException
import aws.sdk.kotlin.services.athena.AthenaClient
import aws.sdk.kotlin.services.athena.model.QueryExecutionContext
import aws.sdk.kotlin.services.athena.model.ResultConfiguration
import aws.sdk.kotlin.services.athena.model.StartQueryExecutionRequest
import aws.sdk.kotlin.services.athena.model.GetQueryExecutionRequest
import aws.sdk.kotlin.services.athena.model.GetQueryExecutionResponse
import aws.sdk.kotlin.services.athena.model.QueryExecutionState
import aws.sdk.kotlin.services.athena.model.GetQueryResultsRequest
import aws.sdk.kotlin.services.athena.model.AthenaException
import aws.sdk.kotlin.services.athena.model.Row
import kotlinx.coroutines.delay
import java.lang.RuntimeException
import kotlin.system.exitProcess
//snippet-end:[athena.kotlin.StartQueryExample.import]


suspend fun main(args:Array<String>) {

    val usage = """
    Usage:
        <queryString> <database> <outputLocation>

    Where:
        queryString - the query string to use (for example, "SELECT * FROM mydatabase"; ).
        database - the name of the database to use (for example, mydatabase ).
        outputLocation - the output location (for example, the name of an Amazon S3 bucket - s3://mybucket). 
        
    """<commit_msg>Update StartQueryExample.kt<commit_after>//snippet-sourcedescription:[StartQueryExample.kt demonstrates how to submit a query to Amazon Athena for execution, wait until the results are available, and then process the results.]
//snippet-keyword:[AWS SDK for Kotlin]
//snippet-keyword:[Code Sample]
//snippet-keyword:[Amazon Athena]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[07/14/2021]
//snippet-sourceauthor:[scmacdon - aws]

/*
   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   SPDX-License-Identifier: Apache-2.0
*/

package com.kotlin.athena

//snippet-start:[athena.kotlin.StartQueryExample.import]
import aws.sdk.kotlin.runtime.AwsServiceException
import aws.sdk.kotlin.services.athena.AthenaClient
import aws.sdk.kotlin.services.athena.model.QueryExecutionContext
import aws.sdk.kotlin.services.athena.model.ResultConfiguration
import aws.sdk.kotlin.services.athena.model.StartQueryExecutionRequest
import aws.sdk.kotlin.services.athena.model.GetQueryExecutionRequest
import aws.sdk.kotlin.services.athena.model.GetQueryExecutionResponse
import aws.sdk.kotlin.services.athena.model.QueryExecutionState
import aws.sdk.kotlin.services.athena.model.GetQueryResultsRequest
import aws.sdk.kotlin.services.athena.model.AthenaException
import aws.sdk.kotlin.services.athena.model.Row
import kotlinx.coroutines.delay
import java.lang.RuntimeException
import kotlin.system.exitProcess
//snippet-end:[athena.kotlin.StartQueryExample.import]

/**
To run this Kotlin code example, ensure that you have setup your development environment,
including your credentials.

For information, see this documentation topic:
https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html
 */

suspend fun main(args:Array<String>) {

    val usage = """
    Usage:
        <queryString> <database> <outputLocation>

    Where:
        queryString - the query string to use (for example, "SELECT * FROM mydatabase"; ).
        database - the name of the database to use (for example, mydatabase ).
        outputLocation - the output location (for example, the name of an Amazon S3 bucket - s3://mybucket). 
        
    """
{'fraction_non_alphanumeric': 0.10486059708857637, 'fraction_numerical': 0.005921539600296077, 'mean_word_length': 4.622746185852982, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4827561', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1242, 'n_words': 273}