A system and method is described for database split generation in a massively parallel or distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying functionality. A database table accessor of the system obtains, from an associated client application, a query for data in a table of the data warehouse layer, wherein the query includes a user preference. The system obtains table data representative of properties of the table, and determines a splits generator in accordance with one or more of the user preference or the properties of the table. The system generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits, and outputs the plurality of query splits to an associated plurality of mappers for execution by the associated plurality of mappers of each of the plurality of query splits against the table.
|
8. A system for database split generation in a massively parallel or distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases, the system comprising:
one or more microprocessors; and
a database table accessor running on the one or more microprocessors, wherein the database table accessor operates to perform steps comprising:
obtaining, from an associated client application, a client application original query for blocks of data in a table of the data warehouse layer, the client application original query comprising one or more of query data and/or user preference data, the query data being representative of a user query that selects all columns in the table of the data warehouse layer, and the user preference data being representative of a user preference for a rowid-based splits generator;
obtaining, from the data warehouse layer in accordance with the client application original query for blocks of data in the table, table data representative of one or more properties of the table of the data warehouse layer, the table data comprising files, data blocks, and row numbers for the table;
creating multiple block ranges for the blocks of data in the table in accordance with the table data, wherein each block range has a fixed size of blocks;
creating rowid range data for each of the multiple block ranges, the rowid range data being representative of pseudo columns of the table that serve as unique identifiers for a row of the table;
selecting a rowid-based splits generator based on the data in the table being of a known database chunk size and based on the client application original query comprising the one or more of the query data and/or the user preference data;
using the selected rowid-based splits generator, generating table splits, the table splits dividing the client application original query into a plurality of rowid query splits wherein each rowid query split is associated with a one of the multiple block ranges in accordance with the rowid range data of the respective one of the multiple block ranges; and
outputting the plurality of rowid query splits to a plurality of associated mappers for execution by each of the plurality of associated mappers of the plurality of rowid query splits against a corresponding block range of the data in the table of the date warehouse layer.
15. A non-transitory computer readable storage medium, including instructions stored thereon which when read and executed by one or more computers of a database table accessor in a massively parallel or distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases, cause the one or more computers of the database table accessor to perform the steps comprising:
obtaining, from an associated client application, a client application original query for blocks of data in a table of the data warehouse layer, the client application original query comprising one or more of query data and/or user preference data, the query data being representative of a user query that selects all columns in the table of the data warehouse layer, and the user preference data being representative of a user preference for a rowid-based splits generator;
obtaining, from the data warehouse layer in accordance with the client application original query for blocks of data in the table, table data representative of one or more properties of the table of the data warehouse layer, the table data comprising files, data blocks, and row numbers for the table;
creating multiple block ranges for the blocks of data in the table in accordance with the table data, wherein each block range has a fixed size of blocks;
creating rowid range data for each of the multiple block ranges, the rowid range data being representative of pseudo columns of the table that serve as unique identifiers for a row of the table;
selecting a rowid-based splits generator based on the data in the table being of a known database chunk size and based on the client application original query comprising the one or more of the query data and/or the user preference data;
using the selected rowid-based splits generator, generating table splits, the table splits dividing the client application original query into a plurality of rowid query splits wherein each rowid query split is associated with a one of the multiple block ranges in accordance with the rowid range data of the respective one of the multiple block ranges; and
outputting the plurality of rowid query splits to a plurality of associated mappers for execution by each of the plurality of associated mappers of a rowid query split against a corresponding block range of the data in the table of the data warehouse layer.
1. A method for database split generation in an associated massively parallel or distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases, the method comprising:
obtaining by a database table accessor executing on one or more microprocessors, from an associated client application, a client application original query for blocks of data in a table of the data warehouse layer, the client application original query comprising one or more of query data and/or user preference data, the query data being representative of a user query that selects all columns in the table of the data warehouse layer, and the user preference data being representative of a user preference for a rowid-based splits generator;
obtaining by the database table accessor, from the data warehouse layer in accordance with the client application original query for blocks of data in the table, table data representative of one or more properties of the table of the data warehouse layer, the table data comprising files, data blocks, and row numbers for the table;
creating by the database table accessor multiple block ranges for the blocks of data in the table in accordance with the table data, wherein each block range has a fixed size of blocks;
creating by the database table accessor rowid range data for each of the multiple block ranges, the rowid range data being representative of pseudo columns of the table that serve as unique identifiers for a row of the table;
selecting by the database table accessor a rowid-based splits generator based on the data in the table being of a known database chunk size and based on the client application original query comprising the one or more of the query data and/or the user preference data;
using the selected rowid-based splits generator, generating table splits, the table splits dividing the client application original query into a plurality of rowid query splits wherein each rowid query split is associated with a one of the multiple block ranges in accordance with the rowid range data of the respective one of the multiple block ranges; and
outputting by the database table accessor the plurality of rowid query splits to a plurality of associated mappers for execution by each of the plurality of associated mappers of a rowid query split against a corresponding block range of the data in the table of the data warehouse layer.
2. The method of
3. The method of
4. The method of
5. The method of
6. The method of
the obtaining the table data comprises obtaining table data representative of one or more properties of an external table in a selected data warehouse engine layer; and
the outputting the plurality of query splits comprises outputting the plurality of query splits to the associated plurality of mappers for execution by the associated plurality of mappers as tasks of a selected data processing framework.
7. The method of
determining from the table data whether the table of the data warehouse layer is unpartitioned;
determining from the table data whether the table of the data warehouse layer has a fixed size; and
determining from the table data whether the table of the data warehouse layer has a known database chunk size,
wherein the creating the multiple block ranges, the creating the rowid range data, the selecting the rowid-based splits generator, the generating the table splits, and the outputting the plurality of rowid query splits to the plurality of associated mappers are selectively performed in accordance with the data warehouse layer determined to be unpartitioned, the data warehouse layer determined to have the fixed size, and the table of the data warehouse layer determined to have the known database chunk size.
9. The system of
10. The system of
11. The system of
12. The system of
13. The system of
the obtaining the table data comprises obtaining table data representative of one or more properties of an external table in a selected data warehouse engine layer; and
the outputting the plurality of query splits comprises outputting the plurality of query splits to the associated plurality of mappers for execution by the associated plurality of mappers as tasks of a selected data processing framework.
14. The system of
determining from the table data whether the table of the data warehouse layer is unpartitioned;
determining from the table data whether the table of the data warehouse layer has a fixed size; and
determining from the table data whether the table of the data warehouse layer has a known database chunk size,
wherein the creating the multiple block ranges, the creating the rowid range data, the selecting the rowid-based splits generator, the generating the table splits, and the outputting the plurality of rowid query splits to the plurality of associated mappers are selectively performed in accordance with the data warehouse layer determined to be unpartitioned, the data warehouse layer determined to have the fixed size, and the table of the data warehouse layer determined to have the known database chunk size.
16. The non-transitory computer readable storage medium of
17. The non-transitory computer readable storage medium of
18. The non-transitory computer readable storage medium of
19. The non-transitory computer readable storage medium of
20. The non-transitory computer readable storage medium of
the obtaining the table data comprises obtaining table data representative of one or more properties of an external table in a selected data warehouse engine layer; and
the outputting the plurality of query splits comprises outputting the plurality of query splits to the associated plurality of mappers for execution by the associated plurality of mappers as tasks of a selected data processing framework.
|
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
This application claims the benefit of priority to U.S. Provisional patent application titled “SYSTEM AND METHOD FOR GENERATING DATABASE ROW ID RANGE SPLIT FOR A PARALLEL ENVIRONMENT”, Application No. 62/056,411, filed Sep. 26, 2014, which is herein incorporated by reference.
The embodiments described herein are generally related to data processing, and are particularly related to systems and methods for database split generation in massively parallel or other distributed database environments.
Data processing frameworks are available for distributed storage and processing of large sets of data on commodity hardware. One such data processing framework is Apache Hadoop™ which is an open source framework for distributed storage and processing of large sets of data on commodity hardware. The Hadoop framework can be used to process large amounts of data in a massively parallel or other distributed manner thereby enabling businesses to quickly gain insight from massive amounts of both structured as well as unstructured data.
The Hadoop framework is enterprise ready in part because it provides for the storage and processing of vast quantities of data in a storage layer that scales linearly. In this regard, Hadoop Distributed File System (HDFS) is a technology providing for efficient scale out of a storage layer. Environments such as HDFS provide a fault-tolerant environment which is designed to be deployed within a distributed computing infrastructure, using relatively low-cost commodity hardware. Such an environment provides high throughput access to application data, and is particularly suitable for applications that have very large data sets (e.g., machine learning).
Many specialized engines are available for enabling interaction with the data in a wide variety of ways including batch access, real-time access, and combinations of batch and real-time access. Apache Hive™ is the most widely adopted technology for accessing massive amounts of data such as might be organized and stored in Hadoop and is, essentially, a data warehouse having tables similar to tables in a relational database. Engines such as Hive enable easy data summarization and ad-hoc/interactive queries via a structured query language (SQL) like interface for large datasets (e.g., petabytes of data) stored in HDFS.
Table and storage management interface layers such as the HCatalog interface enable users with different data processing tools to more easily read and write data relative to the Hadoop environment. HCatalog uses Hive's command line interface for issuing commands to define data and to explore metadata.
Latency for Hive queries, however, is generally very high even for relatively small data sets owing in part to the batch processing of Hadoop jobs which can at times incur substantial overheads in job submission and scheduling. In addition, tools such as HIVE that use a database abstraction layer such as HCatalog can divide a query into multiple pieces and execute them separately against a database. However, these queries are not executed atomically but instead are executed at different points in time. As such, the results of each query when combined could violate the read-consistent rule relative to database retrieval protocol rules.
In accordance with an embodiment, described herein is a system and method for database split generation in a massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases. In an example embodiment, the system includes one or more microprocessors and a database table accessor running on the one or more microprocessors. The database table accessor operates to obtain, from an associated client application, a query for data in a table of the data warehouse layer, wherein the query comprises query data representative of a user query and user preference data representative of a user preference. The database table accessor further operates to obtain table data representative of one or more properties of the table, and to determine a splits generator in accordance with one or more of the user preference or the one or more properties of the table. The database table accessor operates to generate, by the selected splits generator, table splits dividing the user query into a plurality of query splits, and to output the plurality of query splits to an associated plurality of mappers for execution by the associated plurality of mappers of each of the plurality of query splits against the table. The table splits may be one or more of partition-based splits, size-based splits, ROWID-based splits or others as may be necessary or desired.
In accordance with a further embodiment, described herein is a system and method for database split generation and consistent reads in an associated massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases. In an example embodiment, the system includes one or more microprocessors and a database table accessor running on the one or more microprocessors. The database table accessor operates to obtain, from an associated client application, a query for data in a table of the data warehouse layer, wherein the query comprises query data representative of a user query and user preference data representative of a user preference. The database table accessor further operates to obtain table data representative of one or more properties of the table, and to determine a splits generator in accordance with one or more of the user preference or the one or more properties of the table. The database table accessor further operates to obtain, from the data warehouse layer, record current system change number (SCN) data, the SCN data being representative of a logical internal time stamp used by the plurality of databases of the associated massively parallel or other distributed database environment. The database table accessor operates to generate, by the selected splits generator, table splits dividing the user query into a plurality of query splits, to associate the SCN data with each of the plurality of query splits, and to output the plurality of query splits together with the SCN data to a plurality of associated mappers for execution by the plurality of mappers against the table as query tasks using the SCN data to provide consistent reads between the query tasks.
In accordance with a further embodiment, described herein is a system and method for high-speed data transfer from JDBC to a data warehouse layer as will be shown and described below.
In accordance with a further embodiment, described herein is a system and method for query processing with table-level predicate pushdown as will be shown and described below.
In accordance with a further embodiment, described herein is a system and method for efficient connection management in a distributed database environment as will be shown and described below.
In accordance with an embodiment, described herein is a system and method for database split generation in a massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases.
In accordance with an embodiment, a data processing infrastructure, such as Hadoop, can include components that are central to effectively dealing with petabyte-scale problems: a distributed file system to provide fault-tolerant storage while scaling horizontally, and a parallel processing framework that can break processing jobs into tasks and distribute the tasks across a data processing cluster, or a massively parallel or other distributed environment.
In accordance with an embodiment, a data processing job can include several types of tasks including: a map task that filters and interprets input data to produce key-value pairs; and a reduce task that summarizes and aggregates the map results to produce final outputs.
To better define data processing jobs in a data processing framework, a plurality of application program interfaces (APIs) have been developed to allow users and developers to express their data processing jobs in the language they deem most suitable. As an illustrative example, Hive is a data warehouse system that provides such an API, wherein the API can be used to facilitate querying and managing large datasets using an SQL-like language called HiveQL™, wherein the datasets can either reside in a Hadoop distributed file system or any other equivalent different system.
In accordance with an embodiment, when data to be queried is stored in a relationship table, such as an Oracle™ database table, and particularly when the table is large, a query is broken into multiple query splits for use by the massively parallel or other distributed environment.
In accordance with an embodiment, described herein is a system and method for database split generation in a massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases.
Dynamic Database Split Generation
In accordance with an embodiment, described herein is a system and method for strategically and dynamically generating input splits based on table properties and user preferences for use in a massively parallel or other distributed environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases.
In accordance with an embodiment, the system includes a database table accessor and a data warehouse layer, where the database table accessor, upon receiving a query for data in a table, can select a splits generator based on properties of the table and user preferences, to generate table splits and split the query into one or more query splits in accordance with the table splits. Each query split can then be executed against an external table created in the data warehouse layer to retrieve data from the table for processing.
In accordance with an embodiment, the database table accessor can include a splits generators component with an enumeration of splitter kinds indicating user hints, each splitter kind associated with a corresponding splits generator. In accordance with an embodiment, given a name of a splitter kind, the splits generators component can return an appropriate splits generator.
Additionally, the database table accessor can include an input format component responsible for generating query splits itself or invoking a splits generator to generate the query splits.
In accordance with an embodiment, the external table can be created at a user interface and managed by the database table accessor. Additionally, the external table can include a user-defined splitter kind as a property. In accordance with an embodiment, metadata of the external table can be stored in the data warehouse layer and used to access data in the database table.
In accordance with an embodiment, when creating table splits of a table, the table is logically split so that each split of the table can be accessed from a query level via an external tool such as, for example, HIVE or any other similar or equivalent technology tools for accessing massive amounts of data such as might be organized and stored in Hadoop enabling easy data summarization and ad-hoc/interactive queries via a SQL-like interface for large datasets (e.g., petabytes of data) stored in HDFS.
In accordance with an embodiment, a table can be split based on various splitter kinds, which indicate a user's preferences how the table should be split. In accordance with an embodiment, the splitter kinds can include splitting a table based on partitions, sizes, row limits and ROWID ranges. The database table accessor, when splitting a table, additionally takes considerations of properties of the table, and can strategically and dynamically split the table based on these properties
As an illustrative example, the database table accessor may split a partitioned table differently, even with a user hint that the table be split based on a ROWID range. In accordance with an embodiment, splitting a partitioned table by a ROWID range could generate duplicate rows in two different splits, causing problems in the reduce/aggregation phase in a map reduce job.
In accordance with an embodiment, the database table accessor can use a strategy or heuristic to split a table based on a plurality of factors, including a user hint, the size of the table, whether the table is partitioned, whether splitting the table in a particular way can improve the overall performance of the system. For example, if a table is small, the database table accessor can take the whole table as a single split and provide the split to one map reduce job for processing.
In accordance with an embodiment, the above-described approach provides an architecture for dynamically generating query splits based on table properties and user hints, and for efficiently creating new split generators. In addition, the system is highly configurable with additional user preferences and associated splits generators to accommodate various requirements of users or client applications.
As shown in
In accordance with an embodiment, the data requested from the table 105 can be passed 171 to a data processing cluster (e.g., a Hadoop cluster) 172 for processing by map reduce jobs, e.g., 174, distributed across the cluster. The aggregation outputs can then be returned 173 to the system for presentation to the client application 122.
As further shown in
Listing 1, as shown below, illustrates an implementation of the splits generators component in accordance with an embodiment.
Listing 1
public enum SplitsGeneratorKind {
/**
* Generates one Split.
*/
SIMPLE(new OracleSimpleSplitsGenerator( ))
private OracleSplitsGenerator generator;
SplitsGeneratorKind(OracleSplitsGenerator value) { generator =
value; }
/**
* Obtain an InputSplit generator for a given splitter kind.
*
* @return an instance of OracleSplitsGenerator
*/
OracleSplitsGenerator getGenerator( ) { return generator; }
As shown in in Listing 1 above, in accordance with an embodiment, the splits generators component can return a simple splits generator for generating a single split, when the table includes a smaller number of rows; or an appropriate splits generator for a given splitter kind.
As further shown in
In accordance with an embodiment, the splits generator selection logic 129 can select a splits generator using a pre-defined strategy in combination with properties of a table and/or user preferences retrieved 151 from the data warehouse layer 108. In accordance with an embodiment, once a selection is made, the input format component can obtain 117 the selected splits generator from the splits generators component 112 using the corresponding splitter kind.
In accordance with embodiment, an example implementation of the input format component can be illustrated using pseudocode as shown in Listing 2:
Listing 2
fetchTableProperties( );
if TABLE_PARTITIONED then
Use PartionedSplitsGenerator;
else if FULL_SELECT AND SPLIT_HINT = ROWID_RANGE then
Use RowidRangeSplitsGenerator;
endif
InputSplits splits = splitsGenerator.getGenerator( ).getInputSplits(...);
As shown in Listing 2, when the input format component is invoked, properties of a database table are fetched and examined, and internal logic is used to select an appropriate splits generator based on user preferences (user “hints”) and/or table properties. For example, if the database table is partitioned, the database table accessor 110 can select a partition-based splits generator; if a query is received for data in the table based on a user-defined size enabling the table to be split into multiple ranges for optimal processing, the database table accessor 110 can select a size-based splits generator; and if a query received is for selecting all rows in a table, and a user preference or hint received is to split the table by a ROWID range, the database table accessor 110 can select a ROWID range based splits generator. In accordance with an embodiment, a plurality of other types of splits generators can be chosen based on the table properties and the user preferences or hints and/or the table properties as may be necessary or desired. Once an appropriate splits generator is selected, it can be used to generate splits of the table, and to split the query into a plurality of query splits in accordance with the generated table splits.
In an accordance with an embodiment, each splits generator can implement a common interface, e.g., OracleSplitsGenerator, and can include a method, e.g., getInputSplits( ), which returns the InputSplits generated by the splits generator. Similarly, each query split can implement a common interface, e.g., OracleHiveSplit, which can include a getSqlStringToAppend( ) method and a getBinds( ) method, wherein the former method returns a split specific SQL query, i.e. a InputSplits, and the latter method returns binds specific to a InputSplits.
In accordance with an embodiment, the data warehouse layer 108, e.g., HIVE, can be an abstraction layer over the data processing cluster, and enable accessing the database 104 using SQL queries while keeping transaction models in a transaction. As shown in
In accordance with an embodiment, an external table 146 is selectively created in the data warehouse layer 108 using the database table accessor 110, where definitions of the external table stored in the metadata store 150 can be used to access data in the database table 105. In accordance with an embodiment, data of the database table 105 would not be deleted if the external table is dropped. In accordance with an embodiment, the columns of the external table 146 can be the same with those of the database table 105, but the types of a particular column can be different in the two tables 146, 105.
In accordance with an embodiment, a query can be executed against the external table 146 to retrieve data from the database table, i.e. 105. In accordance with an embodiment, the data warehouse layer 108 can access the database 104 via a data source abstraction component 106, e.g., HCatalog. The data source abstraction component 106 can present users with a relational view of data from various types of data sources (e.g., database or files) and ensure that users need not be concerned with where or in what format the data is stored.
In accordance with an embodiment, the database table accessor 110 can use a data definition language (DDL), e.g., HIVE DDL, to manage definitions in both the metadata store 150 and the database metadata simultaneously and consistently. In accordance with an embodiment, the database table accessor 110 can associate itself with the external table 146 using e.g., a STORED BY clause when the external table is created.
As an illustrative example, an external table can be created in the data warehouse layer 108 using a DDL syntax shown in Listing 3:
Listing 3
CREATE EXTERNAL TABLE sales_test (
prod_id int,
cust_name
STRING,
TIME_ID
timestamp
) STORED BY ‘oracle.hcat.osh.OracleStorageHandler’
TBLPROPERTIES (
‘oracle.jdbc.url’ = ‘jdbc:oracle:thin:@localhost:1521:orcl’,
‘oracle.jdbc.username’ = ‘scott’,
‘oracle.jdbc.password’ = ‘tiger’,
‘oracle.hcat.osh.tableName’ = ‘sales_test’,
‘oracle.hcat.osh.splitterKind’ = ‘ROWID_RANGE’
)
In accordance with an embodiment, in Listing 3, an external table “sales_test” is created with column names “prod_id”, “cust_name” and “TIME_ID” and managed by a database table accessor “oracle.hcat.osh.OracleStorageHandler”. Additionally, the external table includes a plurality of properties, such as the name of the database table and a user hint that the database table should be split by a ROWID range.
In accordance with an embodiment, the metadata of the external table is stored in the metadata store 150 in the data warehouse layer 108. When a select query is executed against the external table 146, the table metadata is used to connect to the database 104 to fetch data from a table based on selected criteria such as, for example, a ROWID_Range, and present the data in the data warehouse layer 108.
As further shown in
As shown in
At step 213, an external table 146 (
At step 215, the database table accessor 110 receives a query 124 that selects all rows in the HIVE/HCatalog table, and obtains properties of the table and the user preference.
At step 217, the database table accessor 110 selects a splits generator based on the table properties and the user preference.
At step 219, the database table accessor 110 uses the selected splits generator 121 to split the query into multiple query splits 128, 130, or 140.
At step 221, each query split is provided to a record reader 152, 154, or 160 that executes that query split against the external table 146.
At step 223, records from the database table 105 retrieved by each query split are provided to a mapper 162, 164, or 170 for processing by a data processing cluster.
At step 320, the database table accessor 110 obtains table data representative of one or more properties of the table and, at step 330 the database table accessor 110 determines a splits generator in accordance with one or more of the user preference or the one or more properties of the table.
At step 340 the database table accessor 110 generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits.
At step 350 the database table accessor 110 outputs the plurality of query splits to an associated plurality of mappers 162, 164, or 170 for execution by the associated plurality of mappers of each of the plurality of query splits against the database table 105.
Consistent Reads Between Tasks
As noted above, overall, tools such as HIVE that use a database abstraction layer such as HCatalog can divide a query into multiple pieces and execute them separately against a database. However, these queries are not executed atomically but instead are executed at different points in time. As such, the results of each query when combined could violate the read-consistent rule relative to database retrieval protocol rules.
Accordingly, in accordance with a further embodiment, the system and method for dynamic database split generation in a massively parallel or other distributed database environment as described above also provides consistent reads between tasks using the efficient splits in a parallel data processing cluster. In accordance with an embodiment the database table accessor 110, before generating splits of the table dividing the user query into the plurality of query splits, can record the current system change number (SCN) in the database during or at the time of the splits generation, save the SCN as part of each generated query split, and during execution of the query splits using different tasks, use the SCN from each query split to achieve consistent reads between the tasks.
In accordance with an embodiment, an SCN is a database ordering primitive and represents a logical, internal time stamp used by a database, e.g., Oracle Database. SCNs order events that occur within the database, which is necessary to satisfy the atomicity, consistency, isolation, and durability (ACID) properties of a transaction that guarantee that database transactions are processed reliably. SCNs occur in a monotonically increasing sequence. An observed SCN indicates a logical point in time. If one event has a lower SCN than another event, then it occurred at an earlier time with respect to the database. Several events may share the same SCN, which means that they occurred at the same time with respect to the database. As such, an SCN can be used to exclude records added after the SCN was created if necessary or desired.
In accordance with an embodiment, the saved SCN can be checked for validity before it is set on a SQL statement for execution. The database table accessor 110 can check whether a generated split includes a SCN, or whether the saved SCN is in a valid format, or an object including the SCN is properly initialized. If the validity check fails on one or more query splits of the plurality of query splits, an error is indicated, and every query split is than executed anew.
As illustrated in
The following pseudocode as shown in Listing 4 below illustrates an example implementation of the method for providing consistent reads between tasks using efficient splits in a parallel data processing cluster, in accordance with an embodiment.
Listing 4
// before generation of splits, record the SCN
long scn = oracleConnection:getCurrentSCN ( );
// during generation of splits, save SCN as a part of Split
InputSplit splits = new OracleHiveSplit(scn);
// during execution, use saved SCN from split during execution
long scn = oracleHiveSplit:getScn( );
IF scn NOT VALID THEN
THROW EXCEPTION
ELSE
SET SCN ON STATEMENT
ENDIF
At step 520, the database table accessor 110 obtains table data representative of one or more properties of the table and, at step 530 the database table accessor 110 determines a splits generator in accordance with one or more of the user preference or the one or more properties of the table.
At step 535 the current system change number is obtained.
At step 540 the database table accessor 110 generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits.
At step 550 the database table accessor 110 outputs the plurality of query splits to the associated plurality of mappers 162, 164, or 170 for execution by the associated plurality of mappers of each of the plurality of query splits against the database table 105. In the embodiment each of the plurality of query splits sent to the associated plurality of mappers 162, 164, or 170 includes data representative of the current SCN.
When it is determined at control block 620 that the data in the table is partitioned, the split generator selection logic 129 selects a partition-based splits protocol at control block 650 for generating a partition-based splits generator 121 (
With continued reference to
However, when it is determined at control blocks 622, 630 that the data in the table is unpartitioned and of a fixed size, the database table accessor 110 can determine from the metadata store 150 whether the data in the table is of an unknown database chunk size at control block 640 or whether the data in the table is of a known size at control block 642. When it is determined at control block 640 that the data in the table is of an unknown database chunk size, the split generator selection logic 129 selects a size-based splits protocol at control block 652 for generating a size-based splits generator 121 (
Partition-Based Splits
In accordance with a further embodiment, a method for database partition-based split generation in an associated massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases is provided. A query for data in a table of the data warehouse layer is obtained from an associated client application, the query comprising query data representative of a user query and user preference data representative of a user preference. The method further includes obtaining, from the data warehouse layer, table data representative of one or more properties of the table, wherein the table data comprises partition data representative of a partition scheme of the table as having a partitioned topology wherein the table is logically divided into one or more partitions or an un-partitioned topology wherein the table is logically undivided. The method further includes selecting a partition-based splits generator in accordance with one or more of the query data indicating a user preference for a partition-based splits generator or the partition data indicating the partition scheme of the table as having the partitioned topology, and generating, by the selected partition-based splits generator, one or more table splits for each of the one or more partitions of the table, the one or more table splits dividing the user query into a plurality of query splits. The method further includes outputting the plurality of query splits to a plurality of associated mappers for execution by the plurality of associated mappers of each of the plurality of query tasks against the table.
Therefore, in accordance with an embodiment, described herein is a system and method for generating query splits based on partition and sub-partitions of a database table for use in a massively parallel or other distributed environment.
In accordance with an embodiment, a user can first create an external table in a data warehouse layer using a partitioned splitter as the splitter kind, wherein the external table is managed by a database table accessor and can be used to access a partitioned table in a database. When a query for selecting rows in the table is received, the database table accessor operates to choose an appropriate splits generator, execute an explain plan to derive a list of valid partitions relevant to the query, calculate the number of bytes and data included for each valid partition.
In accordance with an embodiment, the database table accessor can combine or split partitions/sub-partitions in the list of valid partitions based on a maximum split size defined in the massively parallel or other distributed environment (data processing cluster) such as Hadoop. If the size of a partition exceeds the maximum split size, the partition can be divided into multiple splits; if the total size of multiple partitions is less than the defined maximum size, the multiple partitions can be combined onto one split.
In accordance with an embodiment, an external table that includes a partition-based splitter kind is created as illustrated in the example of Listing 5 set out below:
Listing 5
CREATE EXTERNAL TABLE sales_test (
prod_id int,
cust_name
STRING,
TIME_ID
timestamp
)
STORED BY ′oracle.hcat.osh.OracleStorageHandler′
TBLPROPERTIES (
′oracle.jdbc.url′ = ′jdbc:oracle:thin:@localhost:1521:orcl′,
′oracle.jdbc.username′ = ′scott′,
′oracle.jdbc.password′ = ′tiger′,
′oracle.hcat.osh.tableName′ = ′sales_test′,
′oracle.hcat.osh.splitterKind′ = ‘PARTITIONED_SPLITTER’
);
In accordance with an embodiment, when a query is received, the database table accessor can select a partition-based splits generator 721 based on the specified partition-bases splitter kind. The partitioned based splits generator can execute an explain plan 722 to inquire about the topology of the table and retrieve 751 the table partition information. In accordance with an embodiment, the explain plan is a structure query language (SQL) statement that displays how a database executes SQL statements, and can be used to view how the database accesses partitioned objects for specific queries.
In accordance with an embodiment, the partition-based splits generator can use the explain plan to obtain partition number ranges and generate partition names from the partition number ranges for the given query. In particular, the database table accessor can analyze the partition information with respect to the query to derive a valid list of partitions. As an illustrative example, if the query includes a predicate that narrows the selection to the first quarter and third quarter of the sales table, the valid list of partitions can include partitions for these two quarters; the partitions for the second and fourth quarters would be unwanted partitions and pruned.
In accordance with an embodiment, the partition-based splits generator can calculate the number of bytes, data included for each valid partition, combine or split partitions/sub-partitions in the list of valid partitions based on a maximum split size. For example, a partition can be divided into multiple splits if the size of the partition is greater than the maximum split size; and multiple partitions can be combined into one split if their total size is less than or equal to the maximum split size.
In accordance with an embodiment, the partition-based splits generator can generate query splits based on the partition-based table splits described above. The approach generates query splits based solely on the sizes of the partitions and by pruning unnecessary partitions/sub-partitions in the generating process. In accordance with an embodiment, a user needs not know the datasets in the partitioned table to use this approach.
At step 804 the method obtains, from the data warehouse layer, table data representative of one or more properties of the table, wherein the table data comprises partition data representative of a partition scheme of the table as having a partitioned topology wherein the table is logically divided into one or more partitions or an un-partitioned topology wherein the table is logically undivided.
At step 806 the method selects a partition-based splits generator in accordance with one or more of the query data indicating a user preference for a partition-based splits generator or the partition data indicating the partition scheme of the table as having the partitioned topology.
At step 808 the method generates, by the selected partition-based splits generator, one or more table splits for each of the one or more partitions of the table, the one or more table splits dividing the user query into a plurality of query splits.
At step 810 the method outputs the plurality of query splits to a plurality of associated mappers for execution by the plurality of associated mappers of each of the plurality of query tasks against the table.
In one embodiment, the generating the one or more table splits for each of the one or more partitions of the table includes sub-steps of obtaining partition size data representative of a partition size of each of the one or more partitions of the table, obtaining split size data representative of a maximum split size of each of the plurality of query splits, comparing the split size data with the partition size data and storing a result of the comparing as comparison data, and generating the one or more table splits for each of the one or more partitions of the table in accordance with the comparison data.
In another embodiment, the generating the one or more table splits for each of the one or more partitions of the table includes sub-steps of determining the partition size is less than the maximum split size in accordance with the comparison data, and generating a single table split for a plurality of partitions in accordance with determining the partition size is less than the maximum split size.
Size-Based Splits
In accordance with a further embodiment, a method for size-based database split generation in an associated massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases is provided. A query for data in a table of the data warehouse layer is obtained from an associated client application, the query comprising one or more of query data representative of a user query that selects all columns in the Hive table or user preference data representative of a user preference. Table data representative of one or more properties of the table is obtained from the data warehouse layer, and data representative of a data query result size limit is obtained from one or more of the query data or the table data size. The method further includes determining one or more ranges of the table in accordance with the size data, and selecting a size-based splits generator in accordance with one or more of the query data indicating a user preference for a size-based splits generator or the table data indicating a size of the table as having predetermined selected size. The method further includes generating, by the selected size-based splits generator, a single size-based split query for each of the one or more ranges of the table, and outputting the single size-based split query for each of the one or more ranges of the table to a plurality of associated mappers for execution by the plurality of associated mappers of the single size-based split query for each of the one or more ranges against the table.
With reference back again to
In accordance with an embodiment and with reference next to
As shown in
Listing 6
CREATE EXTERNAL TABLE sales_test (
prod_id int,
cust_name
STRING,
TIME_ID
timestamp
)
STORED BY ‘oracle.hcat.osh.OracleStorageHandler’
TBLPROPERTIES (
‘oracle.jdbc.url’ = ‘jdbc:oracle:thin:@localhost:1521:orcl’,
‘oracle.jdbc.username’ = ‘scott’,
‘oracle.jdbc.password’ = ‘tiger’,
‘oracle.hcat.osh.tableName’ = ‘sales_test’,
‘oracle.hcat.osh.splitterKind’ = ‘SIZED_RANGE’,
‘oracle.hcat.osh.splitterKind’ = ‘256M’
);
As shown in the Listing 6 above, the splitter kind is defined as SIZED-RANGE. In accordance with an embodiment, the ‘oracle.hcat.osh.splitterKind’=‘256M’ is not required; the size can be derived from the Hadoop input split size (mapreduce.input.fileinputformat.split.maxsize).
As further shown in
In accordance with an embodiment, the database table accessor can mine the data dictionary of the table and create row ranges for each chunk of the table. In accordance with an embodiment, each row range can have n rows, wherein the sum of the n rows is the user-defined size or a default size of 128M, but for the last chunk, which can be less than the user-defined size or the default size.
In accordance with an embodiment, the database table accessor can calculate the row ranges using the total number of blocks occupied by the table, the size of each block, and the total number of rows in the table. For example, using the total number of blocks and the size of each block, the database table accessor can figure out the number of rows per block, and row ranges per block.
In accordance with an embodiment, the database table accessor can use the row ranges to split the query into multiple query splits, where each query split is then embedded into an input split object and provided to a record reader for execution against the external table.
At step 1004 the method obtains, from the data warehouse layer, table data representative of one or more properties of the table, and at step 1006 the method obtains from one or more of the query data or the table data size data representative of a data query result size limit.
At step 1008 the method determines one or more ranges of the table in accordance with the size data, and at step 1010 the method selects a size-based splits generator in accordance with one or more of the query data indicating a user preference for a size-based splits generator or the table data indicating a size of the table as having predetermined selected size.
At step 1012 the method generates, by the selected size-based splits generator, a single size-based split query for each of the one or more ranges of the table.
The method then outputs the single size-based split query for each of the one or more ranges of the table to a plurality of associated mappers for execution by the plurality of associated mappers of the single size-based split query for each of the one or more ranges against the table.
ROWID Range-Based Splits
In accordance with a further embodiment, a method for ROWID-based database split generation in an associated massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases is provided. A query for data in a table of the data warehouse layer is obtained from an associated client application, the query comprising one or more of query data representative of a user query that selects all columns in the table or user preference data representative of a user preference. Table data representative of one or more properties of the table is obtained from the data warehouse layer, the table data comprising files, data blocks, and row numbers for the table in accordance with the user query for blocks of data in the table. The method further includes creating multiple block ranges for the blocks of data in the table in accordance with the user query, and creating for each of the multiple block ranges ROWID range data, the ROWID range data being representative of pseudo columns of the table that serve as unique identifiers for a row of the table. The method further includes selecting a ROWID-based splits generator in accordance with one or more of the query data indicating the user query that selects all columns in the table or the user preference data indicating a user preference for a ROWID-based splits generator, and generating, by the selected ROWID-based splits generator, table splits dividing the user query into a plurality of ROWID query splits wherein each of the ROWID query splits is associated with one of the multiple block ranges in accordance with the ROWID range data. The method further includes outputting the plurality of ROWID query splits to a plurality of associated mappers for execution by the plurality of associated mappers of the plurality of ROWID query splits against the table.
With reference back again to
As noted above, when it is determined at control block 642 that the data in the table is of an known database chunk size, the split generator selection logic 129 selects a ROWID-based splits protocol at control block 654 for generating a ROWID-based splits generator 121 (
In accordance with an embodiment, ROWIDs need not be physically stored in a database. For example, an Oracle database can generate a ROWID when the ROWID is queried.
In accordance with an embodiment, a ROWID can be associated with a file number, a block number, and a row number in which a row is stored.
In accordance with an embodiment, an example DDL syntax for creating such an external table in the data warehouse layer can be illustrated in Listing 7, where a splitter kind is defined to be ROWID_RANGE.
Listing 7
CREATE EXTERNAL TABLE sales_test (
prod_id int,
cust_name
STRING,
TIME_ID
timestamp
)
STORED BY ‘oracle.hcat.osh.OracleStorageHandler’
TBLPROPERTIES (
‘oracle.jdbc.url’ = ‘jdbc:oracle:thin:@localhost:1521:orcl’,
‘oracle.jdbc.username’ = ‘scott’,
‘oracle.jdbc.password’ = ‘tiger’,
‘oracle.hcat.osh.tableName’ = ‘sales_test’,
‘oracle.hcat.osh.splitterKind’ = ‘ROWID_RANGE’;
);
As shown in Listing 7, the value of the ROWID_RANGE is not specified. In accordance with an embodiment, when a value of the splitter kind is not specified, a default value can be used.
As further shown in
In accordance with an embodiment, when a user or an application issues a query that selects all rows in the database table, the database table accessor, based on properties of the database table and the user hint obtained from the data warehouse layer, can choose a ROWID-based splits generator. In accordance with an embodiment, the database table accessor can then obtain files, data blocks and row numbers for the table, and create multiple block ranges from the blocks selected, where each block range has a fixed-size number of blocks but for the last range.
In accordance with an embodiment, the database table accessor can create ROWIDs for each block range using files and row numbers, wherein one ROWID is created per block, which makes one ROWID range per block range.
In accordance with an embodiment, the database table accessor can split the query into multiple smaller or query splits based on the ROWID ranges created on each block range, where each query split is then embedded into an input split object and provided to a record reader for execution against the external table.
In accordance with an embodiment, the ROWID range splitter kinds can be dynamically modified during implementation. For example, for the partition-based splitter kind, if a large partition is detected that does not contain much data, the database table accessor can merge the partition with one or more other partitions. Similarly, if a partition is detected that contains too much data, the partition can be split into multiple smaller partitions.
At step 1204 the method obtains, from the data warehouse layer, table data representative of one or more properties of the table, the table data comprising files, data blocks, and row numbers for the table in accordance with the user query for blocks of data in the table.
At step 1206 the method creates multiple block ranges for the blocks of data in the table in accordance with the user query, and at step 1208 the method creates for each of the multiple block ranges ROWID range data, the ROWID range data being representative of pseudo columns of the table that serve as unique identifiers for a row of the table.
At step 1210 the method selects a ROWID-based splits generator in accordance with one or more of the query data indicating the user query that selects all columns in the table or the user preference data indicating a user preference for a ROWID-based splits generator.
At step 1212 the method generates, by the selected ROWID-based splits generator, table splits dividing the user query into a plurality of ROWID query splits wherein each of the ROWID query splits is associated with one of the multiple block ranges in accordance with the ROWID range data.
At step 1214 the method outputs the plurality of ROWID query splits to a plurality of associated mappers for execution by the plurality of associated mappers of the plurality of ROWID query splits against the table.
High-Speed Data Transfer from JDBC
As described above, the database table accessor can be used to retrieve data from a relational database via a data warehouse layer (e.g., HIVE) and transfer the data to a data warehouse layer (e.g., HIVE) for data mining.
The database table accessor typically obtains the data using methods such as getDate( ), getTimestamp( ) and getString( ) on a ResultSet in a database driver, e.g., a JDBC driver. These methods convert the data from database formats to Java core formats such as java.sql.Date, java.sql.Timestamp, java.lang.String. In accordance with an embodiment, Java objects can be immutable objects that cannot be changed once created. As such, they can be multiple copies of a data object, which stress the heap and impact performance for data mining.
Data mining tools such as HIVE needs a high speed data transfer mechanism without multiple conversions from e.g., Oracle database formats to Java formats and then to data mining tool formats; and without multiple copies of a data object.
In accordance with an embodiment, described herein is a system and method for providing rapid transfer of data from a database driver to generic writable interfaces in a data warehouse layer (e.g., HIVE).
In accordance with an embodiment, the system includes a database driver used to obtain data from a database table to a data warehouse layer (e.g., HIVE), where the database driver includes a data transformation logic component and a fast path API. When a result set is returned from the database table, the database driver can perform a check to determine whether a fast conversion capability is supported, and if it is, transform the data from database formats to data mining tool formats using the fast path API and in accordance with a logic defined in the data transformation logic component.
As shown in
In accordance with an embodiment, if a fast conversion capability is supported by the database driver, the fast path API can be used to perform the data transformation in accordance with a logic defined in the data transformation logic component. In accordance with an embodiment, the data transformation logic can be defined by users based on their data mining needs.
In accordance with an embodiment, data types in data mining tool formats can be similar to Java object types, e.g., a string object. However, new objects need not be created every time; instead, a same object can be used for holding intermediate data for data mining. As such, multiple copies of a same data are can be avoided.
The following pseudo code illustrates an example implementation of the method for providing rapid transfer of data from a database driver to generic writable interfaces in a data warehouse layer, in accordance with an embodiment.
Listing 8
oracle.jdbc.internal.OracleResultSet:
/**
* @returns the number of bytes copied into the buffer
*/
public int getBytes(int parameterIndex, byte[ ] buffer, int offset) throws
SQLException;
DynamicByteArray::getBytes
int getBytes(int dataOffset, int dataLength, byte[ ] buffer, int byteOffset):
if(data == CHAR OR data == VARCHAR)
if(uniByte OR networkCharSet ==UTF8)
Then copy-bytes-to-buffer;
else
Then convert to UTF8 bytes;
DateAccessor::getBytes
int getBytes(int rowIndex, byte[ ] buffer, int byteOffset):
if(isNull( ))
return 0
else
convert-date-to-seconds since 1 Jan 1970
Serialize seconds onto byte[ ]
return 4 // size of int
TimestampAccessor::getBytes
int getBytes(int rowIndex, byte[ ] buffer, int byteOffset):
if(isNull( ))
return 0
else
convert-date-to-milli-seconds since 1 Jan 1970
Serialize seconds onto byte[ ]
Serialize nano-seconds to byte[ ]
return 12 // size of long + 4 bytes nano seconds
Reader:refreshColumns:
Dynamically check the capability of fast-conversion in the driver
Cache the state
if(fastPath)
use fast path API to get byte[ ]
use byte[ ] with Writable
else
use regular access
At step 1404 the method obtains table data representative of one or more properties of the table, and at step 1406 the method determines a splits generator in accordance with one or more of the user preference or the one or more properties of the table.
At step 1408 the method generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits, and at step 1410 outputs the plurality of query splits to a database driver comprising a data transformation logic component and a fast path application programming interface (API).
At step 1412 the method receives result data derived from executing the plurality of queries by associated mappers against the table, and at step 1414 the method selectively transforms, by fast path API of the database driver, the result data from a format of the table to a data mining tool format directly usable by one or more components of the associated data warehouse layer.
Optimized Query Processing with Table-Level Predicate Pushdown
When a query is executed in a data warehouse layer (e.g., HIVE), the data is selected and query predicates are applied at the data warehouse layer to filter the rows that the query does not cover. A query executed as described above can have poor performance since the whole table is transported to a data warehouse layer for row trimming. In addition, such queries may not even be executed because of memory constraints if the table is large.
In accordance with an embodiment, predicate pushdown is a feature where query predicates are pushed down to the storage nodes for analysis for high throughput. In a query, e.g., a SQL statement, portions of the SQL statement, specifically ones that filter data, are referred to as predicates. By pushing some query predicates down to a level as low as possible, query performance can be improved by avoiding transferring all the rows in a table to a data warehouse layer when only one or two rows that a query is to retrieve.
In accordance with an embodiment, described herein is a system and method for optimizing query processing with predicates pushdown from a data warehouse layer to table level in a database. In accordance with an embodiment, predicate pushdown at the table level can be achieved by using standard properties of an external table, wherein the external table is created with a query and predicates of the query for pushdown defined as table properties. When a query for selecting rows in the table is received, the database table accessor operates to choose an appropriate splits generator, use a query formulator to formulate the query so that the query predicates can be executed at the table level.
In accordance with an example embodiment, a method is provided for split query processing with table level predicate pushdown in a massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases. The method includes obtaining, from an associated client application, a query for data in a table of the data warehouse layer, the query comprising query data representative of a user query, query predicate data representative of one or more predicates of the user query, and user preference data representative of a user preference, wherein the one or more predicates of the user query comprise portions of the user query operative to filter data. The method further includes obtaining table data representative of one or more properties of the table, determining a splits generator in accordance with one or more of the user preference or the one or more properties of the table, and generating, by the selected splits generator, table splits dividing the user query into a plurality of query splits. The method further includes formulating the plurality of query splits to include the query predicate data representative of the one or more predicates of the user query, and outputting the plurality of query splits to an associated plurality of mappers for execution by the associated plurality of mappers of each of the plurality of query splits against the table, wherein the one or more predicates of the user query may be executed at a logical execution level of the table.
As shown in
In accordance with an embodiment, an example DDL syntax for creating such an external table in the data warehouse layer can be illustrated in Listing 9.
Listing 9
CREATE EXTERNAL TABLE sales_q2 (
prod_id int,
cust_name
STRING,
TIME_ID
timestamp
)
STORED BY ‘oracle.hcat.osh.OracleStorageHandler’
TBLPROPERTIES (
‘mapreduce.jdbc.url’ = ‘jdbc:oracle:thin:@adc2171607:9221:dbjMt’,
‘mapreduce.jdbc.username’ = ‘scott’,
‘mapreduce.jdbc.password’ = ‘tiger’,
‘mapreduce.jdbc.input.table.name’ = ‘sales_test’,
‘oracle.hcat.osh.splitterKind’ = ‘PARTITIONED_TABLE’,
‘mapreduce.jdbc.input.query’ = ‘SELECT prod_id, cust_name,
time_id from sales_test’,
‘mapreduce.jdbc.input.conditions’ = ‘time_id =
to_date(\‘10-jun-2006\’,\‘dd-mon-yyyy\’)’
);
As illustrated in Listing 9, an external table is created with a query and query predicates for pushdown to the table level specified in the external table definition.
As further shown in
At step 1604 the method obtains table data representative of one or more properties of the table, at step 1606 determines a splits generator in accordance with one or more of the user preference or the one or more properties of the table, and at step 1608 generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits.
At step 1610 the method formulates the plurality of query splits to include the query predicate data representative of the one or more predicates of the user query.
At step 1612 the method outputs the plurality of query splits to an associated plurality of mappers for execution by the associated plurality of mappers of each of the plurality of query splits against the table, wherein the one or more predicates of the user query may be executed at a logical execution level of the table.
Efficient Connection Management
A data processing task, e.g, a Hadoop task, is a unit of work submitted by a user to a data processing cluster, e.g., Hadoop, for processing. In accordance with an embodiment, query splits from a query are not executed atomically; instead, they are executed at different points in time. Each query split is equipped with a system change number (SCN) that make the reads from each query split consistent.
Each task processes a split of a large dataset generated by an input format component and each task uses a database connection for interacting with a database. Every time a new task is submitted for processing, a separate process, such as Java virtual machine process, can be created and a database connection is created. In a cluster with thousands of nodes, each of which can process hundreds of tasks, the number of database connections used can create a connection storm on the database.
In accordance with embodiments herein a system and method is provided for efficient connection management in a massively parallel or other distributed database environment including a plurality of databases and a data warehouse layer providing data summarization and querying of the plurality of databases. In accordance with an example embodiment, the method includes obtaining, from an associated client application, a query for data in a table of the data warehouse layer, the query comprising query data representative of a user query and user preference data representative of a user preference. The method further includes requesting a connection from a connection pool to obtain via the connection table data representative of one or more properties of the table, determining a splits generator in accordance with one or more of the user preference or the one or more properties of the table, and generating, by the selected splits generator, table splits dividing the user query into a plurality of query splits. The method further includes outputting the plurality of query splits to an associated plurality of mappers for execution using the connection by the associated plurality of mappers of each of the plurality of query splits against the table.
In accordance with an embodiment, described herein is a system and method for efficient connection management in a distributed parallel processing environment. In accordance with an embodiment, a pseudo connection pool of size one is created. The connection pool creates a connection when a connection is first requested by the database table accessor to create query splits, wherein the connection is used by various components, e.g., a record reader and a mapper, for processing a first split. When a connection is requested by a task that reuses the process that created for processing the first split, the same connection is returned for use from the connection pool when the connection credentials match. If the connection credentials do not match, the existing connection is closed, and a new connection is created and returned.
In accordance with an embodiment, a task reuse parameter can be used to enable a process to process a plurality of tasks, so that the plurality of tasks can reuse a same connection from the connection pool.
In accordance with an embodiment, the connection pool can cache a SQL statement so that query splits from a same query can reuse the SQL statement. In accordance with an embodiment, query splits from a same query include a same SQL statement with different binds. Caching the SQL statement can improve performance. For example, by caching executable statements used repeatedly, performance be can improved by preventing the overhead of repeated cursor creation, repeated statement parsing and creating, and by reusing data structures in the data warehouse layer.
In accordance with an embodiment, when a query is received, the database table accessor can request a connection from the connection pool for retrieving user hints and table properties to generate query splits. The connection pool can create a connection 903 and returns the connection to the database table accessor. When a query split, e.g., Input Split A 128, is executed by a record reader, e.g., 152, against the external table, the same connection is used to retrieve table records for processing by the data processing cluster.
As further shown, the data processing cluster includes two processes (e.g., Java virtual machine processes) 1772 and 1777, and each process includes a process reuse parameter 1774 and 1778. In accordance with an embodiment, a process reuse parameter can be set by a processing task that spawns the process. If the value is 1 (the default), then a process with the value cannot be reused. A higher value than 1 can be specified via an application programming interface to enable the process to process more tasks. If the value is −1, there is no limit to the number of tasks the processes can run (of the same job). In accordance with an embodiment, the process reuse parameter, e.g., reuse.jvm.num.tasks, can be associated with the task that spawns the process, which can automatically inherit the value of the parameter.
As illustrated by
In accordance with an embodiment, the connection pool of size one can provide a connection to be reused by a next task that reuses the same process in the data processing cluster. In addition, this approach for sharing database resources across multiple tasks in a distributed system can provide additional benefits such as performance enhancing persistence between tasks, when compared with alternative ways to control the number of connections, e.g., by using a proxy or a wallet manager.
At step 1804 the method requests a connection from a connection pool to obtain via the connection table data representative of one or more properties of the table, and at step 1806 determines a splits generator in accordance with one or more of the user preference or the one or more properties of the table.
At step 1808 the method generates, by the selected splits generator, table splits dividing the user query into a plurality of query splits.
At step 1810 the method outputs the plurality of query splits to an associated plurality of mappers for execution using the connection by the associated plurality of mappers of each of the plurality of query splits against the table.
In accordance with a further embodiment, the method is operative at step 1812, to cache a structured query language (SQL) statement associated with the user query in the connection pool whereby each of the plurality of query splits generated by splits dividing the user query into the plurality of query splits can selectively reuse the connection and the SQL statement.
Embodiments herein may be conveniently implemented using one or more conventional general purpose or specialized digital computer, computing device, machine, or microprocessor, including one or more processors, memory and/or computer readable storage media programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.
In some embodiments, the embodiment includes a computer program product which is a non-transitory storage medium or computer readable medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. Examples of the storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.
The foregoing description of embodiments have been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalents.
Shivarudraiah, Ashok, Swart, Garret
Patent | Priority | Assignee | Title |
11899666, | Sep 26 2014 | Oracle International Corporation | System and method for dynamic database split generation in a massively parallel or distributed database environment |
Patent | Priority | Assignee | Title |
5864840, | Jun 30 1997 | International Business Machines Corporation | Evaluation of existential and universal subquery in a relational database management system for increased efficiency |
5878409, | Jun 01 1995 | International Business Machines Corporation | Method and apparatus for implementing partial declustering in a parallel database system |
6681218, | Nov 04 1999 | International Business Machines Corporation | System for managing RDBM fragmentations |
6748377, | Oct 18 2000 | International Business Machines Corporation | Facilitating query pushdown in a multi-tiered database environment |
6959373, | Dec 10 2001 | International Business Machines Corporation | Dynamic and variable length extents |
7337163, | Dec 04 2003 | Oracle International Corporation | Multidimensional database query splitting |
7716173, | Jun 02 2003 | The Board of Trustees of the Leland Stanford Jr. University | Computer systems and methods for the query and visualization of multidimensional database |
7756889, | Feb 16 2007 | Oracle International Corporation | Partitioning of nested tables |
8539504, | Aug 30 2007 | ServiceNow, Inc; International Business Machines Corporation | Heterogeneous architecture in pooling management |
8601000, | Jun 27 2011 | Amazon Technologies, Inc | System and method for conditionally updating an item with attribute granularity |
8631028, | Oct 29 2009 | XPath query processing improvements | |
8893131, | Apr 11 2008 | R2 SOLUTIONS LLC | System and/or method for bulk loading of records into an ordered distributed database |
8924426, | Apr 29 2011 | GOOGLE LLC | Joining tables in a mapreduce procedure |
9489443, | May 24 2013 | Amazon Technologies, Inc | Scheduling of splits and moves of database partitions |
9501483, | Sep 18 2012 | Hewlett Packard Enterprise Development LP | Table format for map reduce system |
9652496, | Jun 25 2014 | PIVOTAL SOFTWARE, INC | Dynamic partition selection |
9684874, | Jul 26 2013 | International Business Machines Corporation | Parallel decision or regression tree growing |
9697476, | May 13 2014 | DEUTSCHE BANK AG NEW YORK BRANCH | System and method for utilizing a model to process big data |
20030140210, | |||
20040133568, | |||
20040186832, | |||
20050131893, | |||
20050187917, | |||
20050187977, | |||
20070226176, | |||
20080104043, | |||
20090271385, | |||
20100042631, | |||
20100161651, | |||
20100281017, | |||
20110035368, | |||
20110191361, | |||
20110302583, | |||
20120054173, | |||
20120239688, | |||
20120278323, | |||
20120303677, | |||
20120310916, | |||
20120317134, | |||
20130138626, | |||
20130166606, | |||
20130238667, | |||
20140012882, | |||
20140067793, | |||
20140081918, | |||
20140095470, | |||
20140108633, | |||
20140114994, | |||
20140156666, | |||
20140279853, | |||
20140279986, | |||
20140280019, | |||
20150081666, | |||
20150186461, | |||
20150220529, | |||
20150310030, | |||
20150324383, | |||
20150370853, | |||
20160092524, | |||
20160092541, | |||
20160092542, | |||
20160092543, | |||
20160092545, | |||
20160092546, | |||
20160092547, | |||
20160092548, | |||
20160342653, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Sep 21 2015 | SHIVARUDRAIAH, ASHOK | Oracle International Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036911 | /0098 | |
Sep 24 2015 | Oracle International Corporation | (assignment on the face of the patent) | / | |||
Oct 21 2015 | SWART, GARRET | Oracle International Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036911 | /0098 |
Date | Maintenance Fee Events |
Feb 01 2023 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Date | Maintenance Schedule |
Aug 13 2022 | 4 years fee payment window open |
Feb 13 2023 | 6 months grace period start (w surcharge) |
Aug 13 2023 | patent expiry (for year 4) |
Aug 13 2025 | 2 years to revive unintentionally abandoned end. (for year 4) |
Aug 13 2026 | 8 years fee payment window open |
Feb 13 2027 | 6 months grace period start (w surcharge) |
Aug 13 2027 | patent expiry (for year 8) |
Aug 13 2029 | 2 years to revive unintentionally abandoned end. (for year 8) |
Aug 13 2030 | 12 years fee payment window open |
Feb 13 2031 | 6 months grace period start (w surcharge) |
Aug 13 2031 | patent expiry (for year 12) |
Aug 13 2033 | 2 years to revive unintentionally abandoned end. (for year 12) |