javax.ws.rs.QueryParam Scala Examples
The following examples show how to use javax.ws.rs.QueryParam.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: ApplicationListResource.scala From drizzle-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam, @QueryParam("limit") limit: Integer) : Iterator[ApplicationInfo] = { val numApps = Option(limit).map(_.toInt).getOrElse(Integer.MAX_VALUE) val includeCompleted = status.isEmpty || status.contains(ApplicationStatus.COMPLETED) val includeRunning = status.isEmpty || status.contains(ApplicationStatus.RUNNING) uiRoot.getApplicationInfoList.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running; // keep the app if *any* attempts fall in the right time window ((!anyRunning && includeCompleted) || (anyRunning && includeRunning)) && app.attempts.exists { attempt => val start = attempt.startTime.getTime start >= minDate.timestamp && start <= maxDate.timestamp } }.take(numApps) } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, coresGranted = None, maxCores = None, coresPerExecutor = None, memoryPerExecutorMB = None, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), duration = if (internalAttemptInfo.endTime > 0) { internalAttemptInfo.endTime - internalAttemptInfo.startTime } else { 0 }, lastUpdated = new Date(internalAttemptInfo.lastUpdated), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } }
Example 2
Source File: DatasetControllerAPI.scala From daf with BSD 3-Clause "New" or "Revised" License | 5 votes |
package api import daf.dataset.query.Query import io.swagger.annotations._ import javax.ws.rs.QueryParam import play.api.mvc.{ Action, AnyContent } @Api(value = "dataset-manager") trait DatasetControllerAPI { @ApiOperation( value = "Get a dataset based on the dataset id", produces = "application/json", httpMethod = "GET", authorizations = Array(new Authorization(value = "basicAuth")), protocols = "https, http" ) def getSchema(@ApiParam(value = "the uri to access the dataset", required = true) uri: String): Action[AnyContent] @ApiOperation( value = "Get a dataset based on the dataset id", produces = "application/json", httpMethod = "GET", authorizations = Array(new Authorization(value = "basicAuth")), protocols = "https, http" ) def getDataset(@ApiParam(value = "the uri to access the dataset", required = true) uri: String, @ApiParam(value = "the format the downloaded data should be converted", required = false, defaultValue = "json") @QueryParam("format") format: String, @ApiParam(value = "the method used to perform the data conversions", required = false, defaultValue = "quick") @QueryParam("method") method: String, @ApiParam(value = "the maximum number of rows returned by this request", required = false) @QueryParam("limit") limit: Option[Int]): Action[AnyContent] @ApiOperation( value = "Get a dataset based on the dataset id", produces = "application/json", consumes = "application/json", httpMethod = "POST", authorizations = Array(new Authorization(value = "basicAuth")), protocols = "https, http" ) @ApiImplicitParams(Array( new ApiImplicitParam( name = "query", value = "A valid query", required = true, dataType = "daf.dataset.Query", paramType = "body" ) )) def queryDataset(@ApiParam(value = "the uri to access the dataset", required = true) uri: String, @ApiParam(value = "the format the downloaded data should be converted", required = false, defaultValue = "json") @QueryParam("format") format: String, @ApiParam(value = "the method used to perform the data conversions", required = false, defaultValue = "quick") @QueryParam("method") method: String): Action[Query] }
Example 3
Source File: KuduServiceLayer.scala From Taxi360 with Apache License 2.0 | 5 votes |
package com.hadooparchitecturebook.taxi360.server.kudu import javax.ws.rs.core.MediaType import javax.ws.rs.{QueryParam, _} import com.hadooparchitecturebook.taxi360.model.{NyTaxiYellowEntity, NyTaxiYellowEntityBuilder, NyTaxiYellowTrip, NyTaxiYellowTripBuilder} import org.apache.kudu.client.KuduPredicate import scala.collection.mutable @Path("rest") class KuduServiceLayer { @GET @Path("hello") @Produces(Array(MediaType.TEXT_PLAIN)) def hello(): String = { "Hello World" } @GET @Path("vender/{venderId}") @Produces(Array(MediaType.APPLICATION_JSON)) def getTaxiEntity (@PathParam("venderId") venderId:String): NyTaxiYellowEntity = { val kuduClient = KuduGlobalValues.kuduClient val custTable = KuduGlobalValues.kuduClient.openTable(KuduGlobalValues.accountMartTableName) val schema = custTable.getSchema val venderIdCol = schema.getColumn("vender_id") val scanner = kuduClient.newScannerBuilder(custTable). addPredicate(KuduPredicate. newComparisonPredicate(venderIdCol, KuduPredicate.ComparisonOp.EQUAL, venderId)). build() var taxiEntity:NyTaxiYellowEntity = null while (scanner.hasMoreRows) { val rows = scanner.nextRows() while (rows.hasNext) { val rowResult = rows.next() taxiEntity = NyTaxiYellowEntityBuilder.build(rowResult) } } taxiEntity } @GET @Path("vender/ts/{venderId}") @Produces(Array(MediaType.APPLICATION_JSON)) def getVenderTrips (@PathParam("venderId") venderId:String, @QueryParam("startTime") startTime:Long = Long.MaxValue, @QueryParam("endTime") endTime:Long = Long.MinValue): Array[NyTaxiYellowTrip] = { val kuduClient = KuduGlobalValues.kuduClient val custTable = KuduGlobalValues.kuduClient.openTable(KuduGlobalValues.appEventTableName) val schema = custTable.getSchema val venderIdCol = schema.getColumn("venderId") val pickupDatetimeCol = schema.getColumn("tpep_pickup_datetime") val scanner = kuduClient.newScannerBuilder(custTable). addPredicate(KuduPredicate. newComparisonPredicate(venderIdCol, KuduPredicate.ComparisonOp.EQUAL, venderId)). addPredicate(KuduPredicate. newComparisonPredicate(pickupDatetimeCol, KuduPredicate.ComparisonOp.GREATER, startTime)). addPredicate(KuduPredicate. newComparisonPredicate(pickupDatetimeCol, KuduPredicate.ComparisonOp.LESS, endTime)). batchSizeBytes(1000000).build() val appEventList = new mutable.MutableList[NyTaxiYellowTrip] while (scanner.hasMoreRows) { println("-") val rows = scanner.nextRows() while (rows.hasNext) { println("--") val rowResult = rows.next() val appEvent = NyTaxiYellowTripBuilder.build(rowResult) appEventList += appEvent } } appEventList.toArray } }
Example 4
Source File: ApplicationListResource.scala From sparkoscope with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam, @QueryParam("limit") limit: Integer) : Iterator[ApplicationInfo] = { val numApps = Option(limit).map(_.toInt).getOrElse(Integer.MAX_VALUE) val includeCompleted = status.isEmpty || status.contains(ApplicationStatus.COMPLETED) val includeRunning = status.isEmpty || status.contains(ApplicationStatus.RUNNING) uiRoot.getApplicationInfoList.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running; // keep the app if *any* attempts fall in the right time window ((!anyRunning && includeCompleted) || (anyRunning && includeRunning)) && app.attempts.exists { attempt => val start = attempt.startTime.getTime start >= minDate.timestamp && start <= maxDate.timestamp } }.take(numApps) } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, coresGranted = None, maxCores = None, coresPerExecutor = None, memoryPerExecutorMB = None, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), duration = if (internalAttemptInfo.endTime > 0) { internalAttemptInfo.endTime - internalAttemptInfo.startTime } else { 0 }, lastUpdated = new Date(internalAttemptInfo.lastUpdated), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } }
Example 5
Source File: ApplicationListResource.scala From multi-tenancy-spark with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam, @QueryParam("limit") limit: Integer) : Iterator[ApplicationInfo] = { val numApps = Option(limit).map(_.toInt).getOrElse(Integer.MAX_VALUE) val includeCompleted = status.isEmpty || status.contains(ApplicationStatus.COMPLETED) val includeRunning = status.isEmpty || status.contains(ApplicationStatus.RUNNING) uiRoot.getApplicationInfoList.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running; // keep the app if *any* attempts fall in the right time window ((!anyRunning && includeCompleted) || (anyRunning && includeRunning)) && app.attempts.exists { attempt => val start = attempt.startTime.getTime start >= minDate.timestamp && start <= maxDate.timestamp } }.take(numApps) } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, coresGranted = None, maxCores = None, coresPerExecutor = None, memoryPerExecutorMB = None, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), duration = if (internalAttemptInfo.endTime > 0) { internalAttemptInfo.endTime - internalAttemptInfo.startTime } else { 0 }, lastUpdated = new Date(internalAttemptInfo.lastUpdated), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } }
Example 6
Source File: ApplicationListResource.scala From iolap with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Arrays, Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo import org.apache.spark.deploy.master.{ApplicationInfo => InternalApplicationInfo} @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam) : Iterator[ApplicationInfo] = { val allApps = uiRoot.getApplicationInfoList val adjStatus = { if (status.isEmpty) { Arrays.asList(ApplicationStatus.values(): _*) } else { status } } val includeCompleted = adjStatus.contains(ApplicationStatus.COMPLETED) val includeRunning = adjStatus.contains(ApplicationStatus.RUNNING) allApps.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running val statusOk = (!anyRunning && includeCompleted) || (anyRunning && includeRunning) // keep the app if *any* attempts fall in the right time window val dateOk = app.attempts.exists { attempt => attempt.startTime.getTime >= minDate.timestamp && attempt.startTime.getTime <= maxDate.timestamp } statusOk && dateOk } } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } def convertApplicationInfo( internal: InternalApplicationInfo, completed: Boolean): ApplicationInfo = { // standalone application info always has just one attempt new ApplicationInfo( id = internal.id, name = internal.desc.name, attempts = Seq(new ApplicationAttemptInfo( attemptId = None, startTime = new Date(internal.startTime), endTime = new Date(internal.endTime), sparkUser = internal.desc.user, completed = completed )) ) } }
Example 7
Source File: ApplicationListResource.scala From spark1.52 with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Arrays, Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo import org.apache.spark.deploy.master.{ApplicationInfo => InternalApplicationInfo} @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam) : Iterator[ApplicationInfo] = { val allApps = uiRoot.getApplicationInfoList val adjStatus = { if (status.isEmpty) { //可变参数时不能直接传入Range或集合或数组对象,需要使用:_*转换才可传入 Arrays.asList(ApplicationStatus.values(): _*) } else { status } } val includeCompleted = adjStatus.contains(ApplicationStatus.COMPLETED) val includeRunning = adjStatus.contains(ApplicationStatus.RUNNING) allApps.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running //如果有任何尝试仍在运行,我们认为该应用仍然在运行 val statusOk = (!anyRunning && includeCompleted) || (anyRunning && includeRunning) // keep the app if *any* attempts fall in the right time window //如果*任何*尝试落在正确的时间窗口,请保留应用程序 val dateOk = app.attempts.exists { attempt => attempt.startTime.getTime >= minDate.timestamp && attempt.startTime.getTime <= maxDate.timestamp } statusOk && dateOk } } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } def convertApplicationInfo( internal: InternalApplicationInfo, completed: Boolean): ApplicationInfo = { // standalone application info always has just one attempt //独立的应用信息总是只有一个尝试 new ApplicationInfo( id = internal.id, name = internal.desc.name, attempts = Seq(new ApplicationAttemptInfo( attemptId = None, startTime = new Date(internal.startTime), endTime = new Date(internal.endTime), sparkUser = internal.desc.user, completed = completed )) ) } }
Example 8
Source File: ApplicationListResource.scala From Spark-2.3.1 with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource extends ApiRequestContext { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam, @DefaultValue("2010-01-01") @QueryParam("minEndDate") minEndDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxEndDate") maxEndDate: SimpleDateParam, @QueryParam("limit") limit: Integer) : Iterator[ApplicationInfo] = { val numApps = Option(limit).map(_.toInt).getOrElse(Integer.MAX_VALUE) val includeCompleted = status.isEmpty || status.contains(ApplicationStatus.COMPLETED) val includeRunning = status.isEmpty || status.contains(ApplicationStatus.RUNNING) uiRoot.getApplicationInfoList.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running; // keep the app if *any* attempts fall in the right time window ((!anyRunning && includeCompleted) || (anyRunning && includeRunning)) && app.attempts.exists { attempt => isAttemptInRange(attempt, minDate, maxDate, minEndDate, maxEndDate, anyRunning) } }.take(numApps) } private def isAttemptInRange( attempt: ApplicationAttemptInfo, minStartDate: SimpleDateParam, maxStartDate: SimpleDateParam, minEndDate: SimpleDateParam, maxEndDate: SimpleDateParam, anyRunning: Boolean): Boolean = { val startTimeOk = attempt.startTime.getTime >= minStartDate.timestamp && attempt.startTime.getTime <= maxStartDate.timestamp // If the maxEndDate is in the past, exclude all running apps. val endTimeOkForRunning = anyRunning && (maxEndDate.timestamp > System.currentTimeMillis()) val endTimeOkForCompleted = !anyRunning && (attempt.endTime.getTime >= minEndDate.timestamp && attempt.endTime.getTime <= maxEndDate.timestamp) val endTimeOk = endTimeOkForRunning || endTimeOkForCompleted startTimeOk && endTimeOk } }
Example 9
Source File: ApplicationListResource.scala From BigDatalog with Apache License 2.0 | 5 votes |
package org.apache.spark.status.api.v1 import java.util.{Arrays, Date, List => JList} import javax.ws.rs.{DefaultValue, GET, Produces, QueryParam} import javax.ws.rs.core.MediaType import org.apache.spark.deploy.history.ApplicationHistoryInfo import org.apache.spark.deploy.master.{ApplicationInfo => InternalApplicationInfo} @Produces(Array(MediaType.APPLICATION_JSON)) private[v1] class ApplicationListResource(uiRoot: UIRoot) { @GET def appList( @QueryParam("status") status: JList[ApplicationStatus], @DefaultValue("2010-01-01") @QueryParam("minDate") minDate: SimpleDateParam, @DefaultValue("3000-01-01") @QueryParam("maxDate") maxDate: SimpleDateParam) : Iterator[ApplicationInfo] = { val allApps = uiRoot.getApplicationInfoList val adjStatus = { if (status.isEmpty) { Arrays.asList(ApplicationStatus.values(): _*) } else { status } } val includeCompleted = adjStatus.contains(ApplicationStatus.COMPLETED) val includeRunning = adjStatus.contains(ApplicationStatus.RUNNING) allApps.filter { app => val anyRunning = app.attempts.exists(!_.completed) // if any attempt is still running, we consider the app to also still be running val statusOk = (!anyRunning && includeCompleted) || (anyRunning && includeRunning) // keep the app if *any* attempts fall in the right time window val dateOk = app.attempts.exists { attempt => attempt.startTime.getTime >= minDate.timestamp && attempt.startTime.getTime <= maxDate.timestamp } statusOk && dateOk } } } private[spark] object ApplicationsListResource { def appHistoryInfoToPublicAppInfo(app: ApplicationHistoryInfo): ApplicationInfo = { new ApplicationInfo( id = app.id, name = app.name, coresGranted = None, maxCores = None, coresPerExecutor = None, memoryPerExecutorMB = None, attempts = app.attempts.map { internalAttemptInfo => new ApplicationAttemptInfo( attemptId = internalAttemptInfo.attemptId, startTime = new Date(internalAttemptInfo.startTime), endTime = new Date(internalAttemptInfo.endTime), sparkUser = internalAttemptInfo.sparkUser, completed = internalAttemptInfo.completed ) } ) } def convertApplicationInfo( internal: InternalApplicationInfo, completed: Boolean): ApplicationInfo = { // standalone application info always has just one attempt new ApplicationInfo( id = internal.id, name = internal.desc.name, coresGranted = Some(internal.coresGranted), maxCores = internal.desc.maxCores, coresPerExecutor = internal.desc.coresPerExecutor, memoryPerExecutorMB = Some(internal.desc.memoryPerExecutorMB), attempts = Seq(new ApplicationAttemptInfo( attemptId = None, startTime = new Date(internal.startTime), endTime = new Date(internal.endTime), sparkUser = internal.desc.user, completed = completed )) ) } }
Example 10
Source File: KuduServiceLayer.scala From Taxi360 with Apache License 2.0 | 5 votes |
package com.cloudera.sa.taxi360.server.kudu import javax.ws.rs.core.MediaType import javax.ws.rs.{QueryParam, _} import com.cloudera.sa.taxi360.model.{NyTaxiYellowEntity, NyTaxiYellowEntityBuilder, NyTaxiYellowTrip, NyTaxiYellowTripBuilder} import org.apache.kudu.client.KuduPredicate import scala.collection.mutable @Path("rest") class KuduServiceLayer { @GET @Path("hello") @Produces(Array(MediaType.TEXT_PLAIN)) def hello(): String = { "Hello World" } @GET @Path("vender/{venderId}") @Produces(Array(MediaType.APPLICATION_JSON)) def getTaxiEntity (@PathParam("venderId") venderId:String): NyTaxiYellowEntity = { val kuduClient = KuduGlobalValues.kuduClient val custTable = KuduGlobalValues.kuduClient.openTable(KuduGlobalValues.accountMartTableName) val schema = custTable.getSchema val venderIdCol = schema.getColumn("vender_id") val scanner = kuduClient.newScannerBuilder(custTable). addPredicate(KuduPredicate. newComparisonPredicate(venderIdCol, KuduPredicate.ComparisonOp.EQUAL, venderId)). build() var taxiEntity:NyTaxiYellowEntity = null while (scanner.hasMoreRows) { val rows = scanner.nextRows() while (rows.hasNext) { val rowResult = rows.next() taxiEntity = NyTaxiYellowEntityBuilder.build(rowResult) } } taxiEntity } @GET @Path("vender/ts/{venderId}") @Produces(Array(MediaType.APPLICATION_JSON)) def getVenderTrips (@PathParam("venderId") venderId:String, @QueryParam("startTime") startTime:Long = Long.MaxValue, @QueryParam("endTime") endTime:Long = Long.MinValue): Array[NyTaxiYellowTrip] = { val kuduClient = KuduGlobalValues.kuduClient val custTable = KuduGlobalValues.kuduClient.openTable(KuduGlobalValues.appEventTableName) val schema = custTable.getSchema val venderIdCol = schema.getColumn("venderId") val pickupDatetimeCol = schema.getColumn("tpep_pickup_datetime") val scanner = kuduClient.newScannerBuilder(custTable). addPredicate(KuduPredicate. newComparisonPredicate(venderIdCol, KuduPredicate.ComparisonOp.EQUAL, venderId)). addPredicate(KuduPredicate. newComparisonPredicate(pickupDatetimeCol, KuduPredicate.ComparisonOp.GREATER, startTime)). addPredicate(KuduPredicate. newComparisonPredicate(pickupDatetimeCol, KuduPredicate.ComparisonOp.LESS, endTime)). batchSizeBytes(1000000).build() val appEventList = new mutable.MutableList[NyTaxiYellowTrip] while (scanner.hasMoreRows) { println("-") val rows = scanner.nextRows() while (rows.hasNext) { println("--") val rowResult = rows.next() val appEvent = NyTaxiYellowTripBuilder.build(rowResult) appEventList += appEvent } } appEventList.toArray } }