Skip to content

Commit 49f91bc

Browse files
authored
Merge branch 'main' into copy-purge
2 parents d4f1904 + 18a6be8 commit 49f91bc

File tree

10 files changed

+255
-83
lines changed

10 files changed

+255
-83
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "System Functions",
3+
"link": {
4+
"type": "generated-index",
5+
"slug": "/reference/functions/system-functions"
6+
}
7+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: CLUSTERING_INFORMATION
3+
---
4+
5+
Returns clustering information of a table.
6+
7+
## Syntax
8+
9+
```sql
10+
CLUSTERING_INFORMATION(‘<database_name>’, ‘<table_name>’)
11+
```
12+
13+
## Examples
14+
15+
```sql
16+
CREATE TABLE mytable(a int, b int) CLUSTER BY(a+1);
17+
18+
INSERT INTO mytable VALUES(1,1),(3,3);
19+
INSERT INTO mytable VALUES(2,2),(5,5);
20+
INSERT INTO mytable VALUES(4,4);
21+
22+
SELECT * FROM CLUSTERING_INFORMATION(‘default‘,’mytable‘);
23+
24+
---
25+
| cluster_by_keys | total_block_count | total_constant_block_count | average_overlaps | average_depth | block_depth_histogram |
26+
|-----------------|-------------------|----------------------------|------------------|---------------|-----------------------|
27+
| ((a + 1)) | 3 | 1 | 1.3333 | 2.0 | {"00002":3} |
28+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: FUSE_SEGMENT
3+
---
4+
5+
Returns the segment information of a snapshot of table.
6+
7+
## Syntax
8+
9+
```sql
10+
FUSE_SEGMENT('<database_name>', '<table_name>','<snapshot_id>')
11+
```
12+
13+
## Examples
14+
15+
```sql
16+
CREATE TABLE mytable(c int);
17+
INSERT INTO mytable values(1);
18+
INSERT INTO mytable values(2);
19+
20+
-- Obtain a snapshot ID
21+
SELECT snapshot_id FROM FUSE_SNAPSHOT('default', 'mytable') limit 1;
22+
23+
---
24+
+----------------------------------+
25+
| snapshot_id |
26+
+----------------------------------+
27+
| 82c572947efa476892bd7c0635158ba2 |
28+
+----------------------------------+
29+
30+
SELECT * FROM FUSE_SEGMENT('default', 'mytable', '82c572947efa476892bd7c0635158ba2');
31+
32+
---
33+
+----------------------------------------------------+----------------+-------------+-----------+--------------------+------------------+
34+
| file_location | format_version | block_count | row_count | bytes_uncompressed | bytes_compressed |
35+
+----------------------------------------------------+----------------+-------------+-----------+--------------------+------------------+
36+
| 1/319/_sg/d35fe7bf99584301b22e8f6a8a9c97f9_v1.json | 1 | 1 | 1 | 4 | 184 |
37+
| 1/319/_sg/c261059d47c840e1b749222dabb4b2bb_v1.json | 1 | 1 | 1 | 4 | 184 |
38+
+----------------------------------------------------+----------------+-------------+-----------+--------------------+------------------+
39+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: FUSE_SNAPSHOT
3+
---
4+
5+
Returns the snapshot information of a table for querying previous versions of your data. For more information, see [AT](../../30-sql/20-query-syntax/dml-at.md).
6+
7+
## Syntax
8+
9+
```sql
10+
FUSE_SNAPSHOT('<database_name>', '<table_name>')
11+
```
12+
13+
## Examples
14+
15+
```sql
16+
CREATE TABLE mytable(a int, b int) CLUSTER BY(a+1);
17+
18+
INSERT INTO mytable VALUES(1,1),(3,3);
19+
INSERT INTO mytable VALUES(2,2),(5,5);
20+
INSERT INTO mytable VALUES(4,4);
21+
22+
SELECT * FROM FUSE_SNAPSHOT(‘default‘,’mytable‘);
23+
24+
---
25+
| snapshot_id | snapshot_location | format_version | previous_snapshot_id | segment_count | block_count | row_count | bytes_uncompressed | bytes_compressed | timestamp |
26+
|----------------------------------|------------------------------------------------------------|----------------|----------------------------------|---------------|-------------|-----------|--------------------|------------------|----------------------------|
27+
| dd98266f968f4817b470255592d04fda | 670655/670675/_ss/dd98266f968f4817b470255592d04fda_v1.json | 1 | \N | 1 | 1 | 2 | 16 | 290 | 2022-09-07 01:58:55.204997 |
28+
| 2f2d004ff6f842cdb25f5631b2bbb703 | 670655/670675/_ss/2f2d004ff6f842cdb25f5631b2bbb703_v1.json | 1 | dd98266f968f4817b470255592d04fda | 2 | 2 | 4 | 32 | 580 | 2022-09-07 01:59:09.742999 |
29+
| 0aa6dfd5d5364bde80f21161ba48c96e | 670655/670675/_ss/0aa6dfd5d5364bde80f21161ba48c96e_v1.json | 1 | 2f2d004ff6f842cdb25f5631b2bbb703 | 3 | 3 | 5 | 40 | 862 | 2022-09-07 01:59:16.858454 |
30+
```

