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
2,446 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,210 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,390 points
41,910 views
+2 votes
14 answers

How to create new column with function in Spark Dataframe?

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

answered Apr 5, 2019 in Apache Spark by anonymous

edited Apr 5, 2019 by Omkar 87,525 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, 2020 in Apache Spark by MD
• 95,440 points
6,093 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,650 points
13,253 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
• 11,380 points
10,600 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
• 11,380 points
2,206 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
104,745 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,210 points
1,394 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,210 points
1,833 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP