Showing posts with label Business computing. Show all posts
Showing posts with label Business computing. Show all posts

September 27, 2013

A creative computing script designed to enhance computing performance


Database plays an irreplaceable role in the modern economy and is widely used in the business computing areas like Enterprise Resources Planning (ERP), Customer Relation Management (CRM), Supply Chain Management (SCM), and the Decision Support System (DSS).
Computation on the structured data in the database mainly relies on SQL (Structured Query Language). SQL is the powerful, simple-to-use, and widely-applied database computing script. However, it has some native drawbacks: non-stepwise computation, incomplete set-lization, and no object reference available. Although almost all vendors have introduced and launched some non-compatible solution, such as various stored procedure like PL-SQL®, T-SQL®. These improved alternatives cannot remedy the native SQL drawbacks.
esProc solves these drawbacks completely with more powerful computational capability, much lower technical requirement, and broader scope of application. It is a more capable database computing scripts.

I. Step-by-step Computation
Case Description
A multinational retail enterprise needs to collect statistics on the newly opened retail store, including: How many new retail stores will open in this year? Of which how many companies have the sales over 1 million dollars? Among these companies with over-1-million sales, how many companies are abased overseas?
This question is progressive. The three questions are mutually related, the next question can be regarded as the further exploring on the current question, fit for step-by-step computation.
The original data is from the database of stores table with the main fields: storeCode, storeName, openedTime, profit, and nation. Let's check the SQL solution first.

 SQL Solution
To solve such problem with SQL, you will need to write 3 SQL statements as given below.
l  SELECT COUNT(*) FROM stores WHERE to_char (openedTime, 'yyyy')  =  to_char (sysdate,'yyyy');
l  SELECT COUNT(*) FROM stores WHERE to_char (openedTime, 'yyyy')  =  to_char (sysdate,'yyyy') and profit>1000000;
l  SELECT COUNT(*) FROM stores WHERE to_char (openedTime, 'yyyy')  =  to_char (sysdate,'yyyy') and profit>1000000 and nation<>’local’;
SQL1:Get the result of question 1.
SQL2:Solve the problem 2.Because the step-by-step computation is impossible (that is, the results of previous computation cannot be utilized), you can only solve and take it as an individual problem.
SQL3: Solve the problem 3,and you are not allowed to compute in steps either.

 esProc Solution









A1 cell: Get the records requested in problem 1.
A2 cell: Step-by-step computation. Operate on the basis of cell A1, and get the record meeting the conditions of problem 2.
A3 cell: Proceed with the step-by-step computation, and get the records requested in the problem 3.
B1, B2, and B3 cell: It is still the step-by-step computation. Count the corresponding records.

Comparison
For the SQL, there are 3 associations for you to compute in steps, and explore progressively. However, because step-by-step computation is hard to implement with SQL, this problem has to be divided into 3 individual problems.
esProc is to compute in steps following the natural habit of thinking: Decompose the general objective into several simple objective; Solve every small objective step by step; and ultimately complete the final objective.
In case that you proceed with the computation on the basis of the original 3 problems, for example, seek "proportion of problem 3 taken in the problem 2", or "on" problem 3, group by country". As for esProc users, they can simply write ”=A3/A2”, and ”A3.group(nation)”. In each step, there is a brief and clear expression of highly readable, without any requirements on a strong technical background. By comparison, SQL requires redesigning the statement. The redesigned statement will undoubtedly become more and more complex and longer. Such job can only be left to those who have the advanced technical ability in SQL.
esProc can decompose the complex problem into simple computation procedure based on the descriptions from the business perceptive. This is just the advantage of the step-by-step computation. By comparison, SQL does not allow for computation by step or problem decomposition, and thus it is against the scientific methodology, and not fit for the complex computation.
II.               Complete Set-lization
Case Description
A certain advertisement agency needs to compute the clients whose annual sales values are among the top 10.
The data are from the sales table, which records the annual sales value of each client with the fields like customer, time, and amount.

 SQL solution
SELECT customer
FROM (
    SELECT customer
    FROM (
         SELECT customer,RANK() OVER(PARTITION BY time ORDER BY amount DESC) rankorder 
         FROM  sales ) 
    WHERE rankorder<=10) 
