to schedule tasks and process data needed by a query. In the future,
we plan to deploy the catalog as a separate service that would work
in a way similar to Hadoop’s NameNode.
5.2.3 Data Loader
The Data Loader is responsible for (i) globally repartitioning data
on a given partition key upon loading, (ii) breaking apart single
node data into multiple smaller partitions or chunks and (iii) finally
bulk-loading the single-node databases with the chunks.
The Data Loader consists of two main components: Global
Hasher and Local Hasher. The Global Hasher executes a custommade
MapReduce job over Hadoop that reads in raw data files
stored in HDFS and repartitions them into as many parts as the
number of nodes in the cluster. The repartitioning job does not
incur the sorting overhead of typical MapReduce jobs.
The Local Hasher then copies a partition from HDFS into the
local file system of each node and secondarily partitions the file into
smaller sized chunks based on the maximum chunk size setting.
The hashing functions used by both the Global Hasher and the
Local Hasher differ to ensure chunks are of a uniform size. They
also differ from Hadoop’s default hash-partitioning function to ensure
better load balancing when executing MapReduce jobs over
the data.
5.2.4 SQL to MapReduce to SQL (SMS) Planner
HadoopDB provides a parallel database front-end to data analysts
enabling them to process SQL queries.
The SMS planner extends Hive [11]. Hive transforms HiveQL, a
variant of SQL, into MapReduce jobs that connect to tables stored
as files in HDFS. The MapReduce jobs consist of DAGs of relational
operators (such as filter, select (project), join, aggregation)
that operate as iterators: each operator forwards a data tuple to the
next operator after processing it. Since each table is stored as a
separate file in HDFS, Hive assumes no collocation of tables on
nodes. Therefore, operations that involve multiple tables usually
require most of the processing to occur in the Reduce phase of
a MapReduce job. This assumption does not completely hold in
HadoopDB as some tables are collocated and if partitioned on the
same attribute, the join operation can be pushed entirely into the
database layer.
To understand how we extended Hive for SMS as well as the differences
between Hive and SMS, we first describe how Hive creates
an executable MapReduce job for a simple GroupBy-Aggregation
query. Then, we describe how we modify the execution plan for
HadoopDB by pushing most of the query processing logic into the
database layer.
Consider the following query:
SELECT YEAR(saleDate), SUM(revenue)
FROM sales GROUP BY YEAR(saleDate);
Hive processes the above SQL query in a series of phases:
(1) The parser transforms the query into an Abstract Syntax Tree.
(2) The Semantic Analyzer connects to Hive’s internal catalog,
the MetaStore, to retrieve the schema of the sales table. It also
populates different data structures with meta information such as
the Deserializer and InputFormat classes required to scan the table
and extract the necessary fields.
(3) The logical plan generator then creates a DAG of relational
operators, the query plan.
(4) The optimizer restructures the query plan to create a more
optimized plan. For example, it pushes filter operators closer to the
table scan operators. A key function of the optimizer is to break up
the plan into Map or Reduce phases. In particular, it adds a Repartition
operator, also known as a Reduce Sink operator, before Join
or GroupBy operators. These operators mark the Map and Reduce
ตารางเวลางานและข้อมูลที่จำเป็นตามแบบสอบถาม ในอนาคตเราวางแผนที่จะปรับใช้
แคตตาล็อกเป็นแยกบริการนั่น
ในลักษณะคล้ายคลึงกับ Hadoop เป็น namenode
.
5.2.3 โหลดข้อมูลข้อมูล Loader เป็นผู้รับผิดชอบ ( ฉัน ) ทั่วโลก repartitioning ข้อมูล
บนให้คีย์พาร์ทิชันบนโหลด ( 2 ) แตกเดียว
ข้อมูลในโหนดขนาดเล็กหลายพาร์ทิชันหรือ chunks และ ( iii ) ในที่สุด
เป็นกลุ่มโหลดโหนดเดียวฐานข้อมูลกับ chunks .
ข้อมูล Loader ประกอบด้วยสององค์ประกอบหลัก : hasher ทั่วโลก
และท้องถิ่น hasher . การ hasher ทั่วโลกรันคัสตอมเมด
mapreduce งานมากกว่า Hadoop ที่อ่านข้อมูลที่เก็บไว้ในไฟล์ดิบ
hdfs repartitions พวกเขาและเป็นหลายส่วน เช่น
โหนดในคลัสเตอร์การ repartitioning งานไม่ต้องเสียค่าใช้จ่ายในการเรียงลำดับของงาน
mapreduce ทั่วไป hasher ท้องถิ่นแล้วคัดลอกพาร์ทิชันจาก hdfs เข้า
ท้องถิ่นระบบแฟ้มของแต่ละโหนด และครั้งที่สองพาร์ทิชันไฟล์
ขนาดชิ้นขึ้นอยู่กับขนาดก้อนสูงสุด
แฮชฟังก์ชันการตั้งค่า ใช้ทั้ง hasher และทั่วโลก
hasher ท้องถิ่นแตกต่างกันเพื่อให้แน่ใจว่าชิ้นที่มีขนาดสม่ำเสมอ พวกเขา
ยังแตกต่างจาก Hadoop ปริยายของกัญชาฟังก์ชันพาร์ทิชันให้
ดีกว่าสมดุลภาระเมื่อรันงาน mapreduce มากกว่า
5.2.4 ข้อมูล SQL เพื่อ mapreduce เพื่อ SQL ( SMS ) hadoopdb วางแผน
ให้ front-end ฐานข้อมูลขนานนักวิเคราะห์ข้อมูล
ให้กระบวนการ SQL แบบสอบถาม .
SMS วางแผนขยายรังผึ้ง [ 11 ] .รังเปลี่ยน hiveql ,
แปรของ SQL ใน mapreduce งานที่เชื่อมต่อกับตารางเก็บไว้
เป็นแฟ้มใน hdfs . การ mapreduce งานประกอบด้วยเดคากรัมของผู้ประกอบการสัมพันธ์
( เช่นกรอง , เลือก ( โครงการ ) , ร่วม , aggregation )
ที่ทํางานเป็น iterators : ผู้ประกอบการแต่ละทูเปิลจะส่งต่อข้อมูล
ผู้ประกอบการต่อไป หลังจากการประมวลผลแล้ว เนื่องจากแต่ละตารางจะถูกเก็บไว้เป็นแฟ้มแยกต่างหากใน hdfs
,รังผึ้ง ถือว่าไม่มีการจัดวางโต๊ะใน
โหนด ดังนั้น การดำเนินการที่เกี่ยวข้องกับหลายตารางมักจะ
ต้องการมากที่สุดของการประมวลผลที่เกิดขึ้นในขั้นตอนของการลด mapreduce งาน สมมติฐานนี้ไม่สมบูรณ์ค้างใน
hadoopdb เป็นบางโต๊ะจะวางไว้ และหากแบ่งตาม
คุณลักษณะเดียวกันเข้าร่วมงานสามารถผลักดันทั้งหมดใน
ฐานข้อมูลชั้นเข้าใจว่าเราขยายรังผึ้ง SMS ตลอดจนความแตกต่าง
ระหว่างรังผึ้งและ SMS ครั้งแรกที่เราอธิบายวิธีการสร้างรัง
งาน mapreduce ปฏิบัติการเพื่อง่าย groupby
รวมแบบสอบถาม แล้ว เราจะได้อธิบายวิธีการที่เราปรับเปลี่ยนการดำเนินการวางแผน
hadoopdb โดยผลักดันมากที่สุดของแบบสอบถามการประมวลผลตรรกะเป็นฐานข้อมูลชั้น
.
พิจารณาแบบสอบถามต่อไปนี้ :
เลือกปี ( saledate ผลรวม ( รายได้ )
)1 ปีขาย ( saledate ) ;
รังกระบวนการแบบสอบถาม SQL ข้างต้นในชุดของขั้นตอน :
( 1 ) สำหรับแปลงแบบสอบถามเป็นต้นไม้ไวยากรณ์บทคัดย่อ .
( 2 ) เครื่องวิเคราะห์ระบบเชื่อมต่อกับรังภายในแคตตาล็อก
metastore , เพื่อดึง schema ของตารางการขาย มันยัง populates เป็นโครงสร้างข้อมูลที่แตกต่างกันด้วย
Meta ข้อมูลเช่นการ deserializer inputformat ชั้นเรียนและต้องเข้ารับการสแกนและสารสกัดจากข้อมูลที่จำเป็น ตาราง
.
( 3 ) แผนตรรกะ สร้างแล้วสร้างวันที่ของผู้ประกอบการแบบแผนแบบสอบถาม
.
( 4 ) การเพิ่มประสิทธิภาพแบบสอบถามวางแผนที่จะสร้างองวางแผนเพิ่มมากขึ้น
ตัวอย่างเช่น ผลักดันให้ผู้ประกอบการกรองเข้าใกล้
ตารางการสแกน ผู้ประกอบการ ฟังก์ชันหลักของการเพิ่มประสิทธิภาพคือการสลาย
แผนแผนที่ หรือลดระยะ โดยเฉพาะอย่างยิ่งมันเพิ่ม repartition
) ที่รู้จักกันว่าลดจม ) ก่อนที่จะเข้าร่วมผู้ประกอบการ
หรือ groupby . ผู้ประกอบการเหล่านี้เครื่องหมายแผนที่และลด
การแปล กรุณารอสักครู่..
