HADOOP OLAP ENGINE
In various example embodiments, systems and methods for building data cubes to be stored in a cube store are presented. In some embodiments, a metadata engine generates the cube metadata. In further embodiments, cube data is generated by a cube build engine based on the cube metadata and source data. The cube build engine performs a multi-stage MapReduce job on the source data to produce a multi-dimensional cube lattice having multiple cuboids. In further embodiments, the cube data is provided to the cube store.
- 1. -20. (canceled)
- 21. A method comprising:
receiving cube metadata defining dimensions and measure information for a cube; building the cube based on the cube metadata and source data; storing the cube in a cube store, the cube store configured for access by a query engine; partitioning the cube into a first data partition and a second data partition; and refreshing the first data partition by periodically merging cube data in the second data partition with cube data in the first data partition.
- View Dependent Claims (22, 23, 24, 25, 26, 27, 28, 29)
- 30. A machine readable medium not having any transitory signals and storing instructions that, when executed by at least one processor of a machine, cause the machine to perform operations comprising:
receiving cube metadata defining dimensions and measure information for a cube; building the cube based on the cube metadata and source data; storing the cube in a cube store, the cube store configured for access by a query engine; partitioning the cube into a first data partition and a second data partition; and
- View Dependent Claims (31, 32, 33, 34, 35)
- 36. A computer system, comprising:
at least one processor; and a machine readable medium not having any transitory signals and storing instructions that, when executed by the at least one processor, cause the computer system to perform operations comprising; receiving cube metadata defining dimensions and measure information for a cube; building the cube based on the cube metadata and source data; storing the cube in a cube store, the cube store configured for access by a query engine; partitioning the cube into a first data partition and a second data partition; and
- View Dependent Claims (37, 38, 39, 40)
This application claims the benefit of U.S. Provisional Application No. 61/983,878, filed Apr. 24, 2014, entitled “HADOOP OLAP ENGINE,” which is incorporated herein by reference in its entirety.
Embodiments of the present disclosure relate generally to analytical processing, and more particularly, but not by way of limitation, to online analytical processing to generate business intelligence information.
Online Analytical Processing (OLAP) is a technology that is used to organize large businesses databases and support business intelligence (BI). The online analytical processing generally requires pre-computation and storage of information in a data cube, which also may be referred to as an OLAP data cube. The multidimensional expressions (MDX) language may provide a specialized syntax for querying and manipulating the multidimensional data stored in the data cube. For example, a company might wish to summarize financial data by product, by time-period, and by city to compare actual and budget expenses. In this example, the product, time, city, and scenario (actual and budget) are the data'"'"'s dimensions. Various other dimensions may be used in the data cubes.
The data cubes may be described as a multidimensional data set with an arbitrary number of dimensions. In general, each cell of the data cube may contain a number that represents some measure of a business, such as sales, profits, expenses, budget and forecast. The data cube data may be stored in a star schema or snowflake schema in a relational data warehouse or in a special-purpose data management system.
The BI tools may be used by companies to facilitate enhanced business decisions through reporting, analysis, and monitoring. The data cubes may be used as a form of caching to allow multiple reports to be stored in the data cubes. In various embodiments, the result is almost instant report execution regardless of the report size. The data cube can be created generically in order to serve as a cache for a number of different reports.
Many BI tools and services available may have limitations such as: (1) a single file storage with less than two billion rows per data cube; (2) ability to only scale-up with no distributed architecture; and (3) amount of time needed to run a query is over 24 hours. As more and more analysis data is available on Hadoop clusters, data consumers are requesting that such analysis data on Hadoop interface directly with BI platforms. Hadoop, also referred to as Apache Hadoop, is an open-source software framework for storage and large-scale processing of data-sets on clusters of commodity hardware. Hadoop is an Apache top-level project and licensed under Apache License 2.0. The Apache Hadoop framework includes Hadoop Distributed File System (HDFS) and the Hadoop MapReduce, as well as other components.
Various ones of the appended drawings merely illustrate example embodiments of the present disclosure and cannot be considered as limiting its scope.
The description that follows includes systems, methods, techniques, instruction sequences, and computing machine program products that embody illustrative embodiments of the present invention. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide an understanding of various embodiments of the inventive subject matter. It will be evident, however, to those skilled in the art that embodiments of the inventive subject matter may be practiced without these specific details. In general, well-known instruction instances, protocols, structures, and techniques have not been shown in detail.
As used herein, the term “or” may be construed in either an inclusive or exclusive sense. Additionally, although various example embodiments discussed below focus on a marketplace environment, the embodiments are given merely for clarity in disclosure. Thus, any type of electronic publication, electronic commerce, social networking, or electronic business system and method, including various system architectures, may employ various embodiments of the system and method described herein and may be considered as being within a scope of example embodiments. Each of a variety of example embodiments is discussed in detail below.
In example embodiments, a Hadoop system, which includes an HDFS, may be used to store huge amounts of data with mostly sequential access. On the other hand, a cube store, such as an HBase cube store, provides fast random access to data. The HBase cube store refers to storing cube data on an HBase. The HBase, also referred to as the Apache HBase or the Hadoop database, is an open source, non-relational, distributed, scalable, big data store developed as part of the Apache Hadoop project. The HBase runs on top of HDFS and allows random, real-time read/write access to big data (large and complex collections of data sets). The cube data refers to a multidimensional dataset with each cell of the cube holding a number that represents some measure (for example, a measure of the business, such as sales, profits, expenses, budget and forecast). A Hadoop OLAP engine, receives source data from the Hadoop system, and builds cubes to be stored in the cube store for fast access to the cube data. The cubes built by the Hadoop OLAP engine may be OLAP cubes representing an array of data understood in terms of its 0 or more dimensions which may be used for analyzing business data in the search for business intelligence.
In other example embodiments, systems and methods for building cubes to be stored in a cube store are described. The source data (represented by star schema data) for building the cubes may be provided by a Hadoop system. A Hadoop OLAP engine may be used to build a cube by performing a multi-stage MapReduce job on the source data to produce a multi-dimensional cube lattice having multiple cuboids. The cube metadata, including dimension and measure information, is used by the Hadoop OLAP engine to generate the cube data. The cube data may be uploaded into cube tables in the cube store. In one example embodiment, the cube store is an HBase data cube.
In further embodiments, systems and methods for querying cube data from cube stores are described. In an example embodiment, a user may query a cube store using a BI Tool to access BI information (e.g., BI reports, charts, and other data). The query may be an SQL query which is converted to a cube query to access one or more cube tables stored in the cube store. The cube data may represent business, financial, and other data may be used to generate or produce BI information in response to the online request from the BI Tools.
The Hadoop system 110 provides both distributed storage and computational capabilities. The Hadoop system 110 includes: a MapReduce for computational capabilities representing a computation engine; a Hadoop distributed file system (HDFS) for storage; and a server cloud that runs on commodity hardware. The Hadoop system 110 is a distributed master-slave architecture having a master node and slave nodes. The HDFS and MapReduce are both built of clients, slaves, and a coordinating master. The coordinating masters in the HDFS are referred to as the NameNode and Datallode. The coordinating masters in MapReduce are referred to as jobtracker and tasktrackers. In one example, a master node includes a MapReduce master, which is responsible for organizing where computational work should be scheduled on the slave nodes, and a HDFS master, which is responsible for partitioning the storage across the slave nodes and keeping track of where data is located. In example embodiments, slave nodes may be increased for increased storage and processing capabilities.
For an example embodiment, commodity hardware refers to mid-level rack servers with dual sockets, error-correcting random-access memory (RAM), and serial advanced technology attachment (SATA) drives optimized for RAID storage. Using RAID, however, is strongly discouraged on the Datallodes, because HDFS already has replication and error-checking built-in, but using RAID on the NameNode is strongly recommended for additional reliability. The storage and computational capabilities of the Hadoop system 110 scale with the addition of hosts to a Hadoop cluster and can reach volume sizes of petabytes on clusters with thousands of hosts.
The HDFS is optimized for high throughput and works best when reading and writing large files (gigabytes and larger). The HDFS leverages unusually large (for a filesystem) block sizes and data locality optimizations to reduce network input/output (I/O). Scalability and availability are key traits of the HDFS, and are achieved in part due to data replication and fault tolerance. The HDFS replicates files for a configured number of times, is tolerant of both software and hardware failures, and automatically re-replicates data blocks on nodes that have failed. The logical components of the HDFS include the NameNode and Datallode.
In an example embodiment, an HDFS client communicates with the NameNode for metadata-related activities, and to Datallodes to read and write files. The HDFS NameNode keeps in memory the metadata about the filesystem, such as which Datallodes manage the blocks for each file. The Datallodes communicate with each other for pipeline file and reads and writes. Files are made up of blocks, and each file can be replicated multiple times, meaning there are many identical copies of each block for the file, which by default are three copies.
The MapReduce is a batch-based, distributed computing framework. For example, it may allow parallel processing over a large amount of raw data, such as combining web logs with relational data from an OLAP database to model how a user interacts with a website. The MapReduce model simplifies parallel processing by abstracting away the complexities involved in working with distributed systems. The role of a programmer is to define a map and reduce functions, where the map function outputs key/value tuples, which are processed by reduce functions to produce the final output. In operation, a client submits a MapReduce job, which is received by a Hadoop master. The Hadoop master de-composes the job into map and reduce tasks, and schedules them for remote execution on the slave nodes.
The map function takes as input a key/value pair, which represents a logical record from the input data source. In the case of a file, this could be a line, or it could be a row if the input source is a table in a database. The map functions produce zero or more output key/value pairs for that one input pair. For example, if the map function is a filtering map function, it may only produce output if a certain condition is met. Or the map function could be performing a de-multiplexing operation, where a single input key/value yields multiple key/value output pairs.
The shuffle and sort phases, which occur between the map output and the reduce input, are responsible for two functions: determining the reducer that should receive the map output key/value pair (called partitioning); and ensuring that, for a given reducer, all its input keys are sorted. The reduce function is called once per unique map output key.
The reduce function can also output zero to many key/value pairs. The reducer output can be written to flat files in HDFS, can insert/update rows in a NoSQL database, or write to any data sink, depending on the requirements of the job.
Moving data in and out of Hadoop system 110 may be referred to as data ingress and egress and represents the process by which data is transported from an external system into Hadoop system 110, and vice versa. Hadoop system 110 supports ingress and egress at a low level in HDFS and MapReduce. Files may be moved in and out of HDFS, and data may be pulled from external data sources and pushed to external data sinks using MapReduce. For example embodiments, Hadoop system 110 data sources may include log data, files, HBase/NoSQL data, and OLTP data. The log data (including log collectors) and files (including file ingress) may be transported to HDFS. The data stored in HBase/NoSQL and/or OLTP may be transported to MapReduce. In further embodiments, data may be transported out of the Hadoop system 110 from HDFS to files, and transported out of the Hadoop system 110 from MapReduce to be stored in HBase/NoSQL and/or OLTP/OLAP databases.
The cube store 120 is a distributed column-oriented database built on top of the HDFS in an example embodiment. The cube store 120 may be an HBase data cube with a Hadoop application capable of real-time read/write random access to very large datasets. The cube store 120 scales linearly by adding nodes. The cube store 120 may not relational and may not support SQL. The cube store 120 may host very large, sparsely populated tables on clusters made from commodity hardware.
The data cube 120 provides multidimensional storage and is designed for high performance and high availability. The main focus of the cube store 120 is on Create, Read, Update, and Delete (CRUD) operations on wide sparse tables. Similar to the HDFS, the cube store 120 implements a master/slave architecture. In example embodiments, the cube store 120 may leverage the HDFS for its persistent data storage. This allows the cube store 120 to leverage many advanced features that the HDFS provides, including checksums, replication, and failover. The data management of the cube store 120 may be implemented by distributed region servers, which are managed by a cube store master. In an example embodiment, the cube store master node is responsible for orchestrating a cluster of one or more region server slaves. The cube store master is responsible for bootstrapping a virgin install, for assigning regions to registered region servers, and for recovering region server failures. The master node may be lightly loaded while the region servers may carry zero or more regions and may field client read/write requests. The region servers may also manage region splits, informing the cube store 120 master about new daughter regions.
Both HDFS and the cube store 120 may be used for data storage. The HDFS may be used for storing huge amounts of data with mostly sequential access, whereas the main strength of cube store 120 is fast random access to data. Business solutions may combine the best capabilities of HDFS and cube store 120 to meet their data storage needs.
Applications may store data in the cube store 120 into labeled tables, which include rows and columns. In one embodiment, the cube store 120 may be an HBase data cube having tables referred to as HBase tables. The table cells represent the intersection of row and column coordinates and are versioned. By default, their version is a timestamp auto-assigned by the cube store 120 at the time of cell insertion. A cell'"'"'s content is an uninterpreted array of bytes.
The table rowkeys may also represent byte arrays. In example embodiments, the rowkeys may range from strings to binary representations of long or even serialized data structures. The HBase table rows are sorted by the rowkey, which is the table'"'"'s primary key. The sort is byte-ordered. All HBase table accesses are via the table primary key.
The row columns are grouped into column families. All column family members have a common prefix. The column family prefix maybe composed of printable characters. The qualifying tail, which is the column family qualifier, can be made of any arbitrary bytes. An HBase table'"'"'s column family members may be specified up front while defining the HBase table schema definition. However, new column family members can be added on demand. Physically, all column family members are stored together on the filesystem. For example, the storage underlying the cube store 120 may be the HDFS within the Hadoop system 110.
The HBase tables may be similar to a relational database management system (RDBMS), with the exception that cells are versioned, rows are sorted, and columns can be added on the fly by the client as long as the column family they belong to preexists.
The HBase tables are automatically partitioned horizontally by the cube store 120 into regions. Each region comprises a subset of the HBase table'"'"'s rows. As the HBase table grows, the number of regions grows. Regions are the units that get distributed over an HBase cluster within the cube store 120. An HBase table that is too big for any one server can be carried by a cluster of servers, with each node hosting a subset of the HBase table'"'"'s total regions. As such, the load of the table may be distributed over several servers.
The Hadoop OLAP engine 190 includes a server 130, a query engine 140, a metadata engine 150 and a cube build engine 160 in an example embodiment. The Hadoop OLAP engine 190 provides an SQL interface and enables multi-dimensional analysis (with OLAP technology) using the cube store 120 for scale-out big data analysis. In an example embodiment, the Hadoop OLAP engine 190 is built on top of the Hadoop system 110 and the cube store 120, with low latency and high concurrency for PB size data analysis. The Hadoop OLAP engine 190 may provide a standard and easy to use interface. In an example embodiment, an SQL interface is enabled with a Java database connectivity (JDBC) or open database connectivity (ODBC) driver 142, which may be referred to as the JDBC/ODBC driver 142. The JDBC/ODBC driver 142 may support JDBC, ODBC, or both JDBC and ODBC. In example embodiments, the Hadoop OLAP engine 190 may be tightly integrated with front-end tools such as BI platforms or SQL-based tools 180. The Hadoop OLAP engine 190 reduces data movement and accelerates time-to-market of data. In other example embodiments, the cube store 120 provides better performance than other solutions and supports up to terabyte (TB) size data cubes. Concurrency is also provided in various embodiments. In other embodiments, the cube store 120 definitions support metadata. The Hadoop OLAP engine 190 is driven by the metadata that will translate the SQL query into a cube store query.
In an example embodiment, one or more features of the Hadoop OLAP engine 190 are configured to include: a full OLAP Analysis Engine (e.g., the OLAP Engine 190) on top of the Hadoop system 110 and the cube store 120; a unified SQL interface for business analysts and developers (e.g., thru JDBC/ODBC driver 142); support for a routing query between the Hadoop OLAP Engine 190, the Hadoop system 100, and the cube store 120; a low latency and high concurrency architecture; and a scalable architecture for to scaling-out TB to PB size analysis.
The storage engine 145 may be used to isolate the query engine 140 from the underlying the cube store 120. The storage engine 145 provides aggregated data over data path 144 to the routing engine 143. For an example embodiment, the HBase Schema for the storage engine 145 is shown in
In an example embodiment, the server 130 offers web service through Representational State Transfer (REST) protocol and enables a third party to access those services via open application programming interface (API) over data path 171.
In other embodiments, a user accessing a 3rd party application 170 via an API over a data path 171 may request BI information from server 130, as shown in
The pre-aggregated data cube refers to a data modeler can define their data model (the metadata part) and store the metadata part in the Hadoop OLAP system 100. The cube build engine is then capable of running backend jobs to pre-calculate and aggregate data, and then storing the final result in the cube store 120. The runtime-aggregate means the Hadoop OLAP system 100 has access to the user'"'"'s query history and, based on that query pattern, is capable of generating metadata automatically, then calling the cube build engine to build such data cube.
In an example embodiment, the routing engine 143 allows a user to run the same SQL query on the Hadoop system 110 and the cube store 120. When the data is already stored in the cube store 120, the routing engine 143 may directly access the cube data from the cube store 120 and respond back to the query engine 140 within seconds latency (e.g., over data path 121). If the cube data has not been materialized (e.g., built into the cube store 120), then the routing engine 143 may access a Hadoop query interface (e.g., the Hive and the Tez—not shown) and provide data back to the client within minutes latency. The Hive or Apache Hive data warehouse software facilitates querying and managing large datasets residing in distributed storage. The Tez or Apache Tez generalizes MapReduce paradigm and allows for a complex directed-acyclic-graph of tasks for processing data. In one embodiment, the requested data may be provided to query engine 140 from the Hadoop system 110 over data path 141. The data path 141 may be considered a mid-latency path and provide the requested data within minutes.
In one example, the cube store 120 receives key/value data from the data cube build engine 160 over data path 161. The Hadoop HDFS 110a, as shown in
In an example embodiment, a star schema is used by the Hadoop system 110 to build cuboids. One data cube stored in the cube store 120 may be represented by many cuboids.
The dimension tables 451-455 provides examples of dimension tables for 5 different dimensions. A dimension is a structure usually composed of one or more hierarchies that categorize data. The primary keys of each of the dimension tables 451-455 are part of the composite primary key of the fact table. Dimensional attributes help to describe the dimensional value. They are normally descriptive, textual values. Dimension tables are generally smaller in size then fact table. In one example, a fact table may store data about sales, while the dimension tables may store data about geographic regions (e.g., markets, cities), clients, product, times, and channels. The star schema format is commonly used in data warehouse implementations, and are widely supported by many BI tools.
In an example embodiment, there are three dimensions—product, customer and date. The fact is a sale of product to a customer on a date. The measure could be the number of items sold and the total price. To provide consistent performance, an OLAP system, such as the Hadoop OLAP system 100, stores and maintains aggregations for all possible (or almost all) subsets of dimensions. A cube based on a subset of dimensions is called a cuboid.
In various embodiments, a data cube may be represented by a lattice of cuboids.
The cube lattice 400 includes 4 dimensions. The dimensions shown in
In an example embodiment, building the cube includes generating N2 cuboids for a multi-dimensional cube lattice having N dimensions during the multi-stage MapReduce job having N+1 stages such that cuboids having N dimensions are generated at the first stage of N+1 stages, cuboids having N−1 dimensions are generated at the second stage of N+1 stages, and so forth until a zero-dimensional cuboid referred as the apex is generated at the last stage of the N+1 stages.
During a multi-stage MapReduce job to build a data cube, the cuboids are built in stages. In various embodiments, the multi-stage MapReduce job may include one or more MapReduce jobs at each stage.
A user 195 may write an SQL query based on a star schema. The query engine 140 (which may be referred to as an OLAP engine) may translate the SQL query to an HBase query in an example embodiment.
In the example shown in
A data cube is eventually stored in one or more tables in the data store 120, such as an HBase table. For each n-D cuboid, the cube data is generated and stored in HDFS temporary using a sequence file format. The sequence file format is then converted to an HFile and then loaded into the cube store 120. In example embodiments, the data cubes are generated and built by the data cube build engine 160. For other embodiments, the HBase table may be created prior with pre-split regions, and then loading the data into the HBase table using an HBase bulk load. In an example embodiment, the HBase table may be created by the metadata definition and split regions by the cube build engine 160.
For high dimensional schemas having high cube dimensions, full materialization may not be performed. Two alternative solutions may be used to reduce the cube size: partial materialized and shell fragment. Partial materialized is used to materialize a subset of cuboids. The query engine 140 may do some runtime aggregation based on an ancestor cuboid. The only schema difference between full and partial materialization is the table record in which cuboids are materialized. Shell fragment refers to vertically partitioning a high dimensional dataset into a set of disjointed low dimensional datasets called fragments. These shell fragments are pre-computed offline and are used to compute queries in an online fashion.
Since N dimensions will generate 2N cuboids, (e.g., 4 dimensions will generate 16 cuboids), it may be too costly (in terms of processing time and intermediate file size) to generate all cuboids in one map-reduce stage. In one embodiment, cuboids may be generated by a multi-stage MapReduce job, where each stage will only aggregate one set of dimensions. Referring to the multi-stage MapReduce job example shown in
In an example embodiment, the metadata engine generates the cube metadata and the cube build engine generates the cube data for a cube based on the cube metadata (received from the metadata engine) and the source data. The cube build engine then performs a multi-stage MapReduce on the source data to produce a multi-dimensional cube lattice having multiple cuboids. The cube data generated is provided to the cube store.
In an example embodiment, an incremental build methodology for cube store 120 may be used to avoid running a huge job against the entire dataset. The incremental build methodology may refresh the dataset with updated data specified by the designer of the cube store 120. The cube store 120 may be partitioned by time slot. The query engine 140 may also aggregate the data partition during runtime. The incremental refresh methodology may be referred to as a materialization algorithm used to “append & merge.” The term “append” refers to generating a new data cube using a minimum time slot (e.g., day). The data cube may be created only once and refreshed periodically. The term “merge” refers to merging the cube data from the small time slot (e.g., day) to the cube data from the large time slot (e.g. week/month/quarter/year), where a granularity of the merging time slot is configurable.
The high cardinality dimension may increase the data size of the data cube greatly. In one embodiment, constraints are placed on the materialization of high cardinality dimensions.
The “high cardinality dimension” and “materialization level on high cardinality” may be configured in the cube metadata. The build time and run time may be used for partial materialization. The cube build engine 160 may only materialize the cuboids that aggregate on high cardinality dimensions. For example, if “leaf category” and “day” are high cardinality dimensions and “item condition” and “seller segment” are low cardinality dimensions, the following cuboids will be materialized—[leaf category, item condition, seller segment], [day, item condition, seller segment]. The following cuboids will not be materialized—[leaf category, day, item condition], [leaf category, day, seller segment]. The query engine 140 may choose the closest cuboid to run the aggregation. If the group by does not contain the “high cardinality dimension,” the full materialization of the cuboid may be selected. Alternatively, the smallest partial cuboid that contains the “high cardinality dimension” may be selected.
For example, a total of x dimensions are provided, and the x dimensions are divided into 3 parts, as shown by dimensions 610, 620 and 630 in
In this example, the total number of cuboids to be materialized is reduced to (21-1)+(2m−1)+2n, compared to the original 21+m+n.
The Hadoop system 110 includes the MapReduce, which performs the MapReduce jobs. The output of the MapReduce jobs may be stored in HDFS using a sequence file format, and eventually converted to HFile to be stored in tables in the the cube store 120.
A basic MapReduce algorithm for generating cube data having multiple cuboids is described below.
It should be noted that this algorithm only works for algebraic and distributive measures. The definition of distributive, algebraic, and holistic measure are as follows:
Distributive: An aggregate function is distributive if it can be computed in a distributed manner as follows. Suppose the data are partitioned into n sets. We apply the function to each partition, resulting in aggregate values. If the result derived by applying the function to the n aggregate values is the same as that derived by applying the function to the entire data set (without partitioning), the function can be computed in a distributed manner. For example, sum( ) can be computed for a data cube store 120 by first partitioning the cube store 120 into a set of subcube stores 120, computing sum( ) for each subcube store 120, and then summing up the counts obtained for each subcube store 120. Hence, sum( ) is a distributive aggregate function. For the same reason, count( ), min( ), and max( ) are distributive aggregate functions. By treating the count value of each nonempty base cell as 1 by default, count( ) of any cell in a cube store 120 can be viewed as the sum of the count values of all of its corresponding child cells in its subcube store 120. Thus, count( ) is distributive. A measure is distributive if it is obtained by applying a distributive aggregate function. Distributive measures can be computed efficiently because of the way the computation can be partitioned.
Algebraic: An aggregate function is algebraic if it can be computed by an algebraic function with M arguments (where M is a bounded positive integer), each of which is obtained by applying a distributive aggregate function. For example, avg( )(average) can be computed by sum( )/count( ), where both sum( ) and count( ) are distributive aggregate functions. Similarly, it can be shown that min NO and max NO (which find the N minimum and N maximum values, respectively, in a given set) and standard deviation( ) are algebraic aggregate functions. A measure is algebraic if it is obtained by applying an algebraic aggregate function.
Holistic: An aggregate function is holistic if there is no constant bound on the storage size needed to describe a sub-aggregate. That is, there does not exist an algebraic function with M arguments (where M is a constant) that characterizes the computation. Common examples of holistic functions include median( ), mode( ), and rank( ). A measure is holistic if it is obtained by applying a holistic aggregate function.
Star schemas are often used by OLAP systems to build proprietary OLAP cubes efficiently. A star schema consists of one or more fact tables referencing any number of dimension tables. The star scheme resembles a fact table at its center and the dimension tables surrounding it represent the star'"'"'s points. The star scheme separates business process into facts, which hold the measurable, quantitative data about a business, and dimensions, which are descriptive attributes related to fact data. Examples of fact data include sales price, sale quality, time, distance, speed, and weight measurements. Related dimension attribute examples include product models, product colors, product sizes, geographic locations, and salesperson names. Measures are derived from the records in the fact table, and dimensions are derived from the dimension tables. The elements of a dimension can be organized as a hierarchy (for example, as a set of parent-child relationships).
The fact tables generally consist of numeric values and foreign keys to dimensional data where descriptive information is stored. The fact tables may be assigned a surrogate key to ensure each row can be uniquely identified. The dimension tables usually have a relatively small number of records compared to the fact tables. The records in the dimension tables may have a very large number of attributes to describe the fact data. The dimensions can define a wide variety of characteristics. The dimension tables are generally assigned a surrogate primary key, usually a single-column integer data type, mapped to the combination of dimension attributes that form the natural key.
The star schema data stored in the Hadoop system 110 includes a fact table. An example fact table 710 is illustrated in
In MapReduce, data are defined as (key, value) pairs. Mapper takes one pair of data with a type in one data domain, and returns a list of pairs in a different domain:
- Map (k1, v1)->list of (k2, v2)
After that, the MapReduce framework collects all pairs with the same key (k2) from all lists and groups them together, creating one group for each key (k2), Reducer is then applied in parallel to each group, which in turn produces a collection of values in the same domain:
- Reduce (k2, list of v2)->list of (v3)
Thus, the MapReduce framework transforms a list of (k,v) pairs into a list of values. For the example shown in
FIG. 8, k1 is key 821, v1 is value 822, k2, is key 831, v2 is values 832 and the list of v3 is shown by the reduce phase output key/value 840. MapReduce may be referred to as a 5-step parallel and distributed computation:
- 1. Prepare the input for Mapper: the MapReduce framework designates Map processors, assigns the input key (k1) value each Mapper would work on, and provides that Mapper with all input data associated with that key value.
- 2. Run the user-provided Mapper code: Map( ) is run exactly once for each key (k1) value, generating output organized by key (k2) values.
- 3. Shuffle the Mapper output to Reducers: the MapReduce framework designates Reduce processors, assigns the key (k2.) value each Reducer would work on, and provides that Reducer with all the Mapper-generated data associated with that key value.
- 4. Run the user-provided Reducer code: Reduce( ) is run exactly once for each key (k2) value, generating the output value (v3).
- 5. Produce the final output: the MapReduce framework collects all the Reducer output, and sorts it by key (k2) value to produce the final outcome.
The Map( ) procedure performs filtering and sorting (e.g. sorting students by last name into queues, one queue for each name). The Reduce( ) procedure performs a summary operation counting the number of students in each queue, yielding name frequencies)
- Map (k1, v1)->list of (k2, v2)
Several challenges from the basic algorithm are described below. The first challenge arises from the large size of intermediate data being generated from the map phase, which measures at |C|×|D|, where |C| is the number of regions in the cube store 120 lattice and |D| is the size of the input data. Since |C| increases exponentially with both the number and depth of dimensions to be explored, this approach can quickly lead to the system running out of disk space during the map phase or struggling through the shuffle (i.e., sort) phase.
The second challenge arises from cube store 120 groups belonging to the data cube regions at the bottom part of the data cube lattice. The reducer that is assigned the latter group essentially has to compute the measure for the entire dataset, which is usually large enough to cause the reducer to take a significantly longer time to finish than others or even fail. As the size of the data increases, the number of such groups also increases.
The third challenge is that, for an n-dimension data cube, the full data cube will include 2n cuboids. The data cube build algorithm should be optimized for big dimensions. The data cube build algorithms should be able to support incremental data cube building to reduce the cost of building big data sets.
The rowkey data model for the Hadoop OLAP engine 190 is described below. A well designed rowkey model to store cube data in the cube store 120 provides fast query performance. The cube data is eventually stored in cube tables such as HBase tables. For each n-D cuboid, there will be two steps performed by the data cube build engine 160: (1) generate the cube data and store it in HDFS using sequence file format; and (2) convert the sequence file format to HFile and load it to the data store 120. To optimize performance, the cube tables may be created prior with pre-splitting the regions. The cube data is then loaded into the cube table using a bulk load command such as an HBase Bulk Load command. In one embodiment, the rowkey design includes three parts: the rowkey header, the cuboid ID, and the rowkey body. The high cardinality dimensions (such as seller_id) may be included in the headers. Other performance optimization dimensions or information may be included in the headers.
The first stage 1011 receives source data input (the source HDFS files 1010), performs the MapReduce job 1020 and provides the output HDFS sequence files 1023 to the second stage 1012. The second stage 1012 performs the MapReduce job 1030 and provides the output HDFS sequence files 1033 to the third stage 1013. The third stage 1013 performs the MapReduce job 1040 and provides the output HDFS sequence files 1043 to the next stage, until the last stage 1014 receives the output HDFS sequence files from the previous stage.
The first stage performs the MapReduce job 1021 to transform the HDFS sequence files 1023 to HFiles 1024. The second stage performs the MapReduce job 1031 to transform the HDFS sequence files 1023 to HFiles 1034. The third stage performs the MapReduce job 1041 to transform the HDFS sequence files 1023 to HFiles 1044. The last stage performs the MapReduce job 1051 to transform the HDFS sequence files 1023 to HFiles 1054.
The HFiles 1024, 1034, 1044, and 1054 are uploaded into the HBase table 1060. In some embodiments, these HFiles may be bulk uploaded. The Source HDFS files 1010 are converted to HDFS sequence files (which are temporary files stored in the HDFS) and then converted to HFiles for storage in the HBase table 1060.
In an example embodiment, there are two components: (1) a logical model of the data cube based on the star schema of raw data and (2) a mapping from the data cube to the cube table schema of aggregated data.
The data source module 1110 may provide metadata storage using a JSON file. In one example, all metadata information is stored on a JSON file and each table includes one JSON file to describe the metadata information. The source module 1110 may support a flat schema, where all dimensions and metrics are stored in a single table, and may support a star schema, where all dimension values are stored in a lookup table, the measure values are stored in a fact table, and FK is used to join these tables. The FK refers to one column in the fact table used for look up so that multiple fact tables can be joined.
The cube metadata for various embodiments is described below. The cube metadata is used by the Haddop OLAP Engine 190 to build the data cubes that are stored in the cube store 120. In example embodiments, the metadata engine 150 is configured to generate the metadata for building the data cubes, and the cube build engine 160 is configured to build the data cubes using the metadata and source data (e.g., star schema data received from the Hadoop system 110). The following items are described below: metadata storage, cube metadata definition, cube description, fact table, dimensions, measures, rowkey, storage and a JSON example.
In an example embodiment, the flow diagrams 1400 and 1500, shown in
In an example embodiment, building the cube based on the cube metadata and the source data includes generating N2 cuboids for a multi-dimensional cube lattice having N dimensions during the multi-stage MapReduce job having N+1 stages such that cuboids having N dimensions are generated at the first stage of N+1 stages, cuboids having N−1 dimensions are generated at the second stage of N+1 stages, and so forth until a zero-dimensional cuboid referred as the apex is generated at the last stage of the N+1 stages. In some embodiments, each stage in the multi-stage MapReduce job generates one or more cuboids having the same number of dimensions.
In other embodiments, building the cube based on the cube metadata and the source data includes mapping the cube to one or more cube tables in the cube store. In further embodiments building the cube based on the cube metadata and the source data includes transforming source HDFS files to HFiles for storage in a cube store. In various embodiments, creating, by the cube build engine, one or more HBase tables based on the cube metadata. In some embodiments, creating the one or more HBase tables having split regions.
In various embodiments, building the cube based on the cube metadata and the source data includes building a full materialization of the multi-dimensional cube lattice. In other example embodiments, building the cube based on the cube metadata and the source data includes building a cube representing partial data of the multi-dimensional cube lattice, the partial data including a subset of the cuboids in the multi-dimensional cube lattice. In yet further embodiments, building the cube based on the cube metadata and the source data includes building cuboids based high cardinality dimensions. In yet other embodiments, building the cube based on the cube metadata and the source data includes building cuboids which do not aggregate more than one high cardinality dimension. In another embodiment, building the cube based on the cube metadata and the source data includes building a cube representing partial data of the multi-dimensional cube lattice during build time. In some embodiments, building the cube based on the cube metadata and the source data includes aggregating one or more cubes representing partial data of the multi-dimensional cube lattice during run time in response to a query. Other embodiments for building the cube based on the cube metadata and the source data include incrementally building the cube from the source data partitioned into a plurality of time slot partitioned data. In alternative embodiments, building the cube based on the cube metadata and the source data includes aggregating the plurality of time slot partitioned data during runtime.
With reference to
The client devices 310 and 312 may comprise a mobile phone, wearable computing device, desktop computer, laptop, or any other device that a user, such as user 305 may utilize to access the networked system 302. Various applications may run on the client devices 310 and 312. For example, one or more applications from a publication system 320 and a payment system 322 may be accessible to the user 305 by having a corresponding application running on the client devices 310 and 312. Alternatively, the user 305 may access such applications from the client devices 310 and 312 through a web browser. In an example embodiment, BI Tools 185 (as shown in
An API server 314 and a web server 316 are coupled to, and provide programmatic and web interfaces respectively to, one or more application servers 318. The application servers 318 may reside on server machines (not shown) that host the publication system 320 and the payment system 322, each of which may comprise one or more modules, applications, or engines, and each of which may be embodied as hardware, software, firmware, or any combination thereof. The application servers 318 are, in turn, coupled to one or more database servers 324 facilitating access to one or more information storage repositories or databases 326. The databases 326 may also store user account information of the networked system 302 in accordance with example embodiments.
The databases 326 may store data pertaining to various functions and aspects associated with the client-server-based network architecture 300 and its users. For example, user accounts for users of the networked system 302 may be stored and maintained in the databases 326. Each user account may comprise user data that describes aspects of a particular user, such as the user 305. The user data may include demographic data, user preferences, and financial information. In example embodiments, the databases 326 may represent databases within the Hadoop system 110 and the cube store 120, which may be used to store business information.
In example embodiments, the publication system 320 publishes content on a network (e.g., Internet). As such, the publication system 320 provides a number of publication functions and services to users that access the networked system 302. In example embodiments, the publication system 320 is discussed in terms of a marketplace environment. However, it is noted that the publication system 320 may be associated with a non-marketplace environment such as an informational or social networking environment. In further embodiments, the publication system 320 may be used in an analytics processing environment (e.g., OLAP), which may be used to provide business intelligence information.
The payment system 322 provides a number of payment services and functions to users. The payment system 322 allows users to accumulate value (e.g., in a commercial currency, such as the U.S. dollar, or a proprietary currency, such as “points”) in their accounts, and then later to redeem the accumulated value for products (e.g., goods or services) that are made available via the publication system 320 or elsewhere on a network 304. The payment system 322 also facilitates payments from a payment mechanism (e.g., a bank account, PayPal™, or credit card) for purchases of items via any type and form of a network-based marketplace.
While the publication system 320 and the payment system 322 are shown in
Additionally, a third party application(s) 328, executing on a third party server(s) 330, is shown as having programmatic access to the networked system 302 via the programmatic interface provided by the API server 314. For example, the third party application 328, utilizing information retrieved from the networked system 302, may support one or more features or functions on a website hosted by the third party. The third party website may, for example, provide one or more promotional, marketplace, or payment functions that are supported by the relevant applications of the networked system 302.
Additionally, certain embodiments described herein may be implemented as logic or a number of modules, engines, components, or mechanisms. A module, engine, logic, component, or mechanism (collectively referred to as a “module”) may be a tangible unit capable of performing certain operations and configured or arranged in a certain manner. In certain example embodiments, one or more computer systems (e.g., a standalone, client, or server computer system) or one or more components of a computer system (e.g., a processor or a group of processors) may be configured by software (e.g., an application or application portion) or firmware (note that software and firmware can generally be used interchangeably herein as is known by a skilled artisan) as a module that operates to perform certain operations described herein.
In various embodiments, a module may be implemented mechanically or electronically. For example, a module may comprise dedicated circuitry or logic that is permanently configured (e.g., within a special-purpose processor, application specific integrated circuit (ASIC), or array) to perform certain operations. A module may also comprise programmable logic or circuitry (e.g., as encompassed within a general-purpose processor or other programmable processor) that is temporarily configured by software or firmware to perform certain operations. It will be appreciated that a decision to implement a module mechanically, in dedicated and permanently configured circuitry, or in temporarily configured circuitry (e.g., configured by software) may be driven by, for example, cost, time, energy-usage, and package size considerations.
Accordingly, the term “module” should be understood to encompass a tangible entity, be that an entity that is physically constructed, permanently configured (e.g., hardwired), or temporarily configured (e.g., programmed) to operate in a certain manner or to perform certain operations described herein. Considering embodiments in which modules or components are temporarily configured (e.g., programmed), each of the modules or components need not be configured or instantiated at any one instance in time. For example, where the modules or components comprise a general-purpose processor configured using software, the general-purpose processor may be configured as respective different modules at different times. Software may accordingly configure the processor to constitute a particular module at one instance of time and to constitute a different module at a different instance of time.
Modules can provide information to, and receive information from, other modules. Accordingly, the described modules may be regarded as being communicatively coupled. Where multiples of such modules exist contemporaneously, communications may be achieved through signal transmission (e.g., over appropriate circuits and buses) that connect the modules. In embodiments in which multiple modules are configured or instantiated at different times, communications between such modules may be achieved, for example, through the storage and retrieval of information in memory structures to which the multiple modules have access. For example, one module may perform an operation and store the output of that operation in a memory device to which it is communicatively coupled. A further module may then, at a later time, access the memory device to retrieve and process the stored output. Modules may also initiate communications with input or output devices and can operate on a resource (e.g., a collection of information).
With reference to
The example computer system 1300 may include a processor 1302 (e.g., a central processing unit (CPU), a graphics processing unit (GPU) or both), a main memory 1304 and a static memory 1306, which communicate with each other via a bus 1308. The computer system 1300 may further include a video display unit 1310 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)). In example embodiments, the computer system 1300 also includes one or more of an alphanumeric input device 1312 (e.g., a keyboard), a user interface (UI) navigation device or cursor control device 1314 (e.g., a mouse), a storage unit 1316, a signal generation device 1318 (e.g., a speaker), and a network interface device 1320.
The storage unit 1316 includes a machine-readable storage medium 1322 on which is stored one or more sets of instructions 1324 and data structures (e.g., software instructions) embodying or used by any one or more of the methodologies or functions described herein. The instructions 1324 may also reside, completely or at least partially, within the main memory 1304, 1306, and 1316 or within the processor 1302 during execution thereof by the computer system 1300, with the main memory 1304 and the processor 1302 also constituting machine-readable media.
While the machine-readable storage medium 1322 is shown in an example embodiment to be a single medium, the term “machine-readable storage medium” may include a single medium or multiple media (e.g., a centralized or distributed database, or associated caches and servers) that store the one or more instructions. The term “machine-readable medium” shall also be taken to include any tangible medium that is capable of storing, encoding, or carrying instructions for execution by the machine and that cause the machine to perform any one or more of the methodologies of embodiments of the present embodiments, or that is capable of storing, encoding, or carrying data structures used by or associated with such instructions. The term “machine-readable storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories and optical and magnetic media. Specific examples of machine-readable storage media include non-volatile memory, including by way of example semiconductor memory devices (e.g., Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), and flash memory devices); magnetic disks such as internal hard disks and removable disks; magneto-optical disks; and compact disc read-only memory (CD-ROM) and digital video disc read-only memory (DVD-ROM) disks.
The instructions 1324 may further be transmitted or received over a communications network 304 using a transmission medium via the network interface device 1320 and utilizing any one of a number of well-known transfer protocols (e.g., HTTP). Examples of communication networks include a local area network (LAN), a WAN, the Internet, mobile telephone networks, POTS networks, and wireless data networks (e.g., Wi-Fi and WiMAX networks). The term “transmission medium” shall be taken to include any intangible medium that is capable of storing, encoding, or carrying instructions for execution by the machine, and includes digital or analog communications signals or other intangible medium to facilitate communication of such software.
Although an overview of the inventive subject matter has been described with reference to specific example embodiments, various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of embodiments of the present invention. Such embodiments of the inventive subject matter may be referred to herein, individually or collectively, by the term “invention” merely for convenience and without intending to voluntarily limit the scope of this application to any single invention or inventive concept if more than one is, in fact, disclosed.
The embodiments illustrated herein are described in sufficient detail to enable those skilled in the art to practice the teachings disclosed. Other embodiments may be used and derived therefrom, such that structural and logical substitutions and changes may be made without departing from the scope of this disclosure. The Detailed Description, therefore, is not to be taken in a limiting sense, and the scope of various embodiments is defined only by the appended claims, along with the full range of equivalents to which such claims are entitled.
Moreover, plural instances may be provided for resources, operations, or structures described herein as a single instance. Additionally, boundaries between various resources, operations, modules, engines, and data stores are somewhat arbitrary, and particular operations are illustrated in a context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within a scope of various embodiments of the present embodiments. In general, structures and functionality presented as separate resources in the example configurations may be implemented as a combined structure or resource. Similarly, structures and functionality presented as a single resource may be implemented as separate resources. These and other variations, modifications, additions, and improvements fall within a scope of embodiments of the present embodiments as represented by the appended claims. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.