GROUP BY customer
HAVING COUNT(*)=(SELECT COUNT(DISTINCT time) FROM sales)
Such Problem requires ranking the sets of a set, that is, group by “time” and then rank by “customer” in the group. Since the popular SQL-92 syntax is still hard to represent this, the SQL-2003 standard, which is gradually supported by several vendors, will be used to solve this problem barely.

Just a tip to compute the customer intersections in the last step, the count of years equals to the count of clients.

 esProc Solution









A1: Group the original dataset by year so that A1 will become a set of sets.
B1: Get the serial number of records whose sales values are among the top 10 of each group. The rank() is used to rank in every group, and pselect() can be used to retrieve the serial number on conditions. ~ is used to represent every member in the set. B1 is the “set of set”.
A2: Retrieve the record from A1 according to the serial number stored in B2, and get the customer field of the record.
A3: Compute the intersection of sets.

Comparison
The SQL set-lization is incomplete and can only be used to represent the simple result set. Developers cannot use SQL to represent the concept of “set of set”. Only the queries of 3-level-nested-loops are available to barely perform the similar computations. In addition, SQL cannot be used to perform the intersection operation easily that developers with advanced techniques can only resort to the unreadable statements to perform the similar operations, such as “count of years equal to the count of clients”. It equals to compute the intersection of client sets.
The set is the base of massive data. esProc can achieve set-lization completely, represent the set, member, and other related generic or object reference conveniently, and perform the set operations easily, such as intersection, complement, and union.

When analyzing the set-related data, esProc can greatly reduce the computation complexity. By taking the advantage of set, esProc can solve many problems agilely and easily that are hard to solve with SQL.

III Ordered Set
Case Description
Suppose that a telecommunication equipment manufacturer needs to compute the monthly link relative ratio of sales value (i.e. the increase percent of sales value of each month compared with that of the previous month). The sales data is stored in the sales table with the main fields including salesMonth, and salesAmount.


 SQL solution
select salesAmount, salesMonth,
        (case when
prev_price !=0 then ((salesAmount)/prev_price)-1
else 0
end) compValue
from (select salesMonth, salesAmount,
lag(salesAmount,1,0) over(order by salesMonth) prev_price
from sales) t

The popular SQL-92 has not introduced the concept of serial number, which adds many difficulties to the computation. Considering this, the designer of SQL-2003 has partly remedied this drawback. For example, the window function lag() is used to retrieve the next record in this example.
In addition, in the above statement, the “case when” statement is used to avoid the error of division by zero on the first record.

 esProc Solution
sales.derive(salesAmount / salesAmount [-1]-1: compValue)

The derive() is an esProc function to insert the newly computed column to the existing data. The new column is compValue by name, and the algorithm is “(Sales value of this month/Sales value of previous month)-1”. The “[n]” is used to indicate the relative position, and so [-1] is to represent the data of the previous month.

On the other hand, for the data of the first record, the additional procedure for division by zero is not required in esProc.

Comparison
From the above example, even if using SQL-2003, the solution to such problem is lengthy and complex, while the esProc solution is simple and clear owing to its support for the ordered set.
Moreover, SQL-2003 only provides the extremely limited computation capability. For example, esProc user can simply use the ”{startPosition,endPosition}” to represent the seeking of a range, and simply use ”(-1)” to represent the seeking of the last record. Regarding the similar functionality, it will be much harder for SQL user to implement.
In the practical data analysis, a great many of complex computations are related to the order of data. SQL users are unable to handle such type of computations as easily as esProc users because SQL lacks of the concept of Being Ordered.

IV Object Reference
An insurance enterprise has the below analysis demands: to pick out the annual outstanding employees (Employee of the Year) whose Department Manager has been awarded with the President Honor. The data are distributed in two tables: department table (main fields are deptName, and manager), and employee table (main fields are empName, empHonor, and empDept).

empHonor has three types of values: null value; ”president's award”, PA for short; and ”employee of the year”, EOY for short. There are 2 groups of correspondence relations: empDept and deptName, and Manager and empName.

 SQL solution
SELECT A.* 
FROM employee A,department B,employee C 
WHERE A.empDept=B.deptName AND B.manager=C.empName AND A.empHonor=EOY AND C.empHornor=PA

