title: NameError: name 'SparkSession' is not defined
body: <p>I'm new to cask cdap and Hadoop environment.</p>
  
  <p>I'm creating a pipeline and I want to use a PySpark Program. I have all the script of the spark program and it works when I test it by command like, insted it doesn't if I try to copy- paste it in a cdap pipeline.</p>
  
  <p>It gives me an error in the logs: </p>
  
  <pre><code>NameError: name 'SparkSession' is not defined
  </code></pre>
  
  <p>My script starts in this way:</p>
  
  <pre><code>from pyspark.sql import *
  
  spark = SparkSession.builder.getOrCreate()
  from pyspark.sql.functions import trim, to_date, year, month
  sc= SparkContext()
  </code></pre>
  
  <p>How can I fix it?</p>