Search code examples
hivespecial-charactershive-partitions

unable to delete hive table partition contains special character Equal sign(=)


  • inserted data in Hive table with partition column(CL) value as ('CL=18') which stored as /db/tbname/CL=CL%3D18 (invalid partition contains url encoded special character for equal sign).

    • As per hortonworks community , it was mentioned hive stored special characters as url escaped.

      • I tried using escape sequence for equal sign as \x3D(hex) , \u0030 (unicode) but did not work

Ex: alter table tb drop partition (CL='CL\x3D18'); <-- did not work

Can some one help me, am I doing some thing wrong for Equal(=) sign?


Solution

  • Try with alter table id drop partition(cl="cl=18"); (or) by enclosing partition value with single quotes(') also.

    i have recreated the scenario on end and able to drop the partitions with special characters without using any hex..etc sequence.

    Example:

    I have created partition table with cl as partition column stringtype.

    hive> alter table t1 add partition(cl="cl=18"); --add the partition to the table
    hive> show partitions t1; --list the partititons in the table
    +-------------+--+
    |  partition  |
    +-------------+--+
    | cl=cl%3D18  |
    +-------------+--+
    hive>  alter table t1  drop partition(cl='cl=18'); --drop the partition from the table.
    hive>  show partitions t1; 
    +------------+--+
    | partition  |
    +------------+--+
    +------------+--+