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

The rule PromoteStrings cast string to a wrong data type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Not A Problem
    • 2.2.0
    • None
    • SQL

    Description

      Data

      create temporary view tb as select * from values
      ("0", 1),
      ("-0.1", 2),
      ("1", 3)
      as grouping(a, b)
      

      SQL:

      select a, b from tb where a=0
      

      The result which is wrong:

      +----+---+
      |   a|  b|
      +----+---+
      |   0|  1|
      |-0.1|  2|
      +----+---+
      

      Logical Plan:

      == Parsed Logical Plan ==
      'Project ['a]
      +- 'Filter ('a = 0)
         +- 'UnresolvedRelation `src`
      
      == Analyzed Logical Plan ==
      a: string
      Project [a#8528]
      +- Filter (cast(a#8528 as int) = 0)
         +- SubqueryAlias src
            +- Project [_1#8525 AS a#8528, _2#8526 AS b#8529]
               +- LocalRelation [_1#8525, _2#8526]
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              stanzhai StanZhai
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: