Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the data model of the database?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the data model of the database". The content of the explanation is simple and clear, and it is easy to learn and understand. let's follow the editor's train of thought to study and learn "what is the data model of the database"!

Data model (Data Model)

Storm uses tuple as its data model. Each tuple is a pile of values, each value has a name, and each value can be of any type. In my understanding, a tuple can be seen as a java object with no methods. Overall, storm supports all basic types, strings, and byte arrays as value class types for tuple. You can also use your own defined types as value types, as long as you implement the corresponding serializer (serializer).

Each node in the topology must define each field of the tuple it wants to emit. For example, the following bolt defines that the tuple emitted by its lock contains two fields of type doble and triple.

Publicclass DoubleAndTripleBolt implements IRichBolt {private OutputCollectorBase _ collector; @ Override

Publicvoid prepare (Map conf, TopologyContext context, OutputCollectorBase collector) {

_ collector = collector;}

@ Override

Publicvoid execute (Tuple input) {int val = input.getInteger (0)

_ collector.emit (input, new Values (val*2, val*3)); _ collector.ack (input);}

@ Override

Publicvoid cleanup () {}

@ Override

Publicvoid declareOutputFields (OutputFieldsDeclarer declarer) {

Declarer.declare (new Fields ("double", "triple");}}

The declareOutputFields method defines the fields to output: ["double", "triple"]. We'll explain the rest of this bolt later.

Thank you for your reading. the above is the content of "what is the data model of the database". After the study of this article, I believe you have a deeper understanding of what the data model of the database is. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report