title: Why spark tell me “ name 'sqlContext' is not defined ”, how can I use sqlContext?
body: <p>I try to run example of spark-ml, but</p>
  <pre><code>from pyspark import SparkContext
  import pyspark.sql 
  
  sc = SparkContext(appName=&quot;PythonStreamingQueueStream&quot;)    
  training = sqlContext.createDataFrame([
  (1.0, Vectors.dense([0.0, 1.1, 0.1])),
  (0.0, Vectors.dense([2.0, 1.0, -1.0])),
  (0.0, Vectors.dense([2.0, 1.3, 1.0])),
  (1.0, Vectors.dense([0.0, 1.2, -0.5]))], [&quot;label&quot;, &quot;features&quot;])
  </code></pre>
  <p>cannot run because terminal tells me that</p>
  <pre><code>NameError: name 'SQLContext' is not defined
  </code></pre>
  <p>Why this happened? How can I solve it?</p>