Add a column in a table in HIVE QL

You cannot add a column with a default value in Hive. You have the right syntax for adding the column ALTER TABLE test1 ADD COLUMNS (access_count1 int);, you just need to get rid of default sum(max_count). No changes to that files backing your table will happen as a result of adding the column. Hive handles … Read more

Alter hive table add or drop column

You cannot drop column directly from a table using command ALTER TABLE table_name drop col_name; The only way to drop column is using replace command. Lets say, I have a table emp with id, name and dept column. I want to drop id column of table emp. So provide all those columns which you want … Read more

how to replace characters in hive?

regexp_replace UDF performs my task. Below is the definition and usage from apache Wiki. regexp_replace(string INITIAL_STRING, string PATTERN, string REPLACEMENT): This returns the string resulting from replacing all substrings in INITIAL_STRING that match the java regular expression syntax defined in PATTERN with instances of REPLACEMENT, e.g.: regexp_replace(“foobar”, “oo|ar”, “”) returns fb