Support Questions

Find answers, ask questions, and share your expertise

how to create hive table in HDInsight with HDFS data

avatar
Contributor

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....

 

1 ACCEPTED SOLUTION

avatar
Contributor

Hi @rohitmalhotra .

 

Thanks!!

i found this solution already!!!

 

problem was :-

not able to get exact HDFS Path as last post i mentioned .

 

i checked  core.site.xml file  with Azure HDInsight cluster DFS File path:-

 

 

 

Thanks

HadoopHelp

 

 

 

 

 

 

 

View solution in original post

4 REPLIES 4

avatar
Expert 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.

avatar
Expert 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.

 

avatar
Contributor

Hi @rohitmalhotra  .

 

I want to create hive table on top hdinsight hdfs path .

 

so is it possible to create hive table on HDinsight HDFS path or directly we have to use blob container address .

i think i am not able to find out hdfs path from HDInsight!

 

 

 

Thanks

HadoopHelp

avatar
Contributor

Hi @rohitmalhotra .

 

Thanks!!

i found this solution already!!!

 

problem was :-

not able to get exact HDFS Path as last post i mentioned .

 

i checked  core.site.xml file  with Azure HDInsight cluster DFS File path:-

 

 

 

Thanks

HadoopHelp