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
| /* | |
| Nodejs is javascript engine from Chrome V8 Engine . | |
| Which runs javascript code in the backend | |
| node js is non blocking io module ie., if any lines takes more time , than the cpu does not block other lines and continues execution of other lines | |
| npm - package manager for js .Similar to pip in python | |
| Note: Never push node module dependencies to Git as it is huge | |
| docs: all functions in npm is | |
| - https://nodejs.org/dist/latest-v17.x/docs/api/ | |
| - https://nodejs.dev/learn/introduction-to-nodejs |
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
| import org.apache.spark.sql.SparkSession | |
| import org.apache.spark.sql.functions._ | |
| val spark=SparkSession | |
| .builder() | |
| .master("local") | |
| .appName("local") | |
| .getOrCreate() | |
| import spark.implicits._ |
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
| trait Activities | |
| case class PersonWalk(km:Float) extends Activities | |
| case class PersonTalk(words:String) extends Activities | |
| class CompanionPerson { | |
| val perform:PartialFunction[Activities,Unit]= { | |
| case PersonWalk(km) => println(km) |
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
| trait Activities | |
| case class PersonWalk(km:Float) extends Activities | |
| case class PersonTalk(words:String) extends Activities | |
| class CompanionPerson { | |
| def perform(act:Activities)= { | |
| act match{ | |
| case PersonWalk(km) => println(km) | |
| case PersonTalk(words) => println(words) |
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
| class Person: | |
| def __init__(self,name): | |
| self.name=name | |
| import json #yaml | |
| v='{"name":"deepak"}' | |
| j=json.loads(v) | |
| person=Person(**j) |
NewerOlder