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

Hive Update statement set keyword work with lower case only and doesn't give any error if wrong column name specified in the set clause.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.0.0, 1.1.0
    • None
    • Transactions
    • None
    • Hadoop: 2.6.0
      Hive : 1.0.0/1.1.0
      OS:Linux

    Description

      Brief: Hive Update statement set keyword work with lower case only and doesn't give any error if wrong column name specified in the set clause.

      Steps to reproduce:
      following are the steps performed for the same:

      1. Create Table with transactional properties.

      create table customer(id int ,name string, email string) clustered by (id) into 2 buckets stored as orc TBLPROPERTIES('transactional'='true')
      

      2. Insert data into transactional table:

      insert into table customer values (1,'user1','user1@user1.com'),(2,'user2','user1@user1.com'),(3,'user3','user1@gmail.com')
      

      3. Search result:

      0: jdbc:hive2://localhost:10000> select * from customer;
      +--------------+----------------+------------------+--+
      | customer.id  | customer.name  |  customer.email  |
      +--------------+----------------+------------------+--+
      | 2            | user2          | user1@user1.com  |
      | 3            | user3          | user1@gmail.com  |
      | 1            | user1          | user1@user1.com  |
      +--------------+----------------+------------------+--+
      3 rows selected (0.299 seconds)
      

      4. Update table column name with some clause In below column name is used in the UPPER case (NAME) and it is not updating the column value

      0: jdbc:hive2://localhost:10000> update  customer     set  NAME  = 'notworking'   where id = 1;
      INFO  : Table default.customer stats: [numFiles=10, numRows=3, totalSize=6937, rawDataSize=0]
      No rows affected (20.343 seconds)
      0: jdbc:hive2://localhost:10000> select * from customer;
      +--------------+----------------+------------------+--+
      | customer.id  | customer.name  |  customer.email  |
      +--------------+----------------+------------------+--+
      | 2            | user2          | user1@user1.com  |
      | 3            | user3          | user1@gmail.com  |
      | 1            | user1          | user1@user1.com  |
      +--------------+----------------+------------------+--+
      3 rows selected (0.321 seconds)
      

      5. Update table column name with some clause In below column name is used in the LOWER case (name) and it is updating the column value

      0: jdbc:hive2://localhost:10000> update  customer     set  name  = 'working'   where id = 1;
      INFO  : Table default.customer stats: [numFiles=11, numRows=3, totalSize=7699, rawDataSize=0]
      No rows affected (19.74 seconds)
      0: jdbc:hive2://localhost:10000> select * from customer;
      +--------------+----------------+------------------+--+
      | customer.id  | customer.name  |  customer.email  |
      +--------------+----------------+------------------+--+
      | 2            | user2          | user1@user1.com  |
      | 3            | user3          | user1@gmail.com  |
      | 1            | working        | user1@user1.com  |
      +--------------+----------------+------------------+--+
      3 rows selected (0.333 seconds)
      0: jdbc:hive2://localhost:10000>
      

      6. We have also seen that if we put the column name incorrect in set keyword of the update statement it accept the query and execute job. There should validation on the column name used in the set clause

      0: jdbc:hive2://localhost:10000> update  customer     set  name_44  = 'working'   where id = 1;
      

      Attachments

        1. HIVE-10378.1.patch
          1 kB
          Oleksiy Sayankin

        Issue Links

          Activity

            People

              osayankin Oleksiy Sayankin
              vineet.kandpal Vineet Kandpal
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: