首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用aws-java-sdk版本1获取雅典娜查询扫描的数据量?

如何使用aws-java-sdk版本1获取雅典娜查询扫描的数据量?
EN

Stack Overflow用户
提问于 2021-11-11 21:45:43
回答 1查看 59关注 0票数 0

我正在使用aws-java-sdk版本1.11.573调用Athena,以使用Groovy执行查询:

代码语言:javascript
复制
        def queryExecutionContext = new QueryExecutionContext().withDatabase(AthenaConstants.ATHENA_DATABASE)
        def resultConfiguration = new ResultConfiguration().withOutputLocation("s3://${resultBucket}")
        def startQueryExecutionRequest = new StartQueryExecutionRequest()
            .withQueryString(query)
            .withQueryExecutionContext(queryExecutionContext)
            .withResultConfiguration(resultConfiguration)

        def startQueryExecutionResult = amazonAthena.startQueryExecution(startQueryExecutionRequest)

def queryExecutionId = startQueryExecutionResult.getQueryExecutionId()
        def queryStatusRequest = new GetQueryExecutionRequest().withQueryExecutionId(queryExecutionId)
        Awaitility.await("Athena query ${queryExecutionId}")
                  .pollInterval(new org.awaitility.Duration(pollingPeriod.toMillis(), TimeUnit.MILLISECONDS))
                  .atMost(timeout.toMillis(), TimeUnit.MILLISECONDS)
                  .until { hasQuerySucceeded(queryStatusRequest) }
        def getQueryResultsRequest = new GetQueryResultsRequest().withQueryExecutionId(queryExecutionId)
        GetQueryResultsResult getQueryResultsResult = amazonAthena.getQueryResults(getQueryResultsRequest)
List<Row> results = getQueryResultsResult.getResultSet().getRows()

我希望扫描数据量,以便可以将其记录为指标,以便可以轻松地对其进行监控。

我相信用gversion2做这件事很简单,但我现在不能真正升级。

有没有人知道如何获得这个指标?

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2021-11-12 00:08:33

Java不是推荐使用V1的方式。然而,你可以在这里参考这个非常老的例子:

https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/gov2/s3/CreateBucket/CreateBucketv2_test.go

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69935304

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档