title: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Binding attribute, tree: EMP_SAL#7736
body: <p>I am getting attribute not binding error, this error is coming when i am chaining the dataframe transformation. The input file i am reading as file stream.
  Is this a pyspark bug or my code issue ?
  <code>org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Binding attribute, tree: EMP_SAL#7736.</code></p>
  
  <pre><code>2019-03-13 15:25:53 WARN  TaskSetManager:66 - Lost task 0.0 in stage 90.0 (TID 101, localhost, executor driver): org.apache.spark.SparkException: Task failed while writing rows.
      at org.apache.spark.sql.execution.datasources.FileFormatWriter$.org$apache$spark$sql$execution$datasources$FileFormatWriter$$executeTask(FileFormatWriter.scala:254)
      at org.apache.spark.sql.execution.datasources.FileFormatWriter$$anonfun$write$1.apply(FileFormatWriter.scala:169)
      at org.apache.spark.sql.execution.datasources.FileFormatWriter$$anonfun$write$1.apply(FileFormatWriter.scala:168)
      at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
  
  caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: Binding tree: null
  </code></pre>