Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
support overriding druidRelation options via sqlContext variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Harish Butani committed Jun 3, 2016
1 parent 4294698 commit 01b42d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/org/sparklinedata/druid/DruidRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class DruidRDD(sqlContext: SQLContext,
val dQuery : DruidQuery) extends RDD[InternalRow](sqlContext.sparkContext, Nil) {

val druidQueryAcc : DruidQueryExecutionMetric = new DruidQueryExecutionMetric()
val numSegmentsPerQuery = drInfo.options.numSegmentsPerHistoricalQuery(sqlContext)

@DeveloperApi
override def compute(split: Partition, context: TaskContext): Iterator[InternalRow] = {
Expand Down Expand Up @@ -129,7 +130,6 @@ class DruidRDD(sqlContext: SQLContext,
dQuery.intervalSplits
)
var idx = -1
val numSegmentsPerQuery = drInfo.options.numSegmentsPerHistoricalQuery

val l = (for(
hA <- hAssigns;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ case class DruidRelationInfo(val fullName : DruidRelationName,

def sourceDF(sqlContext : SQLContext) = sqlContext.table(sourceDFName)


}

case class DruidRelationOptions(val maxCardinality : Long,
Expand All @@ -55,7 +56,18 @@ case class DruidRelationOptions(val maxCardinality : Long,
zkDruidPath : String,
queryHistoricalServers : Boolean,
zkQualifyDiscoveryNames : Boolean,
numSegmentsPerHistoricalQuery : Int)
numSegmentsPerHistoricalQuery : Int) {

def sqlContextOption(nm : String) = s"spark.sparklinedata.druid.option.$nm"

def numSegmentsPerHistoricalQuery(sqlContext : SQLContext) : Int = {
sqlContext.getConf(
sqlContextOption("numSegmentsPerHistoricalQuery"),
numSegmentsPerHistoricalQuery.toString
).toInt
}

}

private[druid] object MappingBuilder extends Logging {

Expand Down

0 comments on commit 01b42d4

Please sign in to comment.