Hive
  1. Hive
  2. HIVE-2826

ALTER VIEW ADD (IF NOT EXISTS) PARTITION syntax is bad.

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The syntax, ALTER TABLE x ADD IF NOT EXISTS PARTITION, puts the "IF NOT EXISTS" before the subject of the statement. Not only is this weird grammar, but it is also inconsistent with other uses of "IF NOT EXISTS", for example, "CREATE TABLE IF NOT EXISTS" and "DROP TABLE IF EXISTS".

      It would be a minor improvement to align the syntaxes.

        Activity

        Adam Kramer made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Adam Kramer made changes -
        Summary ALTER VIEW ADD PARTITION needs IF NOT EXISTS. ALTER VIEW ADD (IF NOT EXISTS) PARTITION syntax is bad.
        Description Support for ALTER TABLE x ADD IF NOT EXISTS PARTITION was added in HIVE-1106. The same semantics should be supported for ALTER VIEW.

        WAS:
        When trying to add a partition, if the partition already exists, we shouldn't necessarily cause the job to fail...just like we have CREATE TABLE IF NOT EXISTS and DROP TABLE IF EXISTS, we should have ALTER TABLE foo ADD PARTITION IF NOT EXISTS (ds=whatever).

        Ditto for ALTER VIEW.
        The syntax, ALTER TABLE x ADD IF NOT EXISTS PARTITION, puts the "IF NOT EXISTS" before the subject of the statement. Not only is this weird grammar, but it is also inconsistent with other uses of "IF NOT EXISTS", for example, "CREATE TABLE IF NOT EXISTS" and "DROP TABLE IF EXISTS".

        It would be a minor improvement to align the syntaxes.
        Hide
        Adam Kramer added a comment -

        Also, it is implemented for views, too.

        Show
        Adam Kramer added a comment - Also, it is implemented for views, too.
        Hide
        Adam Kramer added a comment -

        Ugh, sorry. The weird difference in syntax is what made me think this had not been implemented.

        Show
        Adam Kramer added a comment - Ugh, sorry. The weird difference in syntax is what made me think this had not been implemented.
        Carl Steinbach made changes -
        Field Original Value New Value
        Summary ALTER TABLE ADD PARTITION needs IF NOT EXISTS. ALTER VIEW ADD PARTITION needs IF NOT EXISTS.
        Description When trying to add a partition, if the partition already exists, we shouldn't necessarily cause the job to fail...just like we have CREATE TABLE IF NOT EXISTS and DROP TABLE IF EXISTS, we should have ALTER TABLE foo ADD PARTITION IF NOT EXISTS (ds=whatever).

        Ditto for ALTER VIEW.
        Support for ALTER TABLE x ADD IF NOT EXISTS PARTITION was added in HIVE-1106. The same semantics should be supported for ALTER VIEW.

        WAS:
        When trying to add a partition, if the partition already exists, we shouldn't necessarily cause the job to fail...just like we have CREATE TABLE IF NOT EXISTS and DROP TABLE IF EXISTS, we should have ALTER TABLE foo ADD PARTITION IF NOT EXISTS (ds=whatever).

        Ditto for ALTER VIEW.
        Adam Kramer created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Adam Kramer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development