Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added offset field on Scan Query #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/scala/com/ing/wbaa/druid/DruidQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ object DruidQuery {
case q: SQLQuery => q.asJsonObject.add("resultFormat", q.resultFormat.asJson).asJson
}
}

}

sealed trait DruidNativeQuery extends DruidQuery {
Expand Down Expand Up @@ -220,6 +219,7 @@ case class ScanQuery private (
columns: Iterable[String],
batchSize: Option[Int],
limit: Option[Int],
offset: Option[Int],
order: Option[Order],
legacy: Option[Boolean],
context: Map[QueryContextParam, QueryContextValue]
Expand All @@ -241,6 +241,7 @@ object ScanQuery {
filter: Option[Filter] = None,
batchSize: Option[Int] = None,
limit: Option[Int] = None,
offset: Option[Int] = None,
order: Order = OrderType.None,
context: Map[QueryContextParam, QueryContextValue] = Map.empty
)(implicit config: DruidConfig = DruidConfig.DefaultConfig): ScanQuery = {
Expand All @@ -264,6 +265,7 @@ object ScanQuery {
resultingColumns,
batchSize,
limit,
offset,
Option(order),
Option(config.scanQueryLegacyMode),
context)
Expand Down
7 changes: 7 additions & 0 deletions src/main/scala/com/ing/wbaa/druid/dql/QueryBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ final class ScanQueryBuilder private[dql] () extends QueryBuilderCommons {

private var columns: List[String] = Nil
private var limitOpt: Option[Int] = None
private var offsetOpt: Option[Int] = None
private var batchSizeOpt: Option[Int] = None
private var order: Order = OrderType.None

Expand All @@ -398,6 +399,11 @@ final class ScanQueryBuilder private[dql] () extends QueryBuilderCommons {
this
}

def offset(off: Int): this.type = {
offsetOpt = Option(off)
this
}

def batchSize(size: Int): this.type = {
batchSizeOpt = Option(size)
this
Expand All @@ -420,6 +426,7 @@ final class ScanQueryBuilder private[dql] () extends QueryBuilderCommons {
columns = this.columns,
batchSize = this.batchSizeOpt,
limit = this.limitOpt,
offset = this.offsetOpt,
order = this.order,
context = this.queryContextParams
)(conf)
Expand Down