how to set up SQL/Hive connection with cloudera cluster to read data stored on cluster
up vote
0
down vote
favorite
I wanted to retrieve the data stored onto Hadoop Cloudera cluster either via Hive, Spark or SQL. I have SQL query written which should fetch data from the cluster.
But prior to that, I want to understand how to set up connection /Cursor with cluster so that it will know where to read from or write to?
sc = spark.sparkContext
or similarly HIVECONTEXT or SPARKCONTEXT will not suffice.
We might need to give URL for node and all. So how to do that?
Any Small example would suffice.
hive apache-spark-sql hadoop-streaming
add a comment |
up vote
0
down vote
favorite
I wanted to retrieve the data stored onto Hadoop Cloudera cluster either via Hive, Spark or SQL. I have SQL query written which should fetch data from the cluster.
But prior to that, I want to understand how to set up connection /Cursor with cluster so that it will know where to read from or write to?
sc = spark.sparkContext
or similarly HIVECONTEXT or SPARKCONTEXT will not suffice.
We might need to give URL for node and all. So how to do that?
Any Small example would suffice.
hive apache-spark-sql hadoop-streaming
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I wanted to retrieve the data stored onto Hadoop Cloudera cluster either via Hive, Spark or SQL. I have SQL query written which should fetch data from the cluster.
But prior to that, I want to understand how to set up connection /Cursor with cluster so that it will know where to read from or write to?
sc = spark.sparkContext
or similarly HIVECONTEXT or SPARKCONTEXT will not suffice.
We might need to give URL for node and all. So how to do that?
Any Small example would suffice.
hive apache-spark-sql hadoop-streaming
I wanted to retrieve the data stored onto Hadoop Cloudera cluster either via Hive, Spark or SQL. I have SQL query written which should fetch data from the cluster.
But prior to that, I want to understand how to set up connection /Cursor with cluster so that it will know where to read from or write to?
sc = spark.sparkContext
or similarly HIVECONTEXT or SPARKCONTEXT will not suffice.
We might need to give URL for node and all. So how to do that?
Any Small example would suffice.
hive apache-spark-sql hadoop-streaming
hive apache-spark-sql hadoop-streaming
edited Nov 22 at 18:16
VIN
14111
14111
asked Nov 22 at 12:44
Tilo
747
747
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28
add a comment |
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
There are two ways to create the table in the hive:
1- Creating an external table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS names_text(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/andrena';
2- a) Create the schema for a managed table:
CREATE TABLE IF NOT EXISTS Names(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
STORED AS ORC;
b) Move the external table data to the managed table:
INSERT OVERWRITE TABLE Names SELECT * FROM names_text;
And finally, verify that the Hive warehouse stores the student names in the external and internal table respectively :
SELECT * FROM names_text;
SELECT * from Names;
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
There are two ways to create the table in the hive:
1- Creating an external table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS names_text(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/andrena';
2- a) Create the schema for a managed table:
CREATE TABLE IF NOT EXISTS Names(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
STORED AS ORC;
b) Move the external table data to the managed table:
INSERT OVERWRITE TABLE Names SELECT * FROM names_text;
And finally, verify that the Hive warehouse stores the student names in the external and internal table respectively :
SELECT * FROM names_text;
SELECT * from Names;
add a comment |
up vote
1
down vote
accepted
There are two ways to create the table in the hive:
1- Creating an external table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS names_text(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/andrena';
2- a) Create the schema for a managed table:
CREATE TABLE IF NOT EXISTS Names(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
STORED AS ORC;
b) Move the external table data to the managed table:
INSERT OVERWRITE TABLE Names SELECT * FROM names_text;
And finally, verify that the Hive warehouse stores the student names in the external and internal table respectively :
SELECT * FROM names_text;
SELECT * from Names;
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
There are two ways to create the table in the hive:
1- Creating an external table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS names_text(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/andrena';
2- a) Create the schema for a managed table:
CREATE TABLE IF NOT EXISTS Names(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
STORED AS ORC;
b) Move the external table data to the managed table:
INSERT OVERWRITE TABLE Names SELECT * FROM names_text;
And finally, verify that the Hive warehouse stores the student names in the external and internal table respectively :
SELECT * FROM names_text;
SELECT * from Names;
There are two ways to create the table in the hive:
1- Creating an external table schema:
CREATE EXTERNAL TABLE IF NOT EXISTS names_text(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/user/andrena';
2- a) Create the schema for a managed table:
CREATE TABLE IF NOT EXISTS Names(
student_ID INT, FirstName STRING, LastName STRING,
year STRING, Major STRING)
COMMENT 'Student Names'
STORED AS ORC;
b) Move the external table data to the managed table:
INSERT OVERWRITE TABLE Names SELECT * FROM names_text;
And finally, verify that the Hive warehouse stores the student names in the external and internal table respectively :
SELECT * FROM names_text;
SELECT * from Names;
answered Nov 23 at 14:27
VIN
14111
14111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431323%2fhow-to-set-up-sql-hive-connection-with-cloudera-cluster-to-read-data-stored-on-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If you want to query the data through hive you will have to define the schema so make hive table first load the data into that table and then run queries like SQL and you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from .
– VIN
Nov 22 at 14:24
exactly I agree, I just need example for "you basically define the source and destination address while creating the table in the hive in order to figure out where to write and read from"
– Tilo
Nov 23 at 5:11
Please find the example below and let me know if you still need help
– VIN
Nov 23 at 14:28