docs/doc/30-reference/30-sql/20-query-syntax/dml-at.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: AT
33
---
44

5-
The SELECT statement can include an AT clause that allows you to query previous versions of your data by a specific snapshot ID or timestamp.
5+
The SELECT statement can include an AT clause that allows you to query previous versions of your data by a specific snapshot ID or timestamp.
66

77
Databend automatically creates snapshots when data updates occur, so a snapshot can be considered as a view of your data at a time point in the past. You can access a snapshot by the snapshot ID or the timestamp at which the snapshot was created. For how to obtain the snapshot ID and timestamp, see [Obtaining Snapshot ID and Timestamp](#obtaining-snapshot-id-and-timestamp).
88

@@ -26,12 +26,7 @@ SELECT snapshot_id,
2626
FROM fuse_snapshot('<database_name>', '<table_name>');
2727
```
2828

29-
You can find more information related to the snapshots by executing the following statement:
30-
31-
```sql
32-
SELECT *
33-
FROM Fuse_snapshot('<database_name>', '<table_name>');
34-
```
29+
For more information about the FUSE_SNAPSHOT function,see [FUSE_SNAPSHOT](../../20-functions/111-system-functions/fuse_snapshot.md).
3530

3631
## Examples
3732

src/query/functions-v2/src/scalars/math.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ pub fn register(registry: &mut FunctionRegistry) {
176176
for left in ALL_INTEGER_TYPES {
177177
with_number_mapped_type!(L, match left {
178178
DataType::L => {
179-
registry.register_1_arg::<NumberType<L>, NumberType<f64>, _, _>(
179+
registry.register_1_arg::<NumberType<L>, NumberType<L>, _, _>(
180180
"ceil",
181181
FunctionProperty::default(),
182182
|_| None,
183-
|val| val as f64,
183+
|val| val,
184184
);
185185
}
186186
_ => unreachable!(),

src/query/functions-v2/tests/it/scalars/math.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fn test_math() {
2929
test_abs(file);
3030
test_sign(file);
3131
test_trigonometric(file);
32+
test_ceil(file);
3233
test_exp(file);
3334
test_round(file);
3435
test_sqrt(file);
@@ -74,6 +75,16 @@ fn test_trigonometric(file: &mut impl Write) {
7475
)]);
7576
}
7677

78+
fn test_ceil(file: &mut impl Write) {
79+
run_ast(file, "ceil(5)", &[]);
80+
run_ast(file, "ceil(5.6)", &[]);
81+
run_ast(file, "ceil(a)", &[(
82+
"a",
83+
DataType::Float64,
84+
Column::from_data(vec![1.23f64, -1.23]),
85+
)]);
86+
}
87+
7788
fn test_exp(file: &mut impl Write) {
7889
run_ast(file, "exp(2)", &[]);
7990
run_ast(file, "exp(-2)", &[]);

src/query/functions-v2/tests/it/scalars/testdata/math.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,45 @@ evaluation (internal):
191191
+--------+--------------------------------------------------------------------------+
192192

193193

194+
ast : ceil(5)
195+
raw expr : ceil(5_u8)
196+
checked expr : ceil<UInt8>(5_u8)
197+
optimized expr : 5_u8
198+
output type : UInt8
199+
output domain : Unknown
200+
output : 5
201+
202+
203+
ast : ceil(5.6)
204+
raw expr : ceil(5.6_f64)
205+
checked expr : ceil<Float64>(5.6_f64)
206+
optimized expr : 6.0_f64
207+
output type : Float64
208+
output domain : Unknown
209+
output : 6.0
210+
211+
212+
ast : ceil(a)
213+
raw expr : ceil(ColumnRef(0)::Float64)
214+
checked expr : ceil<Float64>(ColumnRef(0))
215+
evaluation:
216+
+--------+----------------+---------+
217+
| | a | Output |
218+
+--------+----------------+---------+
219+
| Type | Float64 | Float64 |
220+
| Domain | {-1.23..=1.23} | Unknown |
221+
| Row 0 | 1.23 | 2.0 |
222+
| Row 1 | -1.23 | -1.0 |
223+
+--------+----------------+---------+
224+
evaluation (internal):
225+
+--------+------------------------+
226+
| Column | Data |
227+
+--------+------------------------+
228+
| a | Float64([1.23, -1.23]) |
229+
| Output | Float64([2.0, -1.0]) |
230+
+--------+------------------------+
231+
232+
194233
ast : exp(2)
195234
raw expr : exp(2_u8)
196235
checked expr : exp<UInt8>(2_u8)

src/query/service/src/pipelines/executor/pipeline_executor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ impl PipelineExecutor {
178178
}
179179
}
180180

181-
if let Err(error_code) = self.graph.check_finished() {
182-
let may_error = Some(error_code);
183-
(self.on_finished_callback)(&may_error)?;
184-
return Err(may_error.unwrap());
185-
}
181+
// if let Err(error_code) = self.graph.check_finished() {
182+
// let may_error = Some(error_code);
183+
// (self.on_finished_callback)(&may_error)?;
184+
// return Err(may_error.unwrap());
185+
// }
186186

187187
(self.on_finished_callback)(&None)?;
188188
Ok(())

0 commit comments

Comments
 (0)