SQL users can use the nested query or associated query to solve such kind of problems. In this case, we choose the association query that is both concise and clear. The association statement behind the “where” has established the one-to-many relation between deptName and empDept, and the one-to-one relation between manager and empName.

 esProc Solution
employee.select(empHonor:"EOY",empDept.manager.empHornor:"PA")
esProc solution is intuitive: select the employee of “EOY” whose Department Manager has be awarded with “PA”.

Comparison
The SQL statement to solve such kind of question is lengthy and not intuitive. In fact, the complete association query language is “inner join…on…” style. This statement is simplified in the above example. Otherwise it will be much hard to understand.

esProc users can use ”.” for object reference. Such style is intuitive and easy to understand. The complex and lengthy association statement for multiple tables can thus be converted to the simple object access, which is unachievable for SQL. When there are more and more tables, the complexity of SQL association query will rise in geometric series. By comparison, the esProc user can always access the data intuitively and easily by taking the advantage of object reference.

Regarding the multi-table associations of complex computation, esProc can handle it more intuitively and conveniently than SQL.

From the comparison of the above four examples, we can see that esProc is not only characterized with step-by-step computation, complete set-lization, sorted sets, and object reference. The analysis style is intuitive, the syntax style is agile, and the function is powerful. esProc is a tool especially designed for mass data computation, and a more powerful database computing script.

September 10, 2013

Data Source Computation in Advance to Simplify Report Development


According to research, most complex report development work can be simplified by performing the data source computation in advance. For example, find out the clients who bought all products in the given list, and then present the details of these clients.

In developing such reports, it is the “computation” part and not the “presentation” part that brings about major difficulties. In which stage will the computation be most cost-effective? Shall the computation be set in the data retrieval scripting or the post-retrieval report presentation?

The report developers as usual are more willing to compute in the report straightforwardly after retrieving data with SQL or Wizard. On the one hand, it is because most report tools are capable of some step-by-step simple computations by themselves, while SQL only allows for incorporating all logics in one statement and is impossible to be decomposed into several examinable components; on the other hand, most report developers are more familiar with the report functions than that of SQL/SP, and the SQL/SP scripts are more difficult to understand.
        
However, the report alone cannot give the satisfactory result. Many report developers find the computational goal is hard to achieve in the report. They will ultimately be hard-pressed to learn the SQL/SP, or request the assistance from the database administer. Why?

The root cause is that the report is mainly developed to present but not to compute. The computation is a non-core feature of a report designed to solve the commonest and easiest problem. Achieving the truly complex computational goal will still depend on the professional scripts for computing like SQL. So, only computing the data source in advance can simplify and streamline the developing procedure of such reports.
        
Stuck in a dilemma? On the one hand, the report can only provide the limited data computing capability; on the other hand, SQL/SP is hard to comprehend and the computational procedure is neither intuitive, nor step-by-step. This is such a headache for most report developers.

esProc can solve the dilemma. It is a professional development tool for report data source, offering the expected computational capability and the user-friendly grid style. In addition, it enables the step-by-step computation to present the result at each step more clearly than report. Compared with SQL, esProc is easier for report developers to learn and understand. They can use it to solve the complex computation more easily and independently, including the computation of the above case.

esProc scripts: 








Like SQL, esProc supports the external parameters. The report can reference the esProc directly through the JDBC interface.
        
In addition, esProc is built with the perfect debugging function, and is also capable of retrieve and operating on the data from multiple databases, text files, and Excel sheets to implement the cross-database computation. esProc is the good assistant to reporting tools and the expert in report data source computation.


June 26, 2013

Computing with Java for Massive Data without Database

Many Java applications are not incorporated with database. So, what if using such Java applications for query or structured data computing? For example, according to an Excel sheet downloaded from a finance website, find the shares rising for N consecutive days in a certain period.

For the computation on structured data, programmers usually embed the SQL statements in the Java code, and access the database server via JDBC. Although SQL statements are embedded with lots of structured-data-specific algorithms, Java lacks the advanced functions to implement these operations directly and straightforwardly. Therefore, without database, it is quite hard to implement such computation with the language capability of Java only.

It takes programmers a great amount of time and effort to implement every detail in the computation manually. Except the sorting algorithm, almost all algorithms for massive data computing require manual implementations, for example, aggregating, filtering, and grouping. For another example, to define the class and represent every piece of data with object, use List to store multiple pieces of data, and then compute through the nested multi-level loops. The computations of such kinds usually also involve the operations on sets and relations among massive data, or the computations on the relative positions between objects or object properties. It is quite cumbersome to implement these underlying logics.

