Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to create hive table in HDInsight with HDFS data

Highlighted

how to create hive table in HDInsight with HDFS data

Explorer

Dear All.

 

I having issue with creating hive table with hdfs data in Azure HDInsight cluster.

 

i am able to create hive table from BLOB Storage but not with HDFS Data.

 

as below example code for taking data from blob storage:-

hive> CREATE EXTERNAL TABLE IF NOT EXISTS tsvtab (
> name string,
> region_code int,
> sal int,
> add string
> )
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
> STORED AS TEXTFILE;

load data inpath 'wasb://hadoophdinsightigi-2019-10-21t07-33-15-078z@hadooighdistorage.blob.core.windows.net/user/sshuser/data.tsv' into table tsvtab;

 

below taking data from hdfs but not working:-

 

hive> CREATE EXTERNAL TABLE IF NOT EXISTS tsvtab (
> name string,
> region_code int,
> sal int,
> add string
> )
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
> STORED AS TEXTFILE;

load data inpath 'wasb://hadoophdinsightigi-2019-10-21t07-33-15-078z@hadohdistorage.blob.core.windows.net//user/HadoopPOCDir/data.tsv' into table tsvtab;

 

so please help me....

 

2 REPLIES 2

Re: how to create hive table in HDInsight with HDFS data

Contributor

@HadoopHelp - It seems like the "load data inpath" command is same in both the case. Please check if you shared it by mistake. Also let me know the error message you are getting while uploading the table.

Re: how to create hive table in HDInsight with HDFS data

Contributor

It would be great if you can share the exact error you are facing.

 

Also, can you please try creating the table as below:

 

CREATE EXTERNAL TABLE IF NOT EXISTS tsvtab (
> name string,
> region_code int,
> sal int,
> add string
> )
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
> STORED AS TEXTFILE;

load data inpath 'hdfs://hadoophdinsightigi-2019-10-21t07-33-15-078z@hadohdistorage.blob.core.windows.net/user/HadoopPOCDir/data.tsv' into table tsvtab;

 

OR

 

CREATE EXTERNAL TABLE IF NOT EXISTS tsvtab (
> name string,
> region_code int,
> sal int,
> add string
> )
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
> STORED AS TEXTFILE;

load data inpath '/user/HadoopPOCDir/data.tsv' into table tsvtab;

 

 

NOTE:

I have change the path from "wasb//" to "hdfs//" in the first command and removed the unwanted details from the second command.

 

Don't have an account?
Coming from Hortonworks? Activate your account here