Allow User Provided Pushdowns In SparkSQL

Description

Provides an interface for users to submit their own pushdown rules. This will be useful for those who want to modify the basic rules provided by the connector based on their integrations with other technologies like Solr etc ...

We should allow a parameter like

spark.cassandra.connector.sql.pushdown.additionalclasses="class,class,class"

Where these classes implement an interface

case class AnalyzedPredicates[Predicate : PredicateOps]( handledByCassandra: Set[Predicate], handledBySpark: Set[Predicate] ) trait CassandraPredicateRules{ def applyRules[T](predicates: AnalyzedPredicates[T], tableDef: TableDef): AnalyzedPredicates[T] }

Then when we determine our filters we just do

private[connector] def predicatePushDown(filters: Array[Filter]) = { /** Apply built in rules **/ val bcpp = new BasicCassandraPredicatePushDown(filters.toSet, tableDef) val basicPushdown = AnalyzedPredicates(bcpp.predicatesToPushDown, bcpp.predicatesToPreserve) logInfo(s"Basic Rules Applied: $basicPushdown") /** Apply any user defined rules **/ val additionalRules: List[CassandraPredicateRules] = List.empty additionalRules.foldRight(basicPushdown)( (rules, pushdowns) => rules.applyRules(pushdowns, tableDef) ) }

Pull Requests

https://github.com/datastax/spark-cassandra-connector/pull/908

Activity

Show:

Russell Spitzer February 2, 2016 at 12:14 AM

Followed all your comments and merged

Jacek February 1, 2016 at 12:21 PM

I reviewed, just few minor comments, go ahead with this ticket once you take a look.

Fixed

Details

Assignee

Reporter

Reviewer

Components

Fix versions

Priority

Created December 30, 2015 at 10:13 PM
Updated February 2, 2016 at 6:05 AM
Resolved February 2, 2016 at 12:16 AM

Flag notifications