Embedding a database and then performing ETL is obviously an awkward method. Is there any more agile and convenient method?

In this case, esProc is the best choice. It is a professional database computing and development tool.

esProc is good at simplifying the complex computation, and allows for Java application to access the result from esProc via JDBC. The esProc solution to this case is given below:


 esProc can directly retrieve data from and compute on multiple databases\txt files\Excel sheets. esProc offers a grid style and agile syntax specially tailored for massive structured data computation. With the support for external parameters, the result can be exported via JDBC, and invoked by Java language and reporting tools. So, esProc can boost the Java computational capability dramatically. In addition, it enables the cross-database computation and supports code reuse by nature. Even the debug functionality is also quite perfect. Considering all these advantages, it is clear that esProc is more efficient than SQL. 

June 20, 2013

New Algorithm Helps Java for Massive Structured Data Computing


Java language does not have any competitive advantages in data computing, in particular the massive structured data computing. For example, according to the order detail computation, we need to find out the sales persons whose sales growths are over 10% in 3 consecutive months.

Java does not have the related advanced function to implement this. So, it’s hard for Java to handle such computation only with its own capability. Java needs a large amount of time and effort to manually realize the details in computation. For example, firstly, define classes and represent every piece of data with objects; secondly, use List to store multi-pieces of data; thirdly, use the nested multi-level loops to compute. Except the sorting algorithm, almost all massive data processing algorithms involved in the computation require manual implementation, such as aggregating, filtering, and grouping. Such computations usually involve the set computation and relation computation among massive data, or computation on relative positions between objects and object attributes. It takes great efforts to implement the underlying logics for these computations.

That’s why we must improve the Java computational capability. We need a tool tailored for implementing the structured data computation easily!

How about SQL? Not all Java application allows for using database. In addition, there are many data in Txt/Excel, and sometimes, problems of computation across databases and code reuse may be encountered. Moreover, SQL is still not convenient for handling many computations. Taking the above-mentioned computation for example, SQL is by no means convenient to compose:

01 WITH A AS
02       (SELECT salesMan,month, amount/lag(amount) 
03           OVER(PARTITION BY salesMan ORDER BY month)-1 rising_range 
04           FROM sales), 
05      B AS
06            (SELECT salesMan, 
07                CASE WHEN rising_range>=1.1 AND
08                     lag(rising_range) OVER(PARTITION BY salesMan
09                          ORDER BY month)>=1.1 AND
10                     lag(rising_range,2) OVER(PARTITION BY salesMan
11                          ORDER BY month)>=1.1 
12                THEN 1 ELSE 0 END is_three_consecutive_month 
13      FROM A) 
14 SELECT DISTINCT salesMan FROM B WHERE is_three_consecutive_month=1

In this case, esProc is the better choice.

esProc is a development tool for database computing, specializing in simplifying the complex computation and is quite convenient to integrate with Java. For esProc, the corresponding scripts are shown below:


esProc allows for the direct retrieval and computation across multiple databases, text files, and Excel sheets. Its grid style and agile syntax are especially designed for the massive structured data computation. It supports external parameters, and the result can be exported directly via JDBC. So, with esProc, the computational capability of Java is dramatically improved. In addition, by nature, esProc supports cross-database computation and the code reuse, with very perfect debugging functions. No wonder that the development productivity of esProc is also superior to that of SQL.

June 14, 2013

Why esProc is Created?


Data computing is widely used, and business users hope to complete the data computation independently. Although SQL, R, Java, C and other current solutions have powerful computational ability, coding for complex computing is rather cumbersome(R language is better but too difficult to understand).

Data computing demands are both common and complex
  • Data computing is widely used
  • Abundant data exists in the database but difficult to compute directly
Data analysis and query are essential for data computing. Report data source preparation and data management & ETL also involve data computing. Most of the problems are complex and diverse, and the business computing is usually characterized with timeliness and the unpredication. The computation objects are changing constantly and oftentimes available at any time. Users hope to deal with the data computation conveniently.


Solution: SQL (or MDX)
  • Advantage: Enough computational ability to handle the structured data
  • Disadvantage: Difficult to program and understand
