feat: add order to primary key#5683
Conversation
|
ACTION NEEDED The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification. For details on the error please inspect the "PR Title Check" action. |
|
|
||
| </details> | ||
|
|
||
| ### Unenforced Primary Key |
There was a problem hiding this comment.
thanks for adding this! I missed it in the doc refresh
Address review feedback to use field_id instead of position for consistency with other specs like partitioning and region specs. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add note that primary key is fixed after initial setting - Change "column ordering" to "primary key field ordering" in docs - Simplify inline comments - Update test comments to match doc terminology Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jackye1995
left a comment
There was a problem hiding this comment.
looks good to me! pending CI
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| To mark a field as part of the primary key, add the following metadata to the Arrow field: | ||
|
|
||
| - `lance-schema:unenforced-primary-key`: Set to `true`, `1`, or `yes` (case-insensitive) to indicate the field is part of the primary key. | ||
| - `lance-schema:unenforced-primary-key:field-id` (optional): A 1-based integer specifying the primary key field id within a composite primary key. |
There was a problem hiding this comment.
Sorry for the back and forth, but I think I agree now that position is better than field-id. For partition and region spec, they represent new fields in the spec so spec makes sense. But here it is pretty confusing to have field ID and primary key field ID in the same place. Let's move back to that.
Address review feedback to avoid confusion between "schema field id" and "primary key field id" by using "position" terminology instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use is_unenforced_primary_key() method instead of the removed unenforced_primary_key field. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Java: Add unenforcedPrimaryKeyPosition field and getter to LanceField - Python: Add is_unenforced_primary_key() and unenforced_primary_key_position() methods to LanceField Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This PR adds ordering to primary key so that it can be used for btree index. This is a part of the work to make the MemTable proposal work after discussion with @jackye1995, and for my use case the primary key has to be multiple. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This PR adds ordering to primary key so that it can be used for btree index. This is a part of the work to make the MemTable proposal work after discussion with @jackye1995, and for my use case the primary key has to be multiple. @jackye1995 could you take a look?