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

Create View Commands Fails with The view output (col1,col1) contains duplicate column name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.2.1
    • 2.4.5, 3.0.0
    • SQL
    • None

    Description

      1- create and populate a hive table  . I did this in a hive cli session .[ not that this matters ]

      create table  atable (col1 int) ;

      insert  into atable values (10 ) , (100)  ;

      2. create a view from the table.  

      [These actions were performed from a spark shell ]

      spark.sql("create view  default.aview  (int1 , int2 ) as select  col1 , col1 from atable ")
      java.lang.AssertionError: assertion failed: The view output (col1,col1) contains duplicate column name.
      at scala.Predef$.assert(Predef.scala:170)
      at org.apache.spark.sql.execution.command.ViewHelper$.generateViewProperties(views.scala:361)
      at org.apache.spark.sql.execution.command.CreateViewCommand.prepareTable(views.scala:236)
      at org.apache.spark.sql.execution.command.CreateViewCommand.run(views.scala:174)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:58)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:56)
      at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:67)
      at org.apache.spark.sql.Dataset.<init>(Dataset.scala:183)
      at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:68)
      at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:632)

      Attachments

        Activity

          People

            hem1891 hemanth meka
            tafranky@gmail.com Franck Tago
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: