Feature Request
Enable the SHA2 function to be pushed down to TiKV for coprocessor evaluation.
Background
TiKV already implements SHA2 in its coprocessor (components/tidb_query_expr/src/impl_encryption.rs), supporting all hash lengths (SHA-0/224/256/384/512). The TiDB side also has:
- PbCode mapping:
tipb.ScalarFuncSig_SHA2 (in builtin_encryption.go)
- distsql deserialization support (in
distsql_builtin.go)
However, SHA2 is missing from the scalarExprSupportedByTiKV allowlist in infer_pushdown.go, so it is never pushed down to TiKV. MD5 and SHA1 are already in the list.
Motivation
Pushing SHA2 down to TiKV reduces data transfer and allows TiKV to evaluate SHA2 in WHERE clauses locally, improving query performance for SHA2-based filtering.
Related: pingcap/tidb-tools#886
Feature Request
Enable the
SHA2function to be pushed down to TiKV for coprocessor evaluation.Background
TiKV already implements SHA2 in its coprocessor (
components/tidb_query_expr/src/impl_encryption.rs), supporting all hash lengths (SHA-0/224/256/384/512). The TiDB side also has:tipb.ScalarFuncSig_SHA2(inbuiltin_encryption.go)distsql_builtin.go)However,
SHA2is missing from thescalarExprSupportedByTiKVallowlist ininfer_pushdown.go, so it is never pushed down to TiKV.MD5andSHA1are already in the list.Motivation
Pushing SHA2 down to TiKV reduces data transfer and allows TiKV to evaluate SHA2 in WHERE clauses locally, improving query performance for SHA2-based filtering.
Related: pingcap/tidb-tools#886