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
179 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 by Omkar
• 67,480 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,240 points
12,644 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 20,647 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
4,284 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,240 points
1,227 views
0 votes
1 answer
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
• 10,670 points
2,725 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,670 points
287 views
0 votes
10 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
13,504 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 in Apache Spark by Omkar
• 67,480 points
136 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
• 67,480 points
41 views