how to add partition in existing without partitin table

Viewing 1 reply thread
  • Author
    Posts
    • #6556
      DataFlair Team
      Spectator

      I have a existing table without partition,data also available in the table.how to add partition in the table.

    • #6557
      DataFlair Team
      Spectator

      Unfortunately, you cannot add/create partition in existing table which was not partitioned while creation of the table.
      However if you had partitioned the existing table using “PARTITIONED BY” clause, then you will be allowed you add partition using the ALTER TABLE command.
      Please refer to both the create and alter commands below:

      CREATE TABLE tab02 (foo INT, bar STRING) PARTITIONED BY (mon STRING);

      ALTER TABLE tab02 ADD PARTITION (mon ='10') location '/home/hdadmin/hive-0.13.1-cdh5.3.2/examples/files/kv5.txt';

Viewing 1 reply thread
  • You must be logged in to reply to this topic.