SQL provides the comprehensive computation ability for the massive structured data. However, SQL does not support step by step computation, and cannot handle the set data explicitly, sequence and order, and the function of object reference. SQL completes the computation in an unnatural way for human thinking, thus adding difficulty to the writing and understanding.


Current Solution: High-level Programming Languages
  • Advantage: Powerful enough to control the procedure
  • Disadvantage: Complex application environment
  • Disadvantage: Don’t support structured data with very high coding complexity
JAVA, C#, C++, and other high-level programming languages have a complete mechanism for branch and loop; they are very flexible in term of data computation. However, the application environments of them are too complex. In addition, they don’t support massive structured data well. It is inconvenient to operate on the record, set, dataset, and other data type directly.


Current Solution: R Language
  • Advantage: open-source and massive library functions
  • Disadvantage: difficult to understand and higher technical requirement
R boasts its pretty and agile syntax and the open interface for secondary development, so there are a great number of third party packages. But R lacks the good UI interface. Senior technical background and expertise are required to grasp R. R language is also not specialized for structured data computing, and the related support is not elaborate enough.


May 30, 2013

Desktop BI Helps to Meet Instant Business Analytics Demands


Data computing & analytics software (DCAS for short) is used for processing and studying on various data to get the valuable result. For example, according to the order details, calculate and find the goods whose sales growth rate in the recent 3 years is greater than 20%.

The data source of DCAS is usually the structured data, such as, database, txt file, and spreadsheet. The calculation methods include filtering, grouping, summarizing, sorting, comparison, and discovering the correlation. Similar to ERP, CRM, Reporting tools, Dashboard, OLAP, and ETL, DCAS is also a type of BI.


Desktop BI refers to the BI tools running on the desktop environment, almost without any supports of server. They usually only provides the core BI functions and requires less dependencies on the technical environments. There is an interesting phenomenon: most DCAS tools belong to the Desktop BI, including Excel which holds the largest market shares in the sector of commercial BI tools, R project which ranks the first in the open source software market. Similar examples also include StataCorp Stata, Raqsoft ES series, IBM SPSS, and MathWorks MATLAB, etc.

Is this a coincidence? Compare their features and you can clearly understand the root cause of this phenomenon.

If you ever read the article of What Role Desktop BI Plays, you should know that Desktop BI is characterized by the below features:

l  Lightweight BI tools: Desktop BI neither explores much about the business details directly nor provides a great number of modules to give the ready-to-use answer. Usually, a work process is required to solve a problem.
l  Quicker problem solving: Focusing on BI, the Desktop BI does not require the technical assistance and is ideal for solving the complex problems quickly.
l  Most Desktop BI users are business-oriented, such as the accountants, banking account manager, business analyst, and stock analyst.
l  Self-service and Independence: Desktop BI is usually used by users to complete the BI task independently.
l  Low hardware requirement: Desktop BI is a desktop application with low hardware requirements.

Then, let’s check the features of DCAS:

To address the temporary needs

DCAS is usually used to address the temporary needs, such as the RStudio or esProc computation: For those clients accounting for top 50% of the total sales last year, whose ranks increased this year? The clients’ sales are usually already stored in the business systems and may have been ranked, because these data is frequently used. But for the data not for daily use and only be used in specific occasions, such as “clients accounting for top 50% of the total sales” and “year-on-year comparison based on rankings”, they are usually not available.

The data to be frequently-used can usually be predicated in the early stage of BI system development. The ready-to-use module can be built with Solution BI tools such as the Report Tools, Dashboard, and OLAP. For example, the Dashboard of QlikView is quite fit for the above-mentioned client sales ranking or even the sales ranking.

For the data that is seldom used, since it is usually hard to predicate and less possible to use, the cost is quite high to build all means to get these data into the ready-to-use modules. Therefore, we need to conduct the temporary computation. The Desktop BI refers to the lightweight tools that do not explore into the business details. Although Desktop BI tools do not provide the ready-to-use module to get the answer, they can be used to address these temporary needs via calculation easily. It can be seen clearly that DCAS is characterized by these features of Desktop BI.
        

To meet the sudden demands

