Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-22431

Creating Permanent view with illegal type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.3.0
    • SQL
    • None

    Description

      It is possible in Spark SQL to create a permanent view that uses an nested field with an illegal name.

      For example if we create the following view:

      create view x as select struct('a' as `$q`, 1 as b) q
      

      A simple select fails with the following exception:

      select * from x;
      
      org.apache.spark.SparkException: Cannot recognize hive type string: struct<$q:string,b:int>
        at org.apache.spark.sql.hive.client.HiveClientImpl$.fromHiveColumn(HiveClientImpl.scala:812)
        at org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:378)
        at org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:378)
      ...
      

      Dropping the view isn't possible either:

      drop view x;
      
      org.apache.spark.SparkException: Cannot recognize hive type string: struct<$q:string,b:int>
        at org.apache.spark.sql.hive.client.HiveClientImpl$.fromHiveColumn(HiveClientImpl.scala:812)
        at org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:378)
        at org.apache.spark.sql.hive.client.HiveClientImpl$$anonfun$getTableOption$1$$anonfun$apply$11$$anonfun$7.apply(HiveClientImpl.scala:378)
      ...
      

      Attachments

        Activity

          People

            ksunitha Sunitha Kambhampati
            hvanhovell Herman van Hövell
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: