Q:

How does toDS() get injected into the Seq object

Normally in Scala if you invoke toDS() on a sequence, you get: 
error: value toDS is not a member of Seq[Int]

However, in a SparkSession, you can invoke the same method on a Seq and it creates a DataSet.
How is this MetaProgramming actually happening? 

A:

It comes from SparkSession.implicits:
import org.apache.spark.sql.SparkSession

val spark = SparkSession.builder.getOrCreate()
import spark.implicits._

