Step 1: Signup to Databricks community edition – https://databricks.com/try-databricks. Fill in the details and you can leave your mobile number blank. Select “COMMUNITY EDITION” ==“GET STARTED“.
If you have a Cloud account then you can use it.
…
Step 1: Signup to Databricks community edition – https://databricks.com/try-databricks. Fill in the details and you can leave your mobile number blank. Select “COMMUNITY EDITION” ==“GET STARTED“.
If you have a Cloud account then you can use it.
…
Prerequisite: Extends Databricks getting started – Spark, Shell, SQL.
Q: What is a Dataframe?
A: A DataFrame is a data abstraction or a domain-specific language (DSL) for working with structured and semi-structured data,
…
Prerequisite: Extends Databricks getting started – Spark, Shell, SQL.
What is SCD Type 1
SCD stands for Slowly Changing Dimension, and it was explained in 10 Data warehouse interview Q&As.
…
Prerequisite: Extends 03: Databricks – Spark SCD Type 1. What is SCD Type 2 SCD stands for Slowly Changing Dimension, and it was explained in 10 Data warehouse interview Q&As. … Read more ›...
Prerequisite: Extends 03: Databricks – Spark SCD Type 1. What is SCD Type 1 SCD stands for Slowly Changing Dimension, and it was explained in 10 Data warehouse interview Q&As. … Read more ›...
Prerequisite: … Read more ›...
Prerequisite: Extends Databricks getting started – Spark, Shell, SQL.
What is a UDF?
User-Defined Functions (aka UDF) is a feature of Spark SQL to define new Column-based functions that extend the vocabulary of Spark SQL’s DSL for transforming Datasets.
…
Prerequisite: Extends Databricks getting started – Spark, Shell, SQL. What is a window function? Q. What are the different types of functions in Spark SQL? A. There are 4 types of functions: 1) Built-in functions: from org.apache.spark.sql. … Read more ›...
Prerequisite: Extends Databricks – Spark Window functions. Step 1: Create a new Python notebook, and attach it to a cluster. Step 2: Let’s create some data using pyspark.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
emp_list = ( (1, 'John', 'Java'), (2, 'Peter', 'Scala'), (2, 'Peter', 'Python'), (2, 'Peter', 'Spark'), (1, 'John', 'JEE'), (6, 'Elliot', 'Unix',) ) data_schema = [StructField('emp_id', IntegerType(), False), StructField('emp_name', StringType(), False), StructField('emp_expertise', StringType(), False)] final_struc = StructType(fields=data_schema) df = spark.sparkContext.parallelize(emp_list); emp_df = spark.createDataFrame(df, final_struc) emp_df.show() |
Output:
|
1 2 3 4 5 6 7 8 9 10 11 |
+------+--------+-------------+ |emp_id|emp_name|emp_expertise| +------+--------+-------------+ | 1| John| Java| | 2| Peter| Scala| | 2| Peter| Python| | 2| Peter| Spark| | 1| John| JEE| | 6| Elliot| Unix| +------+--------+-------------+ |
agg( ) &… Read more ›...
Prerequisite: Extends Databricks – Spark Window functions.
Problem: Convert the below table
|
1 2 3 4 5 6 7 8 9 10 |
+------+--------+---------+-------------+ |emp_id|emp_name| emp_city|emp_expertise| +------+--------+---------+-------------+ | 1| John| Sydney| Java| | 2| Peter|Melbourne| Scala| | 3| Sam| Brisbane| Python| | 4| David|Melbourne| Python| | 5| Elliot| Sydney| Java| +------+--------+---------+-------------+ |
to
|
1 2 3 4 5 6 7 8 9 |
+-------------+----------------------------------------------------------+ |Column |Content | +-------------+----------------------------------------------------------+ |emp_id |[[1, 1], [3, 1], [5, 1], [4, 1], [2, 1]] | |emp_name |[[Elliot, 1], [John, 1], [Sam, 1], [Peter, 1], [David, 1]]| |emp_city |[[Sydney, 2], [Melbourne, 2], [Brisbane, 1]] | |emp_expertise|[[Python, 2], [Java, 2], [Scala, 1]] | +-------------+----------------------------------------------------------+ |
Where each column is counted for its occurrence. For example, the emp_city column values “Melbourne”
…
Prerequisite: Extends Databricks – Spark problem 1. Problem: Convert the below table
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
+--------+------------+---+ |emp_name| product|qty| +--------+------------+---+ | John| Notebook| 7| | Peter|Mobile phone| 12| | Sam| Camera| 3| | David|Mobile phone| 9| | Elliot| Notebook| 3| | Elliot| Camera| 1| | John|Mobile phone| 13| | Peter|Mobile phone| 2| +--------+------------+---+ |
to
|
1 2 3 4 5 6 7 8 9 10 |
+--------+------+------------+--------+ |emp_name|Camera|Mobile phone|Notebook| +--------+------+------------+--------+ | Elliot| 1| null| 3| | John| null| 13| 7| | Sam| 3| null| null| | Peter| null| 14| null| | David| null| 9| null| +--------+------+------------+--------+ |
Step 1: Create a new Python notebook, and attach it to a new cluster. … Read more ›...
Prerequisite: Extends Databricks getting started – Spark, Shell, SQL. You can try these tutorials in Scala using Databricks Notebook. There are Scala tutorials covered in Spark using Scala on Zeppelin Notebook. Problem statement: Predict the land prices by land area in square feet based on a given set of known...
Prerequisite: Extends Databricks – Spark ML – Linear Regression. Problem statement: Predict the house prices by land area in square feet, no of bedrooms, and how old the house is?, which is the age. … Read more ›...
I have a good news, I got job offer. I like to share with you from my bottom of my heart feeling thankful to you.