-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
expression: support tidb encode key function #51678
Conversation
Hi @tangenta. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #51678 +/- ##
=================================================
- Coverage 72.8726% 56.6772% -16.1955%
=================================================
Files 1598 1729 +131
Lines 444224 630892 +186668
=================================================
+ Hits 323718 357572 +33854
- Misses 100549 249723 +149174
- Partials 19957 23597 +3640
Flags with carried forward coverage won't be shown. Click here to find out more.
|
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I love this |
i hope those functions would works in normal query like :
|
@D3Hunter If we put this in normal query, I think we cannot get the MVCC of deleted rows/indexes? |
@D3Hunter I don't think a function should need or be able to know the current plan is a SELECT operating on exactly one physical table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must not be merged before the privilege check bypass is fixed.
See #51683 (comment) for a PoC.
ok, for downvoters, get from query is much simplier, i don't like to input so many parameters to just get the key of it, and it's error-prone to do that as we have to remember the definition of the pk/index. also privilige check is easier, by reuse existing one.
can use
don't get your point, where is |
@D3Hunter what is the result of select tidb_handle() from a, b;
select tidb_handle() from dual;
select tidb_handle() from (select * from t) _;
create view v as select 1;
select tidb_handle() from v; |
if we use the pattern, just check and report error in this case |
please ask PM for approval for new feature |
/hold unhold it after PM approve |
@tangenta: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@Frank945946: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[LGTM Timeline notifier]Timeline:
|
/unhold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some test for user privileges?
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Frank945946, kennytm, tangenta, time-and-fate, wjhuang2016, XuHuaiyu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
* origin/master: (33 commits) build(deps): bump github.com/prometheus/common from 0.55.0 to 0.57.0 (pingcap#55762) build(deps): bump golang.org/x/sys from 0.24.0 to 0.25.0 (pingcap#55894) planner: fix incorrect estRows with global index and json column (pingcap#55842) ddl, stat: switch to new struct for add/truncate/drop partition (pingcap#55893) planner: hide instance plan cache eviction log if no plan is evicted (pingcap#55918) expression: support tidb encode key function (pingcap#51678) planner: fix incorrect maintenance of `handleColHelper` for recursive CTE (pingcap#55732) executor: some code refine of hash join v2 (pingcap#55887) infoschema, meta: fix wrong auto id after `rename table` (pingcap#55847) ddl/ingest: set `minCommitTS` when detect remote duplicate keys (pingcap#55588) planner: move index advisor into the kernel (pingcap#55874) ddl, stats: switch to new struct for create/truncate table (pingcap#55811) executor: avoid new small objects in probe stage of hash join v2 (pingcap#55855) *: Add tidbCPU/tikvCPU into system tables (pingcap#55455) ddl: use static contexts in `NewReorgCopContext` (pingcap#55823) executor: fix index out of range bug in hash join v2 (pingcap#55864) executor: record index usage for the clustered primary keys (pingcap#55602) domain: load all non-public tables into infoschema (pingcap#55142) test: fix unstable TestShowViewPriv (pingcap#55868) ttl: add `varbinary` case for `TestSplitTTLScanRangesWithBytes` (pingcap#55863) ...
What problem does this PR solve?
Issue Number: close #51683
Problem Summary: See #51683.
What changed and how does it work?
This PR supports three builtin functions, namely
tidb_mvcc_info()
,tidb_encode_record_key()
andtidb_encode_index_key()
:tidb_mvcc_info(key)
returns MVCC information of a given key.tidb_encode_record_key(dbName, tableName, handle/pk columns...)
returns a row record key. The table must exist.tidb_encode_index_key(dbName, tableName, indexName, idx columns..., handle/pk columns...)
returns a index record key. The index must exist.Please also note that tableName can be one of formats as below:
t
: refer to non-partitioned tablet
.t(p1)
: refer to partition tablet
and the partitionp1
.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.