scala - Skip/Take with Spark SQL -
how 1 go implementing skip/take query (typical server side grid paging) using spark sql. have scoured net , can find basic examples such these here: https://databricks-training.s3.amazonaws.com/data-exploration-using-spark-sql.html
i don't see concept of row_number() or offset/fetch t-sql. know how accomplish this?
something like:
scala > csc.sql("select * users skip 10 limit 10").collect()
try this:
val rdd = csc.sql("select * <keyspace>.<table>") val rdd2 = rdd.view.zipwithindex() rdd2.filter(x => { x._2 > 5 && x._2 < 10;}).collect() rdd2.filter(x => { x._2 > 9 && x._2 < 12;}).collect()
Comments
Post a Comment