Code snippets

Subscribe

Python

Check installed packages in Python

Different programming languages have different package management tools.

View detail
Teradata SQL

Calculate time difference in SQL / Teradata

This code snippet shows how to calculate time differences.

View detail
Hadoop Shell

List Hadoop running jobs in Shell / Hadoop

Hadoop provides a number of CLIs. hadoop job command can be used to retrieve running job list.

You can also use YARN resource manager UI to view the jobs too.

View detail
Hadoop Shell

Check HDFS folder size in Shell / Hadoop

Hadoop provides a number of CLIs that can be used to perform many tasks/activities. This code snippet shows you how to check file/folder size in HDFS.

View detail
Spark (v2.x) Scala

Convert List to Spark Data Frame in Scala / Spark (v2.x)

In Spark, SparkContext.parallelize function can be used to convert list of objects to RDD and then RDD can be converted to DataFrame object through SparkSession.

View detail
Spark (v2.x) Python

Convert List to Spark Data Frame in Python / Spark (v2.x)

In Spark, SparkContext.parallelize function can be used to convert list of objects to RDD and then RDD can be converted to DataFrame object through SparkSession.

View detail
Spark (v2.x) Scala

Read JSON file as Spark DataFrame in Scala / Spark (v2.x)

Spark has easy fluent APIs that can be used to read data from JSON file as DataFrame object. 

View detail
Spark (v2.x) Python

Read JSON file as Spark DataFrame in Python / Spark (v2.x)

Spark has easy fluent APIs that can be used to read data from JSON file as DataFrame object. 

View detail
JavaScript

Read and parse JSON in JavaScript

JSON is commonly used in modern applications for data storage and transfers. Pretty much all programming languages provide APIs to parse JSON. 

View detail
SQL Server T-SQL

Calculate time difference in T-SQL / SQL Server

This code snippet shows how to calculate time differences.

View detail