java.lang.IllegalStateException:在请求聚合时必须指定有效的存储策略 [英] java.lang.IllegalStateException: Must specify a valid bucketing strategy while requesting aggregation

查看:150
本文介绍了java.lang.IllegalStateException:在请求聚合时必须指定有效的存储策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在创建读取请求对象DataReadRequest类时收到此错误.我试图查找文档,但不清楚.这是我的代码:

I get this error while I am creating a read request object DataReadRequest class. I tried to look for the documentation but it is unclear. Here is my code:

 DataReadRequest readRequest = new DataReadRequest.Builder()
            .read(DataType.TYPE_LOCATION_SAMPLE)
            .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
            .bucketByTime(1, TimeUnit.HOURS)
            .build();

错误出在bucketByTime方法中,我不知道如何继续.

The error is in bucketByTime method and I don't know how to proceed.

推荐答案

我之前遇到此错误.简短的答案是删除行

I had this error before. The short answer is to remove the line

    .bucketByTime(1, TimeUnit.HOURS)

之所以无法处理您的请求,是因为bucketByTime方法根据您请求的时间段汇总数据,但是您无法汇总所请求的数据(它是做什么的)意味着将位置样本加在一起?).实际上,所有存储方法都希望使用汇总数据类型,因为存储意味着您试图将多个数据点表示为一个数据点.

The reason why this does not work with your request is that the bucketByTime method aggregates data according to the period of time you're asking for, but the data you're requesting can't be aggregated (what does it mean to add together location samples??). In fact all the bucketing methods expect an aggregate data type because bucketing implies that you're trying to represent a number of data points as one data point.

这篇关于java.lang.IllegalStateException:在请求聚合时必须指定有效的存储策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