Oct
29
Spark program to load a table data from Cassandra to Hive using Java
Hey there! Welcome to ClearUrDoubt.com. In this post, we will look at a Spark program to load a table data from Cassandra to Hive using Java. Step 1: Create a table in Cassandra and insert records into it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
cqlsh:clearurdoubt> CREATE TABLE students( ... id int PRIMARY KEY, ... name text, ... marks int); cqlsh:clearurdoubt> INSERT INTO students (id, name, marks) VALUES (101, 'Sidhu', 92); cqlsh:clearurdoubt> INSERT INTO students (id, name, marks) VALUES (102, 'Sanju', 90); cqlsh:clearurdoubt> INSERT INTO students (id, name, marks) VALUES (103, 'Ram', 45) ; cqlsh:clearurdoubt> INSERT INTO students (id, name, marks) VALUES (105, 'Krishna', 88) ; cqlsh:clearurdoubt> INSERT INTO students (id, name, marks) VALUES (104, 'Mounika', 90) ; cqlsh:clearurdoubt> cqlsh:clearurdoubt> select * from students; id | marks | name -----+-------+--------- 105 | 88 | Krishna 104 | 90 | Mounika 102 | 90 | Sanju 101 | 92 | Sidhu 103 | 45 | Ram (5 rows) cqlsh:clearurdoubt> |
Step 2: Read more