Skip to content

coprocessor: add encoded_ops module for TiFlash dictionary encoding (Phases 1-4) - #3

Open
devin-ai-integration[bot] wants to merge 2 commits into
tidb-shard-key-support-v8.5.6from
tidb-encoded-support-v8.5.6
Open

coprocessor: add encoded_ops module for TiFlash dictionary encoding (Phases 1-4)#3
devin-ai-integration[bot] wants to merge 2 commits into
tidb-shard-key-support-v8.5.6from
tidb-encoded-support-v8.5.6

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 16, 2026

Copy link
Copy Markdown

What is changed and how it works?

Issue Number: ref #xxx

What's Changed:

TiKV's coprocessor acts as a relay for encoded operation hints from TiDB to TiFlash. This PR adds the encoded_ops module with all necessary struct definitions for Phases 1-4.

Phase 1 — Base Encoding Hints:

  • EncodingHint: column IDs, max cardinality, per-operation enable flags
  • EncodedBloomFilterHint: bloom filter on dictionary entries for semi-join

Phase 2 — Encoded Filter Relay:

  • EncodedFilterRequest: column_id, filter_type (eq/ne/in/like), serialized values

Phase 3 — Encoded Group-By Relay:

  • EncodedGroupByRequest: group-by column IDs, AggFuncType enum (Sum/Count/Min/Max/Any), estimated groups

Phase 4 — Encoded Star Join Relay:

  • EncodedStarJoinRequest: fact table, dimension joins, fused path flag
  • DimensionJoinRequest: dimension table + column mapping

Composite:

  • EncodedOpsRequest: combines all 4 phases into single DAGRequest attachment
  • has_any_ops() / active_phases() helpers
coprocessor: add encoded_ops module for TiFlash encoded operations (Phases 1-4)

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test (9 test cases covering all structs, enums, composite request)
  • Integration test
  • Manual test
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

None

Link to Devin session: https://6sense.devinenterprise.com/sessions/3710f99abca4415ba59b856f0a5588fc
Requested by: @premal

Adds TiKV-side support for passing dictionary encoding hints through
the coprocessor pipeline to TiFlash:

- EncodingHint struct: carries column eligibility, cardinality threshold,
  and enabled encoded operations (filter, group-by, bloom filter)
- EncodedBloomFilterHint: supports bloom filter pushdown on dictionary-
  encoded columns for efficient semi-join filtering
- Comprehensive unit tests for hint construction and bloom filter logic

TiKV's role is passthrough — it forwards encoding hints from TiDB's
DAGRequest to TiFlash without interpretation. The actual dictionary
encoding and encoded operations happen in TiFlash's execution engine.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Adds TiKV-side relay structs for:
- EncodedFilterRequest: filter predicate info relayed to TiFlash
- EncodedGroupByRequest: array-indexed aggregation parameters
- EncodedStarJoinRequest: fused star join configuration
- EncodedOpsRequest: composite request combining all 4 phases
- AggFuncType enum: Sum, Count, Min, Max, Any
- DimensionJoinRequest: one dimension in a star schema

9 tests covering all new structs and the composite request.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot changed the title coprocessor: add encoded_ops module for TiFlash dictionary encoding hints coprocessor: add encoded_ops module for TiFlash dictionary encoding (Phases 1-4) Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant