non-python:
1. create table u_data2
CREATE TABLE u_data2 (
userid INT,
movieid INT,
rating INT,
weekday INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t';
2. populate the table
INSERT OVERWRITE TABLE u_data2
SELECT
userid, movieid, rating, from_unixtime(unix_timestamp(unixtime,'yyyyMMdd'),'u')
FROM u_data;
3. verify the table
SELECT weekday, COUNT(*)
FROM u_data2
GROUP BY weekday;