9619

java.lang.IllegalStateException: Must specify a valid bucketing strategy while requesting aggregatio

Question:

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();

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

Answer1:

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

.bucketByTime(1, TimeUnit.HOURS)

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.

Recommend

  • How do I configure spring-kafka to ignore messages in the wrong format?
  • Retrofit Periodic call with Pagination
  • Guava CacheBuilder: imply additional conditions to entity removal
  • Wait between tasks with SingleThreadExecutor
  • Selenium WebDriver setting ImplicitlyWait does nothing
  • Why direct memory 'array' is slower to clear than a usual Java array?
  • AJAX response time
  • Convert int 60 to a time value of 60 minutes
  • spawn random images in canvas in javascript
  • Websocket interval: performance problems on mobile devices?
  • How to acces variable in arrayadapter getView from onItemClick
  • MySQL: select last full 5 minute interval
  • SoX running slow using a ProcessBuilder
  • View Azure WebJob Schedule in Portal?
  • How to implement a filter from another stream using RxJava
  • Should try-catch be avoided for known cases
  • Get both date and time in milliseconds
  • LINQ to Entities does not recognize the method 'Int64 Max(Int64, Int64)' method, and this
  • JFreeChart heap space
  • countdown bar android example
  • calculate gradient output for Theta update rule
  • Remove changes from one element when event occurs on another element?
  • Zoom in and out of jPanel
  • Generate random number from custom distribution
  • Firefox Extension - Monitor refresh and change of tab
  • Remove final comma from string in vb.net
  • Declaring variable dynamically in VB.net
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • azure media services - The request body is too large and exceeds the maximum permissible limit
  • Sencha Touch 2.0 Controller refs attribute not working?
  • Play WS (2.2.1): post/put large request
  • Get data from AJAX - How to
  • Initializer list vs. initialization method
  • Spring security and special characters
  • Trying to switch camera back to front but getting exception
  • Large data - storage and query
  • Acquiring multiple attributes from .xml file in c#
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Programmatically clearing map cache