Flink基础(119):FLINK-SQL语法 (13) DQL(5) OPERATIONS(2) SELECT & WHERE clause/ SELECT DISTINCT(FLINK 1.13
2021/8/27 2:36:02
本文主要是介绍Flink基础(119):FLINK-SQL语法 (13) DQL(5) OPERATIONS(2) SELECT & WHERE clause/ SELECT DISTINCT(FLINK 1.13,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
SELECT & WHERE clause
Batch Streaming
The general syntax of the SELECT
statement is:
SELECT select_list FROM table_expression [ WHERE boolean_expression ]
The table_expression
refers to any source of data. It could be an existing table, view, or VALUES
clause, the joined results of multiple existing tables, or a subquery. Assuming that the table is available in the catalog, the following would read all rows from Orders
.
SELECT * FROM Orders
The select_list
specification *
means the query will resolve all columns. However, usage of *
is discouraged in production because it makes queries less robust to catalog changes. Instead, a select_list
can specify a subset of available columns or make calculations using said columns. For example, if Orders
has columns named order_id
, price
, and tax
you could write the following query:
SELECT order_id, price + tax FROM Orders
Queries can also consume from inline data using the VALUES
clause. Each tuple corresponds to one row and an alias may be provided to assign names to each column.
SELECT order_id, price FROM (VALUES (1, 2.0), (2, 3.1)) AS t (order_id, price)
Rows can be filtered based on a WHERE
clause.
SELECT price + tax FROM Orders WHERE id = 10
Additionally, built-in and user-defined scalar functions can be invoked on the columns of a single row. User-defined functions must be registered in a catalog before use.
SELECT PRETTY_PRINT(order_id) FROM Orders
SELECT DISTINCT
Batch Streaming
If SELECT DISTINCT
is specified, all duplicate rows are removed from the result set (one row is kept from each group of duplicates).
SELECT DISTINCT id FROM Orders
For streaming queries, the required state for computing the query result might grow infinitely. State size depends on number of distinct rows. You can provide a query configuration with an appropriate state time-to-live (TTL) to prevent excessive state size. Note that this might affect the correctness of the query result. See query configuration for details
这篇关于Flink基础(119):FLINK-SQL语法 (13) DQL(5) OPERATIONS(2) SELECT & WHERE clause/ SELECT DISTINCT(FLINK 1.13的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-09CMS内容管理系统是什么?如何选择适合你的平台?
- 2025-01-08CCPM如何缩短项目周期并降低风险?
- 2025-01-08Omnivore 替代品 Readeck 安装与使用教程
- 2025-01-07Cursor 收费太贵?3分钟教你接入超低价 DeepSeek-V3,代码质量逼近 Claude 3.5
- 2025-01-06PingCAP 连续两年入选 Gartner 云数据库管理系统魔力象限“荣誉提及”
- 2025-01-05Easysearch 可搜索快照功能,看这篇就够了
- 2025-01-04BOT+EPC模式在基础设施项目中的应用与优势
- 2025-01-03用LangChain构建会检索和搜索的智能聊天机器人指南
- 2025-01-03图像文字理解,OCR、大模型还是多模态模型?PalliGema2在QLoRA技术上的微调与应用
- 2025-01-03混合搜索:用LanceDB实现语义和关键词结合的搜索技术(应用于实际项目)