Search
 
SCRIPT & CODE EXAMPLE
 

SCALA

repartition in spark scala


rdd1.saveAsTextFile("/tmp/partition")
//Writes 6 part files, one for each partition
Partition 1 : 0 1 2
Partition 2 : 3 4 5
Partition 3 : 6 7 8 9
Partition 4 : 10 11 12
Partition 5 : 13 14 15
Partition 6 : 16 17 18 19
Comment

repartition in spark scala


  val spark:SparkSession = SparkSession.builder()
    .master("local[5]")
    .appName("SparkByExamples.com")
    .getOrCreate()

 val df = spark.range(0,20)
 println(df.rdd.partitions.length)

 df.write.mode(SaveMode.Overwrite)csv("partition.csv")
Comment

PREVIOUS NEXT
Code Example
Scala :: currying scala 
Actionscript :: microsoft.visualstudio.web.codegeneration.design 3.1.0 
Actionscript :: read pdf web on android 
Actionscript :: truncate restart identity - syntax error at or near "identity" 
Actionscript :: dig WWW.EXAMPLE.COM +nostats +nocomments +nocmd 
Excel :: google sheets convert abbreviation of month to number 
Excel :: google sheets count dates that fall within date range 
Excel :: or function in excel 
Excel :: Date and Time maths with Excel 
Perl :: perl read file 
Perl :: perl make a new directory and change permissions 
Pascal :: take console input in pascal 
Pascal :: pascal while 
Powershell :: powershell display firewall rules name 
Powershell :: How to save Jira attachments using powershell 
Clojure :: how to make a range clojure 
Lisp :: random choice from list of strings in emacs lisp 
Assembly :: x86 assembly hello world 
Assembly :: keyevent to char 
Assembly :: smt32f429 timer free running 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: alphabet array 
Javascript :: javascript remover acentos 
Javascript :: javascript string to dou 
Javascript :: enable button jquery 
Javascript :: java script converting text to slug 
Javascript :: flash input 
Javascript :: jquery select checked radio button value 
Javascript :: jquery preventdefault 
Javascript :: react native position absolute center 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =