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

Unable to multiply calendar interval

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Incomplete
    • 2.3.1
    • None
    • SQL

    Description

      When i am trying to multiply calender interval with long/int , I am getting below error. The same syntax is supported in Postgres.

      spark.sql("select  interval '1' day * 3").show()

      org.apache.spark.sql.AnalysisException: cannot resolve '(3 * interval 1 days)' due to data type mismatch: differing types in '(interval 1 days) * 3' (int and calendarinterval).; line 1 pos 7;

      'Project [unresolvedalias((interval 1 days * 3) , None)]

      +- OneRowRelation

       

        at org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)

        at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:93)

        at org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:85)

        at org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:289)

      Attachments

        Activity

          People

            Unassigned Unassigned
            priyankagargnitk Priyanka Garg
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: