What is the Data format and database choices in Hadoop and Spark?

0 votes

I am working on structured data (one value per field, the same fields for each row) that I have to put in a NoSql environment with Spark (as analyzing tool) and Hadoop. Though, I am wondering what format to use. I was thinking about json or csv but I'm not sure. What do you think and why? I don't have enough experience in this field to properly decide.

2nd question: I have to analyze these data (stored in an HDFS). So, as far as I know, I have two possibilities to query them (before the analysis):

  1. direct reading and filtering. I mean that it can be done with Spark, for example:

    data = sqlCtxt.read.json(path_data)
    
  2. Use HBase/Hive to properly make a query and then process the data.

So, I don't know what is the standard way of doing all this and above all, what will be the fastest. 

Sep 4, 2018 in Big Data Hadoop by Neha
• 6,280 points
86 views

1 answer to this question.

0 votes
Use Parquet. I'm not sure about CSV but definitely, don't use JSON. My personal experience using JSON with spark was extremely, extremely slow to read from storage, after switching to Parquet my read times were much faster (e.g. some small files took minutes to load in compressed JSON, now they take less than a second to load in compressed Parquet).

On top of improving read speeds, compressed parquet can be partitioned by the spark when reading, whereas compressed JSON cannot. What this means is that Parquet can be loaded onto multiple cluster workers, whereas JSON will just be read onto a single node with 1 partition. This isn't a good idea if your files are large and you'll get Out Of Memory Exceptions. It also won't parallelize your computations, so you'll be executing on one node. This isn't the 'Sparky' way of doing things.

Final point: you can use SparkSQL to execute queries on stored parquet files, without having to read them into data frames first. Very handy.

Hope this helps :)
answered Sep 4, 2018 by Frankie
• 9,810 points

Related Questions In Big Data Hadoop

0 votes
1 answer
0 votes
1 answer

What is Modeling data in Hadoop and how to do it?

I suggest spending some time with Apache ...READ MORE

answered Sep 19, 2018 in Big Data Hadoop by Frankie
• 9,810 points
130 views
0 votes
1 answer

What is the difference between MapReduce and YARN in Hadoop?

MapReduce: MapReduce is an algorithm used to store ...READ MORE

answered Dec 19, 2018 in Big Data Hadoop by Omkar
• 68,480 points
589 views
0 votes
1 answer

What is the difference in DistCP command and Sqoop command in Hadoop?

Both the distCP (Distributed copy in Hadoop) ...READ MORE

answered Apr 11 in Big Data Hadoop by Gitika
• 25,420 points
78 views
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,800 points
3,572 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,800 points
453 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
18,401 views
0 votes
1 answer
0 votes
1 answer

What is the difference between Hadoop MapReduce and built-in MapReduce?

Differences are as follows: Hadoop's MR can be ...READ MORE

answered Sep 11, 2018 in Big Data Hadoop by Frankie
• 9,810 points
263 views