This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var x layouttest | |
| var y compactyouttest | |
| fmt.Printf("Int alignment %v \n", unsafe.Alignof(10)) | |
| fmt.Printf("Int8 aligment %v \n", unsafe.Alignof(int8(10))) | |
| fmt.Printf("Int16 aligment %v \n", unsafe.Alignof(int16(10))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Create Alias for int type | |
| type RichInt int | |
| func main() { | |
| var ri RichInt | |
| ri = 100 | |
| fmt.Println("Value of rich int", ri) | |
| fmt.Println("Convert to Int", int(ri)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var value int | |
| var f float64 | |
| var b bool | |
| var by byte | |
| var name string | |
| var x rune | |
| //Variable are declared and initialized by compiler to ZERO VALUE of its type | |
| //https://golang.org/ref/spec#The_zero_value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private def mergeValues(value1: GroupByValue, value2: GroupByValue): GroupByValue = { | |
| if (value2.days.size > value1.days.size) { | |
| value2.count = value1.count + value2.count | |
| value1.days.foreach(d => value2.days.add(d)) | |
| value2 | |
| } | |
| else { | |
| value1.count = value1.count + value2.count | |
| value2.days.foreach(d => value1.days.add(d)) | |
| value1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private def mergeValues(value1: (Int, mutable.Set[Int]), value2: (Int, mutable.Set[Int])): (Int, mutable.Set[Int]) = { | |
| val newCount = value1._1 + value2._1 | |
| val dates = value1._2 | |
| dates.foreach(d => value2._2.add(d)) | |
| (newCount, value2._2) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val issueDate = LocalDate.parse(row(aggFieldsOffset.get("issue date").get), ISSUE_DATE_FORMAT) | |
| val issueDateValues = mutable.Set[Int]() | |
| issueDateValues.add(issueDate.toEpochDay.toInt) | |
| result = (fieldOffset.map(fieldInfo => row(fieldInfo._2)).mkString(","), (1, issueDateValues)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aggValue.map { | |
| case (key, value) => Array(key, value._1, value._2.mkString(",")).mkString("\t") | |
| }.saveAsTextFile(s"/data/output/${now}", classOf[GzipCodec]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aggValue.map { | |
| case (key, value) => Array(key, value._1, value._2.mkString(",")).mkString("\t") | |
| }.saveAsTextFile(s"/data/output/${now}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INFO: ssl initialised in ${jetty.base}/start.d/ssl.ini (created) | |
| INFO: ssl enabled in /data/segmentation/segplat-deployments/app/application_secure/bin/${jetty.base}/start.d/ssl.ini | |
| INFO: server initialised in ${jetty.base}/start.ini | |
| INFO: server enabled in ${jetty.base}/start.ini | |
| INFO: server enabled in <transitive> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val topXNumbers = randomNumbers | |
| .filter(_ > 1000) //Stage 1 | |
| .map(value => (value, 1)) // Stage 1 | |
| .groupByKey() //Stage 2 | |
| .map(value => (value._1, value._2.sum)) //Stage 2 | |
| .sortBy(_._2, false) //Stage 3 | |
| .count() // Stage 3 |