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 in Apache Spark by Suman
104 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 by Omkar
• 66,880 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,260 points
7,908 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 in Apache Spark by anonymous

edited Apr 5 by Omkar 11,278 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
2,971 views
0 votes
1 answer

Efficient way to read specific columns from parquet file in spark

As parquet is a column based storage ...READ MORE

answered Apr 20, 2018 in Apache Spark by kurt_cobain
• 9,260 points
847 views
0 votes
0 answers
0 votes
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
• 9,310 points
1,818 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
• 9,310 points
149 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
8,988 views
0 votes
1 answer

Not able to use sc in spark shell

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

answered Jan 3 in Apache Spark by Omkar
• 66,880 points
86 views
0 votes
1 answer

Invalid syntax in spark

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

answered Jan 31 in Apache Spark by Omkar
• 66,880 points
29 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.