Abstract:
Techniques for processing relational data with a user-defined function (UDF) are provided. Relational input data being requested by the UDF, from within a relational database system, is intercepted and normalized. The UDF is called with the normalized input data and as the UDF produces output data in response to the normalized input data that output data is captured and normalized. In an embodiment, the normalized output data is used to dynamically update a data model within the relational database for the input data.

Description:
BACKGROUND 
       [0001]    After over two-decades of electronic data automation and the improved ability for capturing data from a variety of communication channels and media, even small enterprises find that the enterprise is processing terabytes of data with regularity. Moreover, mining, analysis, and processing of that data have become extremely complex. The average consumer expects electronic transactions to occur flawlessly and with near instant speed. The enterprise that cannot meet expectations of the consumer is quickly out of business in today&#39;s highly competitive environment. 
         [0002]    Consumers have a plethora of choices for nearly every product and service, and enterprises can be created and up-and-running in the industry it mere days. The competition and the expectations are breathtaking from what existed just a few short years ago. 
         [0003]    The industry infrastructure and applications have generally answered the call providing virtualized data centers that give an enterprise an ever-present data center to run and process the enterprise&#39;s data. Applications and hardware to support an enterprise can be outsourced and available to the enterprise twenty-four hours a day, seven days a week, and three hundred sixty-five days a year. 
         [0004]    As a result, the most important asset of the enterprise has become its data. That is, information gathered about the enterprise&#39;s customers, competitors, products, services, financials, business processes, business assets, personnel, service providers, transactions, and the like. 
         [0005]    Updating, mining, analyzing, reporting, and accessing the enterprise information can still become problematic because of the sheer volume of this information and because often the information is dispersed over a variety of different file systems, databases, and applications. 
         [0006]    Moreover, enterprises are now attempting to integrate data from a variety of different sources having different formats into their enterprise data module. One obvious benefit of such efforts is that an entire 360 degree view of the enterprise data can be achieved with data integration for multiple sources. Such efforts have resulted in fragmented development within the enterprise, where one-off conversion applications and one-off integration applications proliferate, which causes: maintenance, support, and reuse issues for the enterprise. Often times an enterprise developer is unaware of what has already been developed and recreates his/her own version when a particular data integration effort is needed. Further, the amount of programming effort needed for integration remains constant within the enterprise despite the substantial increase in integration activities within the enterprise. 
       SUMMARY 
       [0007]    In various embodiments, techniques for processing relational data with a User-Defined Function (UDF) are presented. According to an embodiment, a method for processing relational data with a UDF is provided. 
         [0008]    Specifically, a data model is acquired for input data that is to be used in the processing of a user-defined function (UDF) from within a relational database system and the input data housed in a relational database. The input data is normalized and the UDF is initiated within the relational database system for performing custom-user defined calculations using the normalized data. Next, output data produced from the UDF is normalized into a normalized output format and the original data model, within the relational database system, is updated based on the mapped output data in the normalized output format. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0009]      FIG. 1A  is a diagram depicting an architecture for processing relational data with a UDF, according to a specific embodiment. 
           [0010]      FIG. 1B  is a flow diagram for components of the architecture presented in the  FIG. 1A , according to an example embodiment. 
           [0011]      FIG. 2  is a diagram of a method for processing relational data with a UDF, according to an example embodiment. 
           [0012]      FIG. 3  is a diagram of another method for processing relational data with a UDF, according to an example embodiment. 
           [0013]      FIG. 4  is a diagram of UDF processing system, according to an example embodiment. 
       
    
    
     DETAILED DESCRIPTION 
       [0014]      FIG. 1A  is a diagram depicting an architecture for processing relational data with a UDF, according to a specific embodiment. It is noted that the components of the architecture are implemented, programmed, and reside within a non-transitory computer-readable storage medium and process on one or more processors of a network. The network wired, wireless, or a combination of wired and wireless. 
         [0015]    The architecture is presented from the perspective of a large relational database installation, such as Teradata®, distributed by Teradata, Inc. of Miamisburg, Ohio. Although, the  FIGS. 1A and 1B  are presented and described within the context of the Teradata® product it is to be noted that any relational database product or Application Programming Interface for a relational database product can be enhanced to include the beneficial teachings presented herein and below. 
         [0016]    As initial context for the discussion that follows, it is noted that the phrase “supercomputing” refers to performing processor and memory-intensive operations. Moreover, the phrase “big data” refers to using voluminous amounts of data with the process processor and memory-intensive operations. Conventionally, even with existing large relational database installations, when there was a need to perform supercomputing on big data, the data was exported and separate systems were used for the calculations. This approach is manually intensive, time consuming, fraught with errors, and costly for enterprises. 
         [0017]    As discussed herein with the various presented embodiments, supercomputing for big data takes place in a manner that is seamlessly integrated in an automated fashion into the existing relational database API&#39;s to permit the supercomputing to occur via a UDF (referred to in some instances here as an “extreme UDF.” 
         [0018]    Supercomputing for big data with an extreme UDF is an approach to turn a relational database platform (such as, by way of example, a Teradata® database) into a supercomputing machine. The approaches presented combine data calculation and data storage into one system via a UDF to eliminate the overhead of big data input and output. Based on a relational database&#39;s scalable structure, a database gains much better performance for big data computing then other architectures or platforms. So, with this presented approach, the relational database is able to finish huge amounts of computing, which was only possible on super computer in the industry before the novel techniques presented herein. 
         [0019]    Again, supercomputing for big data with extreme UDFs delivers a solution to complete supercomputing calculations on huge amounts of data in a relational database. 
         [0020]    Specifically, with more and more data aggregation occurring within the industry, more industry needs have already been identified such as:
       ability to integrate intelligence and more accurate data analysis into relational data;   ability to handle complex and dynamic data models being introduced into an enterprise&#39;s data warehouse; and   ability to update and acquire the most up-to-date data being transferred into the data model on a continuous basis.       
 
         [0024]    To address the above requirements, traditional technology has encountered the following bottlenecks, insurmountable heretofore:
       time consumption needed for retrieving and storing a large amount of relational data;   handling existing fragile data models having complex dynamic algorithms; and   lack of inexpensive computing resources needed for supercomputing calculations.       
 
         [0028]    As will be shown more completely herein and below, supercomputing for big data with extreme UDFs is able to seamlessly implement complex business analysis under an existing data warehouse (relational database) architecture. The presented approach is a high performance computing solution to support complicated dynamic application models, which could only be run in super computers previously. The combination between the relational database architecture and an extreme UDF removes the bottlenecks (identified above) for retrieving and storing data; this was not avoidable among other approaches in the industry. 
         [0029]    Moreover, the supercomputing for big data with extreme UDF provides an integrated single implementation model to resolve complex business requirements. 
         [0030]    The following described components represent the overall process of the supercomputing for big data with an extreme UDF. 
         [0031]    The supercomputing for big data with an extreme UDF is a relational database application model. It&#39;s programmed as a relational database&#39;s UDF and accessible as a stored procedure. The tool (supercomputing for big data written as a UDF) can be used to expand existing product functionality for the relational database architecture. 
         [0032]    Now with reference to the architecture and processing discussed in the  FIG. 1A . 
         [0033]    There are 6 processing steps. 
         [0034]    1. Business model analysis.
       Analyze current business flow, detect deep relationships among business units and create a business network model.       
 
         [0036]    2. Retrieve data model.
       Convert business network model into a data model and verify complexity of hat data model.       
 
         [0038]    3. Technical analysis.
       Analyze converted data model, clarify the possibility of parallel processing, memory usage, input and output data volume.       
 
         [0040]    4. Normalize data array.
       Normalize input data into data array and put various data types into one fixed common structure.       
 
         [0042]    5. UDF computing.
       Invoke UDF to process algorithm computing—input with data array and output with data array.       
 
         [0044]    6. Optimized data flow.
       Apply UDF output to refine the business processes.       
 
         [0046]    To implement this application model as shown in the  FIG. 1A , it is noted that:
       1. Parallel model. Model is capable of being split into multiple groups for parallel processing.   2. Memory usage. Application Module Processor (AMP) memory can be limited, such as by 32M bytes. The model memory is monitored so as to not exceed the existing relational database&#39;s architecture&#39;s memory limit.   3. Data array. Input/Output data can be reloaded by the array format.       
 
         [0050]      FIG. 1B  is a flow diagram for components of the architecture presented in the  FIG. 1A , according to an example embodiment. The components are implemented, programmed, and reside within a non-transitory computer-readable storage medium for execution on one or more processors of a network. The network is wired, wireless, or a combination of wired and wireless. Again, although the  FIG. 1B  shows the Teradata® data warehouse product offering (discussed above with reference to the  FIG. 1A ), it is to be noted that any relational database product offering or relational database API can be enhanced to include the teachings presented herein. 
         [0051]    Each of the processing steps and the flow for the interaction of the components is descriptively presented in the  FIG. 1B . Before any UDF is processed for supercomputing big data, a check is made to see if processing such UDF is feasible within the physical restrictions of the underlying relational database platform. It is noted, that this check is done even when the UDF is modified for supercomputing dig data. Once it is known that the physical limitations for the relational database are complied with, the UDF is analyzed to see if the UDF presented is in shape for supercomputing big data and if it is then the input and output data array is normalized, placed in the processing queue, and executed on the relational database platform to provide deep insight into the business model. When the UDF being analyzed is not in shape for supercomputing big data, it is analyzed and an appropriate data model from the business models available is selected. 
         [0052]      FIG. 2  is a diagram of a method  200  for processing relational data with a UDF, according to an example embodiment. The method  200  (hereinafter referred to as “UDF integrator”) is implemented, programmed, and resides within a non-transitory computer-readable storage medium for execution on one or more processors of a network that are specifically configured to execute the UDF integrator). The network can be wired, wireless, or a combination of wired and wireless. 
         [0053]    The UDF integrator is implemented and integrated into a relational database product offering, such as the Teradata® product distributed by Teradata, Inc. of Miamisburg, Ohio. It is noted that the UDF integrator can be integrated to enhance any relational database product offering and/or relational database API. Moreover, the architecture of the processing environment for the UDF integrator and the relational database product offering is a parallel processing environment permit the UDF&#39;s (discussed herein) to be processed using parallel processing techniques. 
         [0054]    At  210 , the UDF integrator acquires a data model for input data. The input data is being directed to a UDF. That is, the processing of the UDF integrator occurs within an existing relational database system as does a user-defined and customized UDF. That UDF at some point in time requests input data from an API of the relational database or is known to request input data of s certain type or defined by certain conditions. The UDF integrator acquires the data in advance of the request by the UDF. The data model defines the format, attributes, and characteristics of the input data. In one case, the data model is a table schema defined in the database. 
         [0055]    According to an embodiment, at  211 , the UDF integrator automatically and dynamically derives the data model from analyzing the input data. For example, at  212 , the UDF integrator identifies processing characteristics associated with the input data for use with parallel processing performed by the UDF. Some example processing characteristics can include, but are not limited to, such things as data ranges for a given data type, byte sizes of fields defined within the input data, data types defined within the input data, and the like. 
         [0056]    At  220 , the UDF integrator normalizes the input data. Here, the format defined by the data model for the input data is translated or converted into equivalent data having a normalized format. So, some data fields can be combined into one field, the size and types of fields can be altered, and the like. 
         [0057]    In an embodiment, at  221 , the UDF integrator maps the input data using the data model into an input data array for usage by the UDF. For example and in an embodiment, the mapping converts the multi-structured input data into a two-dimension data stream array that can be directly applied and used by the UDF defined by the user. As one case, consider the dimension of the two-dimensional (2D) array is M×N where M is the width (column data) and N is the height (row data). It is noted that M (width) does not have to equal N (height). M may be a pre-defined data format having a fixed length. N can have a variable length. The row (N) may be defined as 1) Row  1 -Row X, common data model; 2) Row X+1-Row N−1, specified unit data; and 3) Row N, ending flag. Each data cell in the data array can be any relational database type. To support multi-structured data a variable byte structure can be used to aggregated structured data in the input data into data chunks). 
         [0058]    In another scenario, at  222 , the UDF integrator maps the input data into a database table for use by the UDF. So, if the UDF expects a table as input having a predefined format, the UDF integrator normalizes the input data to conform to the format of the table and populates the table with the normalized input data. 
         [0059]    At  230 , the UDF integrator initiates the UDF to perform custom-user defined calculations using the normalized data. Here, the UDF performs supercomputing against the input data. Essentially, process-intensive operations using a lot of memory and operating against the input data, which is voluminous. So, operations that traditionally could not process for a variety of processing limitations can take advantage of the parallel processing structure of a relational database system and process as a UDF in a seamless manner by having the relational input data transformed into expected input, via the normalized input data and then the UDF is initiated and executed within the relational database system using the hardware resources, the execution environment, and software resources of the relational database system. 
         [0060]    At  240 , the UDF integrator maps the output data produced from the UDF into a normalized output format. So, similar to the normalization of the relational data to an input format conversion, the output data produced by the UDF is also normalized into a relational database format that makes it usable by other processes within the relational database system. 
         [0061]    According to an embodiment, at  241 , the UDF integrator translates the output data as it is produced by the UDF into the normalized output format. So, the normalization of the output data can be done in-stream and as the output data is being generated and outputted by the UDF. It is noted that other situations can exists as well, such as batch processing the output data once the UDF completes processing of the normalized input data. 
         [0062]    Similar to the embodiment of  222 , and at  242 , the UDF integrator can also populate the normalized output data into a database table of the database for use by other processes related or not related to the UDF. 
         [0063]    Finally, at  250 , the UDF integrator updates the data model based on the mapped output in the normalized format. In other words, the original data model that defines the input data can be updated or enhanced based on the normalized output data produced by the UDF. 
         [0064]    In this way, a dynamic feedback loop can be instituted within the relational database system that permits existing data models to be continuously improved for data quality and/or data processing improvements. 
         [0065]    It is also noted that the processing of the UDF integrator permits existing supercomputing applications or high-intensity processing/memory applications to be integrated within existing relational database systems to utilize the infrastructure of the database systems and the parallel processing capabilities and resources of those systems. 
         [0066]      FIG. 3  is a diagram of another method  300  for processing relational data with a UDF, according to an example embodiment. The method  300  (hereinafter referred to as “UDF manager”) is implemented, programmed, and resides within a non-transitory computer-readable storage medium for execution on one or more processors of a network that are specifically configured to execute the UDF integrator). The network can be wired, wireless, or a combination of wired and wireless. 
         [0067]    The UDF manager presents another and in some instances an enhanced perspective of the UDF integrator (presented in detail above with reference to the  FIG. 2 ). 
         [0068]    At  310 , the UDF manager converts input data acquired from a relational database into a normalized data format. The exact format of the normalized data can be custom-defined or even defined based on automated rules that are evaluated dynamically and in real time to translate the initial input data into a defined normalized format. 
         [0069]    According to an embodiment, at  311 , the UDF manager calls a pre-processing UDF that intercepts a call being made to a user-customized UDF within the database for purposes of converting the input data into the normalized data format. So, a generic UDF can be used as a form of a transparent proxy within the database system that detects based on an identifier for the user-customized UDF a call being made to the user-customized UDF where the generic pre-processing UDF intercepts the call and automatically converts the input data from the existing relational database format into a normalized data format that is being expected by the user-customized UDF. 
         [0070]    In one scenario, at  312 , the UDF manager translates the input data into a normalized input data array with different dimensions from that which was defined in the input data. An example of how to achieve this was discussed above with reference to the  FIG. 1  where multi-structured and dimensional relational data is normalized into a 2D data input array. 
         [0071]    Continuing with the embodiment of  312  and at  313 , the UDF manager uses a data model acquired from the database to produce the normalized input data array. This can include such things as a table schema being used by the database for the input data. 
         [0072]    In another case of  312  and at  314 , the UDF manager derives the data model dynamically based on attributes acquired for the input data from the database. So, the schema can be dynamically derived based on analysis of the input data and statistics associated with the input data as carried by the database. 
         [0073]    At  320 , the UDF manager passes the normalized input data to a user-customized UDF for processing. Again, this can be a supercomputing application that originally was incompatible with processing within an existing Application Programming Interface (API) associated with the database. So, the UDF can be a legacy application that is being dynamically integrated within the database using existing API&#39;s of the database, via the novel processing associated with the UDF manager. 
         [0074]    According to an embodiment, at  321 , the UDF manager configures the user-customized UDF with processing characteristics defined for the normalized input data for purposes of facilitating parallel processing throughput by the user-customized UDF. In other words, processing logic for handling memory and parallel processing can be configured into aspects of the user-customized UDF. 
         [0075]    In one situation, at  322 , the UDF manager interfaces a memory management UDF and a processing management UDF to the user-customized UDF for purposes of managing memory usage and processor usage of the user-customized UDF while the user-customized UDF processes the normalized input data. So, the processing environment that executes the user-customized UDF can be configured to watch for events and processing to call the memory management UDF and the processing management UDF. In this way, a legacy user-customized UDF can be interfaced with the memory and processing UDFs without changes to the user-customized UDF. In other cases, slight modifications to include files or to processing logic to the user-customized UDF can be made to achieve the interface between the user-customized UDF and the memory and processing UDFs. 
         [0076]    At  330 , the UDF manager captures output data produced by the user-customized UDF for purposes of normalizing that output to a usable relational database format. 
         [0077]    In an embodiment, at  331 , the UDF manager intercepts the output data as it is produced (being streamed) by the user-customized UDF and the UDF manager makes a call to a post-processing UDF. Similar to the processing above at  311 , the output normalization for output data produced by the user-customized UDF can be achieved via a transparent proxy like post-processing UDF. Again, and in one case, at  332 , the UDF manager uses the post-processing UDF to dynamically render the normalized output data. 
         [0078]    At  340 , the UDF manager translates the output data into a normalized data format for updating to the database. This makes the output available by other processes, related or unrelated to the user-customized UDF. 
         [0079]    According to an embodiment, at  350 , the UDF manager processes a debug tool to debug the processing associated with the UDF manager and the user-customized UDF. This debug tool may itself be a UDF with debugging mode or a UDF simulator. 
         [0080]    In this manner, each aspect of the UDF manager can be provided as one or more specific UDFs that integrated into an existing relational database system. By using the UDF API mechanism of an existing relational database system, user-provided supercomputing applications can be integrated into the processing environment of the existing relational database and data consumed by such applications can be acquired from the database and the data produced by such application integrated back into the database system for usage by other applications of the database system. This integration is achieved with minimal effort and in manners that are seamless to the database system and the existing supercomputing applications. 
         [0081]      FIG. 4  is a diagram of UDF processing system  400 , according to an example embodiment. The UDF processing system  400  components are implemented, programmed, and reside within a non-transitory computer-readable storage medium and are executed on one or more processors of a network. The network is wired, wireless, or a combination of wired and wireless. 
         [0082]    In an embodiment, the UDF processing system  400  implements, inter alia, the various aspects of the  FIGS. 1A ,  1 B, and  2 - 3  presented above. 
         [0083]    The UDF processing system  400  includes a pre-process UDF  401  and a post-process UDF  402 . In some embodiments, the UDF processing system  400  also includes a data model feedback module  403 . Each of these components and the interaction between the components will now be discussed in turn. 
         [0084]    The UDF processing system  400  includes one or more processors operational over a network. The processors include a pre-process UDF  401  that is implemented, programmed, and reside within a non-transitory computer-readable storage medium for execution on the one or more processors. Example processing associated with the pre-process UDF  401  was presented above with reference to the  FIGS. 2 and 3 . 
         [0085]    The pre-process UDF  401  is configured to intercept calls made by a user-customized (can be a legacy UDF) to normalize input data being acquired by the user-customized UDF from a parallel processing relational database management system (DBMS). The pre-process UDF  401  provides the normalized input data to the user-customized UDF for processing within the DBMS. 
         [0086]    The processors also include a post-process UDF  402  that is implemented, programmed, and reside within a non-transitory computer-readable storage medium for execution on the one or more processors. Example processing associated with the post-process UDF  402  was presented above with reference to the  FIGS. 2 and 3 . 
         [0087]    The post-process UDF  402  is configured to intercept output data produced by the user-customized UDF and translate the output data into a normalized output data. The normalized output data can then be used and made available through the DBMS to other applications and services of the DBMS via existing APIs of the DBMS. 
         [0088]    In an embodiment, the processors also include a data model feedback module  402  that is implemented, programmed, and reside within a non-transitory computer-readable storage medium for execution on the one or more processors. Example processing associated with the data model feedback module  402  was presented above with reference to the  FIG. 2 . 
         [0089]    The data model feedback module  402  is configured to dynamically update a data model that defines the input data based on the normalized output data. The data model feedback module  402  may itself be implemented as a UDF within the DBMS. 
         [0090]    Now that it has been demonstrated how processing, such as super-computing techniques, is achieved on relational data using a UDF, a sample implementation and source code for one aspect of such an implementation on one or more processors of a network-based system is presented. The implementation resides and is programmed within a non-transitory computer-readable storage medium and compiled as executable code that the one or more processors are configured to execute. It is noted that the source code is but one implementation that can be achieved with the techniques presented herein. 
         [0091]    The sample source-code implementation for a UDF build phrase of multiple row input and output that supports large relational data is as follows: 
         [0092]    The above description is illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reviewing the above description. The scope of embodiments should therefore be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.