Skip to content

fix: attach table does not carry the indexes of the original table - #18465

Merged
KKould merged 11 commits into
databendlabs:mainfrom
KKould:fix/attach_table_index
Aug 4, 2025
Merged

fix: attach table does not carry the indexes of the original table#18465
KKould merged 11 commits into
databendlabs:mainfrom
KKould:fix/attach_table_index

Conversation

@KKould

@KKould KKould commented Aug 1, 2025

Copy link
Copy Markdown
Member

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

Summary

when attaching a table, the Indexes in the TableMeta will be lost.

  • Ngram Index
  • Vector Index
  • Inverted Index

after this pr:

show indexes

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│  name  │   type  │  database │          table         │ original │                                 definition                                 │         created_on         │      updated_on     │
│ String │  String │   String  │    Nullable(String)    │  String  │                                   String                                   │          Timestamp         │ Nullable(Timestamp) │
├────────┼─────────┼───────────┼────────────────────────┼──────────┼────────────────────────────────────────────────────────────────────────────┼────────────────────────────┼─────────────────────┤
│ 'idx1' │ 'NGRAM' │ 'default' │ 'amazon_reviews_ngram' │ ''       │ 'amazon_reviews_ngram(review_body)bloom_size=\'2097152\' gram_size=\'10\'' │ 2025-08-01 08:09:19.133712 │ NULL                │
│ 'idx1' │ 'NGRAM' │ 'default' │ 'attach_tbl3'          │ ''       │ 'attach_tbl3(review_body)bloom_size=\'2097152\' gram_size=\'10\''          │ 2025-08-01 08:13:11.131164 │ NULL                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
2 rows read in 0.144 sec. Processed 2 rows, 368 B (13.89 rows/s, 2.50 KiB/s)

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):

This change is Reviewable

@KKould KKould self-assigned this Aug 1, 2025
@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Aug 1, 2025
@KKould
KKould marked this pull request as ready for review August 1, 2025 15:45
@bohutang

bohutang commented Aug 2, 2025

Copy link
Copy Markdown
Member

@KKould Do all index types work with this PR? Concerned about specialized indexes like inverted indexes, virtual column indexes, and others.

@KKould
KKould requested a review from dantengsky August 2, 2025 02:19
@KKould

KKould commented Aug 2, 2025

Copy link
Copy Markdown
Member Author

@KKould Do all index types work with this PR? Concerned about specialized indexes like inverted indexes, virtual column indexes, and others.

In theory, as long as the indexes in TableMeta and the index files are stored on S3, this PR can solve it. Maybe I should add more tests to check the covered indexes.

@KKould
KKould merged commit f017809 into databendlabs:main Aug 4, 2025
90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants