All Products
Search
Document Center

Time Series Database:Query.Builder

Last Updated:Mar 28, 2026

com.aliyun.hitsdb.client.value.request.Query.Builder

public static class Query.Builder extends Object

Query.Builder constructs a Query object that defines the time range and subqueries for a data query. Call build() at the end of the chain to get the Query instance.

Typical usage:

Query query = new Query.Builder(1609459200000L)
    .end(1609462800000L)
    .sub(subQuery)
    .build();

Constructors

ConstructorDescription
Builder(long startTime)Creates a builder with the specified start time.
Builder(long startTime, long endTime)Creates a builder with both start and end times.

Parameters:

ParameterTypeRequiredDescription
startTimelongYesStart of the time range.
endTimelongNo (constructor 2 only)End of the time range.

Constructor details

public Builder(long startTime)

Creates a builder with the specified start time.

public Builder(long startTime, long endTime)

Creates a builder with both start and end times.

Methods

Return typeMethodDescription
Querybuild()Builds and returns the Query instance.
Query.Builderend(long endTime)Sets the end of the time range.
Query.Buildersub(SubQuery... subQuerys)Adds one or more SubQuery objects.
Query.Buildersub(Collection<SubQuery> subQuerys)Adds a collection of SubQuery objects.
Query.Builderdelete()Specifies to delete the queried data. Currently unavailable.
Query.Builderdelete(boolean delete)Specifies to delete the queried data. Currently unavailable.

Method details

build()

public Query build()

Builds and returns the Query instance. Call this as the last step in the builder chain.

end(long endTime)

public Query.Builder end(long endTime)

Sets the end of the time range.

sub(SubQuery... subQuerys)

public Query.Builder sub(SubQuery... subQuerys)

Adds one or more SubQuery objects to the query.

sub(Collection<SubQuery> subQuerys)

public Query.Builder sub(Collection<SubQuery> subQuerys)

Adds a collection of SubQuery objects to the query. Use this overload when you have subqueries stored in a List or other Collection.

delete() and delete(boolean delete)

public Query.Builder delete()
public Query.Builder delete(boolean delete)
These methods specify deletion of the queried data and are currently unavailable. Do not use them.

Methods inherited from java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait