I need to split a table in hive
into a column, which is also part of the table.
For instance,
Table: Employee
Columns: employeeId, employeeName, employeeSalary
I need to split a table using employeeSalary. Therefore, I am writing the following query:
CREATE TABLE employee (employeeId INT, employeeName STRING, employeeSalary INT) PARTITIONED BY (ds INT);
I just used the name "ds" here, since it did not allow me to specify the same name employeeSalary
.
Is that right, what am I doing? Also, when inserting values โโinto the table, I have to use a comma separated file. Now the file consists of a line like: 2019, John, 2000
like one line. If I have to break up using salary, then my first section will be all for salary 2000. Thus, the request will be
LOAD DATA LOCAL INPATH './examples/files/kv2.txt' OVERWRITE INTO TABLE employee PARTITION (ds=2000);
Again, after 100 records with a salary in 2000, I have the following 500 records with a salary of 4000. So I ran the query again:
LOAD DATA LOCAL INPATH './examples/files/kv2.txt' OVERWRITE INTO TABLE employee PARTITION (ds=4000);
PLEASE CAN KNOW IF I AM THE RIGHT ...