Sliding function in spark

0 votes

Can you please let me know what is the use of the sliding function in spark with a small example? I have read from many sites but didn't get the basic understanding that why we use this function.

Jan 29, 2019 in Apache Spark by Suman
618 views

1 answer to this question.

0 votes

The sliding function is used when you want to have windows to be of a length different than what you slide by. Also sliding is more preferable in such a situation rather than grouping. 

The Sliding function results in an RDD from grouping items of its parent RDD in fixed size block by passing window over them. A window operator is defined by two parameters:-

  •  WindowDuration - the length of the window
  •  SlideDuration - the interval at which the window will slide or move forward

The Signature for the sliding function is as follows:

def sliding(n: Int, step: Int = 1): Repr[immutable.Seq[Out]]
answered Jan 29, 2019 by Omkar
• 69,020 points

Related Questions In Apache Spark

+2 votes
4 answers

use length function in substring in spark

You can use the function expr val data ...READ MORE

answered May 3, 2018 in Apache Spark by kurt_cobain
• 9,310 points
27,589 views
0 votes
11 answers

How to create new column with function in Spark Dataframe?

val coder: (Int => String) = v ...READ MORE

answered Apr 4, 2019 in Apache Spark by anonymous

edited Apr 5, 2019 by Omkar 54,268 views
0 votes
1 answer

Difference between map() and mapPartitions() function in Spark??

Hi@ akhtar, Both map() and mapPartitions() are the ...READ MORE

answered Jan 29 in Apache Spark by MD
• 42,980 points
1,413 views
0 votes
1 answer

Changing Column position in spark dataframe

Yes, you can reorder the dataframe elements. You need ...READ MORE

answered Apr 19, 2018 in Apache Spark by Ashish
• 2,630 points
8,092 views
+1 vote
2 answers
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
5,516 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
814 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
34,211 views
–1 vote
1 answer

Not able to use sc in spark shell

Seems like master and worker are not ...READ MORE

answered Jan 3, 2019 in Apache Spark by Omkar
• 69,020 points
422 views
0 votes
1 answer

Invalid syntax in spark

There's a problem with your syntax. There ...READ MORE

answered Jan 31, 2019 in Apache Spark by Omkar
• 69,020 points
196 views