Skip to main content
HadoopHelp
Gold ⭐️
October 22, 2019
Solved

how to create hive table in HDInsight with HDFS data

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

 

HadoopHelp
Gold ⭐️
December 16, 2019

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

 

 

 

 

 

 

 

4 replies

ngarg
Gold ⭐️
Gold ⭐️
October 23, 2019

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

Translate
rohitmalhotra
Gold ⭐️
Gold ⭐️
October 23, 2019

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.

 

Translate
HadoopHelp
Gold ⭐️
November 18, 2019

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

Translate