Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-1490

More implicit type conversion: UNION ALL and COALESCE

    XMLWordPrintableJSON

Details

    Description

      This is a usecase that frequently annoys me:

      SELECT TRANSFORM(stuff)
      USING 'script'
      AS thing1, thing2
      FROM some_table

      UNION ALL

      SELECT a.thing1, a.thing2
      FROM some_other_table a

      ...this fails when a.thing1 and a.thing2 are anything but STRING, because all output of TRANSFORM is STRING.

      In this case, a.thing1 and a.thing2 should be implicitly converted to string.

      COALESCE(a.thing1, a.thing2, a.thing3) should similarly do implicit type conversion among the arguments. If two are INT and one is BIGINT, upgrade the INTs, etc.

      At the very least, it would be nice to have syntax like

      SELECT TRANSFORM(stuff)
      USING 'script'
      AS thing1 INT, thing2 INT

      ...which would effectively cast the output column to the specified type. But really, type conversion should work.

      Attachments

        Issue Links

          Activity

            People

              salbiz Syed S. Albiz
              akramer Adam Kramer
              Votes:
              3 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: