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

Unable to multiply calendar interval

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 2.3.1
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:

      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

            • Assignee:
              Unassigned
              Reporter:
              priyankagargnitk Priyanka Garg
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: