No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search


To have a better experience, please upgrade your IE browser.


FusionInsight HD 6.5.0 Product Description 02

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Stream SQL Join

Stream SQL Join

Flink's Table API & SQL is a language-integrated query API for Scala and Java that allows the composition of queries from relational operators such as selection, filter, and join in a very intuitive way. Table API & SQL for details about Table API&SQL, visit the following website:

Introduction to Stream SQL Join

Stream SQL Join is used to query data based on the relationship between columns in two or more tables. Flink Steam SQL Join allows you to join two stream tables and query results from them. Queries similar to the following are supported:

SELECT o.proctime, o.productId, o.orderId, s.proctime AS shipTime 
FROM Orders AS o 
JOIN Shipments AS s 
ON o.orderId = s.orderId 
AND o.proctime BETWEEN s.proctime AND s.proctime + INTERVAL '1' HOUR;

Currently, Stream SQL Join needs to be performed within a specified window. The join operation for data within the window requires at least one equi-join predicate and a join condition that bounds the time on both sides. Such a condition can be defined by two appropriate range predicates (<, <=, >=, >), a BETWEEN predicate, or a single equality predicate that compares time attributes of the same type (i.e., processing time or event time) of both input tables.

An example below will join all orders with their corresponding shipments if the order was shipped four hours after the order was received.

FROM Orders o, Shipments s
WHERE = s.orderId AND
o.ordertime BETWEEN s.shiptime - INTERVAL '4' HOUR AND s.shiptime
  1. The join hint only supports inner join.
  2. The ON clause should include equi-join condition.
  3. Time attributes only support processing time and event time.
  4. Window condition only supports bounded time range like o.proctime BETWEEN s.proctime - INTERVAL '1' HOUR AND s.proctime + INTERVAL '1' HOUR, does not support unbounded like o.proctime > s.protime, and should include both two stream's proctime attribute, o.proctime between proctime() and proctime() + 1 should also not be supported.
Updated: 2019-05-17

Document ID: EDOC1100074548

Views: 3276

Downloads: 36

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Previous Next