LantaoJin opened a new pull request #28833:
URL: https://github.com/apache/spark/pull/28833


   ## What changes were proposed in this pull request?
   
   Spark-sql do not support for void column datatype of view
   
   Create a HIVE view:
   >hive> create table bad as select 1 x, null z from dual;
   
   Because there's no type, Hive gives it the VOID type:
   >hive> describe bad;
   OK
   x    int     
   z    void
   
   In Spark2.0.x, the behaviour to read this view is normal:
   >spark-sql> describe bad;
   x       int     NULL
   z       void    NULL
   Time taken: 4.431 seconds, Fetched 2 row(s)
   
   But in Spark2.1.x, it failed with SparkException: Cannot recognize hive type 
string: void
   
   >spark-sql> describe bad;
   17/05/09 03:12:08 INFO execution.SparkSqlParser: Parsing command: describe 
bad
   17/05/09 03:12:08 INFO parser.CatalystSqlParser: Parsing command: int
   17/05/09 03:12:08 INFO parser.CatalystSqlParser: Parsing command: void
   17/05/09 03:12:08 ERROR thriftserver.SparkSQLDriver: Failed in [describe bad]
   org.apache.spark.SparkException: Cannot recognize hive type string: void
           at 
org.apache.spark.sql.hive.client.HiveClientImpl.org$apache$spark$sql$hive$client$HiveClientImpl$$fromHiveColumn(HiveClientImpl.scala:789)
           at 
org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:365)
  
           at 
org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:365)
  
           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.Iterator$class.foreach(Iterator.scala:893)
           at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
           at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
           at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
           at 
scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
           at scala.collection.AbstractTraversable.map(Traversable.scala:104)
           at 
org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11.apply(HiveClientImpl.scala:365)
           at 
org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11.apply(HiveClientImpl.scala:361)
   Caused by: org.apache.spark.sql.catalyst.parser.ParseException:
   DataType void() is not supported.(line 1, pos 0)
   == SQL ==  
   void       
   ^^^
           ... 61 more
   org.apache.spark.SparkException: Cannot recognize hive type string: void
   
   
   
   ## How was this patch tested?
   
   Add tests
   
   Also can manual tests
   >spark-sql> describe bad;
   x int NULL
   z null NULL
   Time taken: 0.486 seconds, Fetched 2 row(s)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to