In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-12-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to achieve vertica storage, the content is very detailed, interested friends can refer to, hope to be helpful to you.
General languages such as JAVA lack structured computing libraries, and even the simplest structured algorithms, such as query, sorting, and aggregation, have to be hard-coded from scratch. For commonly used algorithms, such as grouping summarization and associative queries, you need to write a large amount of code. For more complex algorithms, you even have to design multiple classes to barely implement them.
As long as it takes more time, JAVA can always implement the algorithm, but the disadvantage of high coupling can not be avoided. The stored procedure should be independent of the JAVA code, and modifying the stored procedure should not affect the JAVA code. However, the stored procedures developed by JAVA will be closely coupled with other JAVA code. As long as the stored procedures are modified, the whole project will be recompiled and packaged, and the maintenance cost of the project will inevitably increase.
Implementing vertica stored procedures is much easier if you use an aggregator.
The aggregator has a rich structured class library, which can be directly implemented by built-in functions, no matter query, sorting, aggregation, grouping summary and associated query. The aggregator also provides branch judgment, circular statements and dynamic syntax for structured data, and complex business logic can also be easily implemented. The aggregator also provides a standard JDBC interface for JAVA code to call, and the actual stored procedure exists in the form of a script file. Modifying the stored procedure does not affect the JAVA code.
For example, the sales table in vertica stores the order letter of the salesperson.
Logical algorithm: for each sales, find his largest and smallest three orders, respectively marked with "top3" and "bottom3". Considering that the number of orders is too small and meaningless, it is stipulated that when the number of orders for a certain sale is less than 3, then top3 will not be calculated, and when the number of orders is less than 6, bottom3 will not be calculated. The calculation results should be as follows:
The aggregator code is as follows:
ABCD1=connect@l ("verticaDB")
2=A1.cursor@x ("select * from sales order by sellerid,amount")
3for A2 sellerid
/ for each seller4
If A3.len () > = 3=A3.m (to (- 1mam Murray 3)) = C4.derive ("top3": orderType) 5
If A3.len () > = 6=A3.m (to (3)) = C5.derive ("bottom3": orderType) 6
= @ | D4 | D5
/ merge top+bottom for every seller7return B6
So much for sharing about how to achieve storage in vertica. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.