You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/engine-flink/ddl.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ DROP DATABASE my_db;
58
58
59
59
### PrimaryKey Table
60
60
61
-
The following SQL statement will create a [PrimaryKey Table](table-design/table-types/pk-table.md) with a primary key consisting of shop_id and user_id.
61
+
The following SQL statement will create a [PrimaryKey Table](table-design/table-types/pk-table/index.md) with a primary key consisting of shop_id and user_id.
Copy file name to clipboardExpand all lines: website/docs/engine-flink/lookups.md
+177-4Lines changed: 177 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,13 @@ sidebar_position: 5
7
7
Flink lookup joins are important because they enable efficient, real-time enrichment of streaming data with reference data, a common requirement in many real-time analytics and processing scenarios.
8
8
9
9
10
-
## Instructions
11
-
- Use a primary key table as a dimension table, and the join condition must include all primary keys of the dimension table.
10
+
## Lookup
11
+
12
+
### Instructions
13
+
- Use a primary key table as a dimension table, and the join condition must include all primary keys of the dimension table.
12
14
- Fluss lookup join is in asynchronous mode by default for higher throughput. You can change the mode of lookup join as synchronous mode by setting the SQL Hint `'lookup.async' = 'false'`.
@@ -94,3 +135,135 @@ ON `o`.`o_custkey` = `c`.`c_custkey`;
94
135
| lookup.partial-cache.expire-after-write | Duration | optional | (none) | Duration to expire an entry in the cache after writing. |
95
136
| lookup.partial-cache.cache-missing-key | Boolean | optional | true | Whether to store an empty value into the cache if the lookup key doesn't match any rows in the table. |
96
137
| lookup.partial-cache.max-rows | Long | optional | true | The maximum number of rows to store in the cache. |
138
+
139
+
140
+
## Prefix Lookup
141
+
142
+
### Instructions
143
+
144
+
- Use a primary key table as a dimension table, and the join condition must a prefix subset of the primary keys of the dimension table.
145
+
- The bucket key of Fluss dimension table need to set as the join key when creating Fluss table.
146
+
- Fluss prefix lookup join is in asynchronous mode by default for higher throughput. You can change the mode of prefix lookup join as synchronous mode by setting the SQL Hint `'lookup.async' = 'false'`.
147
+
148
+
149
+
### Examples
150
+
1. Create two tables.
151
+
```sql title="Flink SQL"
152
+
CREATETABLE `fluss_catalog`.`my_db`.`orders` (
153
+
`o_orderkey`INTNOT NULL,
154
+
`o_custkey`INTNOT NULL,
155
+
`o_orderstatus`CHAR(1) NOT NULL,
156
+
`o_totalprice`DECIMAL(15, 2) NOT NULL,
157
+
`o_orderdate`DATENOT NULL,
158
+
`o_orderpriority`CHAR(15) NOT NULL,
159
+
`o_clerk`CHAR(15) NOT NULL,
160
+
`o_shippriority`INTNOT NULL,
161
+
`o_comment` STRING NOT NULL,
162
+
`o_dt` STRING NOT NULL,
163
+
PRIMARY KEY (o_orderkey) NOT ENFORCED
164
+
);
165
+
```
166
+
167
+
```sql title="Flink SQL"
168
+
-- primary keys are (c_custkey, c_nationkey)
169
+
-- bucket key is (c_custkey)
170
+
CREATETABLE `fluss_catalog`.`my_db`.`customer` (
171
+
`c_custkey`INTNOT NULL,
172
+
`c_name` STRING NOT NULL,
173
+
`c_address` STRING NOT NULL,
174
+
`c_nationkey`INTNOT NULL,
175
+
`c_phone`CHAR(15) NOT NULL,
176
+
`c_acctbal`DECIMAL(15, 2) NOT NULL,
177
+
`c_mktsegment`CHAR(10) NOT NULL,
178
+
`c_comment` STRING NOT NULL,
179
+
PRIMARY KEY (`c_custkey`, `c_nationkey`) NOT ENFORCED
For primary key tables, Fluss supports querying data directly based on the key. Please refer to
91
-
the [Flink Reads](../../../engine-flink/reads.md) for detailed instructions.
92
88
93
89
## Changelog Generation
94
90
@@ -117,10 +113,22 @@ be generated.
117
113
-D(1, 4.0, 'banana')
118
114
```
119
115
120
-
## Data Consumption
116
+
## Data Queries
117
+
118
+
For primary key tables, Fluss supports various kinds of querying abilities.
119
+
120
+
### Reads
121
121
122
-
For a primary key table, the default consumption method is a full snapshot followed by incremental data. First, the
122
+
For a primary key table, the default read method is a full snapshot followed by incremental data. First, the
123
123
snapshot data of the table is consumed, followed by the binlog data of the table.
124
124
125
-
It is also possible to only consume the binlog data of the table. For more details, please refer to
126
-
the [Flink Reads](../../../engine-flink/reads.md)
125
+
It is also possible to only consume the binlog data of the table. For more details, please refer to the [Flink Reads](/docs/engine-flink/reads.md)
126
+
127
+
### Lookup
128
+
129
+
Fluss primary key table can lookup data by the primary keys. If the key exists in Fluss, lookup will return a unique row. it always used in [Flink Lookup Join](/docs/engine-flink//lookups.md#lookup).
130
+
131
+
### Prefix Lookup
132
+
133
+
Fluss primary key table can also do prefix lookup by the prefix subset primary keys. Unlike lookup, prefix lookup
134
+
will scan data based on the prefix of primary keys and may return multiple rows. It always used in [Flink Prefix Lookup Join](/docs/engine-flink/lookups.md#prefix-lookup).
0 commit comments