python - Server side filtering of spark-cassandra on PySpark -


i new spark , want know more operation when cooperating cassandra.

i have been reminded server side filtering in of tutorials , totally understand importance of doing so.

yet tutorials either based on scala or pyspark_cassandra, , none of them using pyspark.

just curious if following scriptlet doing server side filtering or not.

given sparkconf object conf:

sc = pyspark.sparkcontext(conf=conf)  sqlcontext = sqlcontext(sc) df = (sqlcontext.read.format("org.apache.spark.sql.cassandra")     .options(keyspace="ks", table="tbl").load())  df.filter("id = 1234").show() 

in addition, did load entire table spark cluster filtering in case?

cassandra connector supports predicate pushdown on spark dataframes long pushdown enabled can safely assume basic filters executed on cassandra side. may not complex predicates. if you're in doubt best check basiccassandrapredicatepushdown docstrings.

you can check execution plan (explain). if predict pushed-down should listed in pushedfilters section example:

df = (sqlcontext   .read   .format("org.apache.spark.sql.cassandra")   .options(table="words", keyspace="test")   .load())  df.select("word").where(col("word") == "bar").explain() ## == physical plan == ## scan org.apache.spark.sql.cassandra.cassandrasourcerelation@62738171[word#0]  ## ... pushedfilters: [equalto(word,bar)] 

in spark 1.6 pushedfilters explanation little misleading. list filters datasource has been shown won't tell ones datasource used. in case it's best see if explain plan has seperate filter step predicate. if connector did not pushdown predicated. if didn't, predicate pushed.

another option turn on info/debug logging spark cassandra connector see connector doing in catalyst


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -