Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create stream at navigation point #15062

Merged
merged 8 commits into from
Mar 26, 2024
Merged

Conversation

zhyass
Copy link
Member

@zhyass zhyass commented Mar 21, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

CREATE [ OR REPLACE ] STREAM [IF NOT EXISTS]
  <name>
  ON TABLE <table_name>
  [ AT ( { TIMESTAMP => <timestamp> | SNAPSHOT => <sid> | STREAM => '<name>' } ) ]
  [ APPEND_ONLY = TRUE | FALSE ]
  [ COMMENT = '<string_literal>' ]
mysql> create or replace stream s on table t;
Query OK, 0 rows affected (0.10 sec)

mysql> select * from t;
+------+
| a    |
+------+
|    1 |
|    2 |
+------+
2 rows in set (0.13 sec)
Read 2 rows, 9.00 B in 0.021 sec., 96 rows/sec., 432.02 B/sec.

mysql> select * from s;
Empty set (0.16 sec)
Read 0 rows, 0.00 B in 0.006 sec., 0 rows/sec., 0.00 B/sec.

mysql> insert into t values(3);
Query OK, 1 row affected (0.18 sec)

mysql> select * from fuse_snapshot('default','t');
+----------------------------------+--------------------------------------------------+----------------+----------------------------------+---------------+-------------+-----------+--------------------+------------------+------------+----------------------------+
| snapshot_id                      | snapshot_location                                | format_version | previous_snapshot_id             | segment_count | block_count | row_count | bytes_uncompressed | bytes_compressed | index_size | timestamp                  |
+----------------------------------+--------------------------------------------------+----------------+----------------------------------+---------------+-------------+-----------+--------------------+------------------+------------+----------------------------+
| 1f7ec30caf514099823edf630afbe4fa | 1/13/_ss/1f7ec30caf514099823edf630afbe4fa_v4.mpk |              4 | 664b7580be9046f491d94c271d2164b5 |             2 |           2 |         3 |                 14 |              763 |        674 | 2024-03-21 17:38:54.418932 |
| 664b7580be9046f491d94c271d2164b5 | 1/13/_ss/664b7580be9046f491d94c271d2164b5_v4.mpk |              4 | NULL                             |             1 |           1 |         2 |                  9 |              384 |        337 | 2024-03-21 17:31:01.004308 |
+----------------------------------+--------------------------------------------------+----------------+----------------------------------+---------------+-------------+-----------+--------------------+------------------+------------+----------------------------+
2 rows in set (0.09 sec)
Read 2 rows, 394.00 B in 0.072 sec., 27.85 rows/sec., 5.36 KiB/sec.

mysql> insert into t values(4);
Query OK, 1 row affected (0.17 sec)

mysql> create or replace stream s1 on table t at(snapshot=>'1f7ec30caf514099823edf630afbe4fa');
Query OK, 0 rows affected (0.08 sec)

mysql> select * from s1;
+------+---------------+------------------+----------------------------------------+
| a    | change$action | change$is_update | change$row_id                          |
+------+---------------+------------------+----------------------------------------+
|    4 | INSERT        |                0 | a82642a8baf74318a7e6e7391cd0c691000000 |
+------+---------------+------------------+----------------------------------------+
1 row in set (0.18 sec)
Read 1 rows, 197.00 B in 0.013 sec., 75.86 rows/sec., 14.59 KiB/sec.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

@github-actions github-actions bot added the pr-feature this PR introduces a new feature to the codebase label Mar 21, 2024
@zhyass zhyass marked this pull request as draft March 21, 2024 15:18
@zhyass zhyass marked this pull request as ready for review March 25, 2024 03:46
@zhyass zhyass added the ci-cloud Build docker image for cloud test label Mar 25, 2024
Copy link
Contributor

Docker Image for PR

  • tag: pr-15062-3f18a21

note: this image tag is only available for internal use,
please check the internal doc for more details.

Copy link
Member

@dantengsky dantengsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except databend-common-ast::it parser::test_statement need adjustment

@dantengsky
Copy link
Member

cc @zhyass

seems golden file of databend-common-ast::it parser::test_statement need some tweaks .

https://github.com/datafuselabs/databend/actions/runs/8430425986/job/23086265896?pr=15062#step:4:3301

@zhyass zhyass added this pull request to the merge queue Mar 26, 2024
@BohuTANG BohuTANG removed this pull request from the merge queue due to a manual request Mar 26, 2024
@BohuTANG BohuTANG merged commit 40d2b84 into databendlabs:main Mar 26, 2024
72 checks passed
@BohuTANG
Copy link
Member

@PsiACE @soyeric128

This PR is a new feature of stream, we introduce a new syntax for stream:

 [ AT ( { TIMESTAMP => <timestamp> | SNAPSHOT => <sid> | STREAM => '<name>' } ) ]

Documentation update needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cloud Build docker image for cloud test pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: stream support specify offset
3 participants