title: pyspark sql : AttributeError: 'NoneType' object has no attribute 'join'
body: <pre class="lang-py prettyprint-override"><code>def main(inputs, output):
  
      sdf = spark.read.csv(inputs, schema=observation_schema)
      sdf.registerTempTable('filtertable')
  
      result = spark.sql("""
      SELECT * FROM filtertable WHERE qflag IS NULL
      """).show()
  
      temp_max = spark.sql(""" SELECT date, station, value FROM filtertable WHERE (observation = 'TMAX')""").show()
      temp_min = spark.sql(""" SELECT date, station, value FROM filtertable WHERE (observation = 'TMIN')""").show()
  
      result = temp_max.join(temp_min, condition1).select(temp_max('date'), temp_max('station'), ((temp_max('TMAX')-temp_min('TMIN'))/10)).alias('Range'))
  </code></pre>
  
  <p>Error: </p>
  
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File "/Users/syedikram/Documents/temp_range_sql.py", line 96, in &lt;module&gt;
      main(inputs, output)
    File "/Users/syedikram/Documents/temp_range_sql.py", line 52, in main
      result = temp_max.join(temp_min, condition1).select(temp_max('date'), temp_max('station'), ((temp_max('TMAX')-temp_min('TMIN')/10)).alias('Range'))
  AttributeError: 'NoneType' object has no attribute 'join'
  </code></pre>
  
  <p>Performing on join operation gives me Nonetype object error. Looking online didn't help as there is little documentation online for pyspark sql.
  What am I doing wrong here?</p>