DCAS is often used to address the sudden needs. For example, find the product whose sales values are rising in 5 consecutive weeks through rapid calculation in Excel or esCalc, so as to launch the marketing campaign aimfully. Such needs are pressing since the correct results must be calculated out in limited time. In order to achieve the goal of rapid calculation, DCAS shall allow for the full control by users, especially the Business experts must be capable to act independently, and the DCAS functions must focus on the BI sectors. These are just the Desktop BI features.

On the contrary, Solution BI like SAS or SAP usually requires the collaboration between business personnel, DBA, SQL composer, Web administer, programmer, report script developer, and experts in several areas. In addition, they also need going through a series of work processes like the requirement management, departmental approval, resource provision, developing, and responding. The timeline is completely not guaranteed at all, and thus it is not fit for addressing the sudden needs.

What-if method

It is always easier to solve the BI problem with clear computational goal. However, the complex problems are always abstract and ambiguous. To address them, DCAS requires the what-if analysis method. For example, you can resort to RStudio to find the reason for the current climbing complaint rate. To solve such ambiguous problem, we need some reasonable assumptions. For example, the new product debut gives rise to the laggard after-sales, product quality drawback, and after-sale platform failure. These assumptions are the decomposition of goal, that is, decomposing the ambiguous and great target into several simple and clear small goals. Through validating and calculating several simple and clear goals, the complex, ambiguous and great goal can be solved.

The learned and experienced business expert is the key to what-if analysis in determining: what factors are related to the goal? Of these factors, which factors cover all possibilities and do not overlap mutually? Which factors can be verified explicitly? Which factors can be further divided? What are the weights of these factors? Which are highly possible and which are relatively easier to verify? To make the correct judgment on these questions, you may need the in-depth business understanding. Therefore, DCAS tools must be business-oriented, such as esProc. Being business-oriented is just a feature of Desktop BI.

Individual creative work

The labor can be divided into two types of the repetitive work and the creative work. In BI sector, the repetitive work refers to those problems that can be solved through teamwork or collaboration between multiple persons, for example, the commonly-used reports in enterprise, OLAP model tailored for specific industry, and classic correlation analysis. They are in the scope of Solution BI conventionally. But the creative work is quite another thing. For example, use RStudio or esProc to find the new product with the greatest market potential.

For the creative work, no standardized and existing solution. The creative work requires the rich expertise of business experts and computation, and DCAS is really good at such computation. Different experts may see from different perspectives and be in different positions, take different analytical methods, and reach different conclusions. Therefore, their respective process cannot be reproduced. Such calculation is soaked with the strong personal style, being related to the individual background, work experiences, and business preferences of business experts. It is the typical creative work by individuals. The collaboration will backfire and hinder the user creativity.

Therefore, DCAS is usually adopted by users independently as a type of typical Desktop BI.

Ability of expressing the business

Ability of expressing the business is the ability to convert the business jargons into the computer languages. Unlike other BI tools, DCAS users are usually required to analyze the complex goal, which demands the creative work on the basis of a strong business background. In view of this, we can conclude that the core ability of DCAS is to express the business ideas and plans efficiently and cost-effectively, which is an important criterion to discriminate the good DCAS tools from the bad ones. This core ability includes providing the friendly UI, the business-oriented syntax rule, the intuitive and easy-to-understand formulas, and the free analytical style. For example, with esCalc, merge the basic salary, performance, attendance, and multiple spreadsheets into a practical salary sheet according to the No. of employee.

So, we can say that performance is not the top priority for DCAS. The core features of Solution BI like multi-core parallel computing, cloud, and cluster computing can boost the performance only, but not the ability of expressing the business. These features may backfire, distracting users from reaching the business result and even bringing about a bad impact on the correctness of computational results.

In addition, the normal PC can offer the more than enough computational capability. Even the CPU released 5 years ago - Intel i7 - can support more than 8GB memory and are still powerful enough for running almost all DCAS. In fact, not having to rely on servers, most computation and analysis problems can be solved on PCs that are believed to provide only the relatively low performance nowadays. The vast majority of DCAS belongs to the Desktop BI. In case any computational problems requiring a higher PC performance are encountered, DCAS tools, for example R and esProc, can also handle them well with its advanced features, though it seldom happens.

Through the above analyses, we’ve found that many features of DCAS are up to the Desktop BI standard. So, we can call it the typical Desktop BI.