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

Define literal constructors as keywords

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.5.0
    • 3.5.0
    • SQL
    • None

    Description

      Currently, Spark SQL defines literal constructors as:

       

      | identifier stringLit #typeConstructor
      

      where identifier is parsed later by visitTypeConstructor():

          valueType match {
            case "DATE" =>
              val zoneId = getZoneId(conf.sessionLocalTimeZone)
              val specialDate = convertSpecialDate(value, zoneId).map(Literal(_, DateType))
              specialDate.getOrElse(toLiteral(stringToDate, DateType))
            case "TIMESTAMP_NTZ" =>
      ...
      

      So, the literal constructors are not Spark SQL keywords, and this causes some inconveniences while analysing/transforming the lexer tree. For example, while forming the stable column aliases.

      Need to define literal constructors in SqlBaseParser.g4.

       

       

      Attachments

        Issue Links

          Activity

            People

              maxgekk Max Gekk
              maxgekk Max Gekk
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: