[SS] Invalid call to dataType on unresolved object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[SS] Invalid call to dataType on unresolved object

Lalwani, Jayesh

This is possibly a bug introduced in 2.3.0.

 

I have this code that I run in spark-shell

 

spark.readStream.format("socket").option("host", "localhost").option("port", 9999).load().toDF("employeeId").

     | withColumn("swipeTime", expr("current_timestamp()")).

     | createTempView("employeeSwipe")

 

spark.table("employeeSwipe").writeStream.outputMode("append").format("console").start

 

 

I run it in 2.2.1 and I get this

 

scala> spark.readStream.format("socket").option("host", "localhost").option("port", 9999).load().toDF("employeeId").

     | withColumn("swipeTime", expr("current_timestamp()")).

     | createTempView("employeeSwipe")

18/06/04 18:20:27 WARN ObjectStore: Failed to get database global_temp, returning NoSuchObjectException

18/06/04 18:20:28 WARN TextSocketSourceProvider: The socket source should not be used for production applications! It does not support recovery.

 

scala> spark.table("employeeSwipe").writeStream.outputMode("append").format("console").start

res1: org.apache.spark.sql.streaming.StreamingQuery = org.apache.spark.sql.execution.streaming.StreamingQueryWrapper@24489d12

 

scala> -------------------------------------------

Batch: 0

-------------------------------------------

+----------+--------------------+

|employeeId|           swipeTime|

+----------+--------------------+

|         1|2018-06-04 18:21:...|

+----------+--------------------+

 

I run the same in 2.3.0, and I get this

 

scala> spark.readStream.format("socket").option("host", "localhost").option("port", 9999).load().toDF("employeeId").

     |      | withColumn("swipeTime", expr("current_timestamp()")).

     |      | createTempView("employeeSwipe")

2018-06-04 18:37:12 WARN  TextSocketSourceProvider:66 - The socket source should not be used for production applications! It does not support recovery.

2018-06-04 18:37:15 WARN  ObjectStore:568 - Failed to get database global_temp, returning NoSuchObjectException

 

scala> 

 

scala> spark.table("employeeSwipe").writeStream.outputMode("append").format("console").start

res1: org.apache.spark.sql.streaming.StreamingQuery = org.apache.spark.sql.execution.streaming.StreamingQueryWrapper@5a503cf0

 

scala> 2018-06-04 18:37:28 ERROR MicroBatchExecution:91 - Query [id = 10f792b2-89fd-4d98-b2e7-f7531da385e4, runId = 3b131ecf-a622-4b54-9295-ff06e9fc2566] terminated with error

org.apache.spark.sql.catalyst.analysis.UnresolvedException: Invalid call to dataType on unresolved object, tree: 'swipeTime

       at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.dataType(unresolved.scala:105)

       at org.apache.spark.sql.types.StructType$$anonfun$fromAttributes$1.apply(StructType.scala:435)

       at org.apache.spark.sql.types.StructType$$anonfun$fromAttributes$1.apply(StructType.scala:435)

       at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)

       at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)

       at scala.collection.immutable.List.foreach(List.scala:381)

       at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)

       at scala.collection.immutable.List.map(List.scala:285)

       at org.apache.spark.sql.types.StructType$.fromAttributes(StructType.scala:435)

       at org.apache.spark.sql.catalyst.plans.QueryPlan.schema$lzycompute(QueryPlan.scala:157)

       at org.apache.spark.sql.catalyst.plans.QueryPlan.schema(QueryPlan.scala:157)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution.org$apache$spark$sql$execution$streaming$MicroBatchExecution$$runBatch(MicroBatchExecution.scala:447)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution$$anonfun$runActivatedStream$1$$anonfun$apply$mcZ$sp$1.apply$mcV$sp(MicroBatchExecution.scala:133)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution$$anonfun$runActivatedStream$1$$anonfun$apply$mcZ$sp$1.apply(MicroBatchExecution.scala:121)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution$$anonfun$runActivatedStream$1$$anonfun$apply$mcZ$sp$1.apply(MicroBatchExecution.scala:121)

       at org.apache.spark.sql.execution.streaming.ProgressReporter$class.reportTimeTaken(ProgressReporter.scala:271)

       at org.apache.spark.sql.execution.streaming.StreamExecution.reportTimeTaken(StreamExecution.scala:58)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution$$anonfun$runActivatedStream$1.apply$mcZ$sp(MicroBatchExecution.scala:121)

       at org.apache.spark.sql.execution.streaming.ProcessingTimeExecutor.execute(TriggerExecutor.scala:56)

       at org.apache.spark.sql.execution.streaming.MicroBatchExecution.runActivatedStream(MicroBatchExecution.scala:117)

       at org.apache.spark.sql.execution.streaming.StreamExecution.org$apache$spark$sql$execution$streaming$StreamExecution$$runStream(StreamExecution.scala:279)

       at org.apache.spark.sql.execution.streaming.StreamExecution$$anon$1.run(StreamExecution.scala:189)

 

 

 

 



The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates and may only be used solely in performance of work or services for Capital One. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.