-
Notifications
You must be signed in to change notification settings - Fork 445
feat: support pylance 4.0.0 #6678
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,15 +27,15 @@ def __init__( | |
| column: str, | ||
| index_type: str, | ||
| name: str, | ||
| fragment_uuid: str, | ||
| index_uuid: str, | ||
| replace: bool, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| self.lance_ds = lance_ds | ||
| self.column = column | ||
| self.index_type = index_type | ||
| self.name = name | ||
| self.fragment_uuid = fragment_uuid | ||
| self.index_uuid = index_uuid | ||
| self.replace = replace | ||
| self.kwargs = kwargs | ||
|
|
||
|
|
@@ -51,7 +51,7 @@ def __call__(self, fragment_ids: list[int]) -> bool: | |
| index_type=self.index_type, | ||
| name=self.name, | ||
| replace=self.replace, | ||
| fragment_uuid=self.fragment_uuid, | ||
| index_uuid=self.index_uuid, | ||
| fragment_ids=fragment_ids, | ||
| **self.kwargs, | ||
| ) | ||
|
|
@@ -180,7 +180,7 @@ def create_scalar_index_internal( | |
| column=column, | ||
| index_type=index_type, | ||
| name=name, | ||
| fragment_uuid=index_id, | ||
| index_uuid=index_id, | ||
| replace=replace, | ||
| **kwargs, | ||
| ) | ||
|
|
@@ -208,9 +208,31 @@ def create_scalar_index_internal( | |
| fragment_ids=set(fragment_ids_to_use), | ||
| index_version=0, | ||
| ) | ||
|
|
||
| # When replacing, find and remove existing indices with the same name | ||
| removed_indices = [] | ||
| if replace: | ||
| try: | ||
| existing_indices = lance_ds.list_indices() | ||
| for idx in existing_indices: | ||
| if idx["name"] == name: | ||
| removed_indices.append( | ||
| lance.Index( | ||
| uuid=idx["uuid"], | ||
| name=idx["name"], | ||
| fields=[lance_ds.schema.get_field_index(f) for f in idx["fields"]], | ||
| dataset_version=lance_ds.version, | ||
| fragment_ids=idx.get("fragment_ids", set()), | ||
| index_version=0, | ||
| ) | ||
| ) | ||
| except Exception: | ||
| # If we can't check existing indices, continue without removing | ||
| pass | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If except Exception as e:
logger.warning(
"Could not fetch existing indices for removal; old index may not be cleaned up: %s", e
) |
||
|
|
||
| create_index_op = lance.LanceOperation.CreateIndex( | ||
| new_indices=[index], | ||
| removed_indices=[], | ||
| removed_indices=removed_indices, | ||
| ) | ||
|
|
||
| # Commit the index operation atomically | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,7 @@ gravitino = ["requests>=2.28.0,<3.0.0"] | |||||
| hudi = ["pyarrow >= 8.0.0,<22.1.0"] | ||||||
| huggingface = ["huggingface-hub<1.5.0", "datasets<4.6.0"] | ||||||
| iceberg = ["pyiceberg >= 0.7.0, <= 0.11.0, != 0.9.1, != 0.10.0"] | ||||||
| lance = ["pylance<0.40.0"] | ||||||
| lance = ["pylance>=0.39.0,<5.0.0"] | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| numpy = ["numpy<2.4.0"] | ||||||
| openai = ["openai<2.21.0", "numpy<2.4.0", "pillow==12.1.1"] | ||||||
| pandas = ["pandas<2.4.0"] | ||||||
|
|
@@ -108,7 +108,7 @@ dev = [ | |||||
| # Ray | ||||||
| "ray[data, client]==2.53.0", | ||||||
| # Lance | ||||||
| "pylance==0.39.0", | ||||||
| "pylance==4.0.0", | ||||||
| # Iceberg | ||||||
| "pyiceberg==0.11.0", | ||||||
| "pydantic==2.12.4", | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -197,7 +197,7 @@ def test_build_distributed_index_invalid_index_type(self, multi_fragment_lance_d | |||||||||||||
|
|
||||||||||||||
| with pytest.raises( | ||||||||||||||
| NotImplementedError, | ||||||||||||||
| match=r'Only "BTREE", "BITMAP", "NGRAM", "ZONEMAP", "LABEL_LIST", or "INVERTED" or "BLOOMFILTER" are supported for scalar columns. Received INVALID', | ||||||||||||||
| match=r'Only "BTREE", "BITMAP", "NGRAM", "ZONEMAP", "LABEL_LIST", "INVERTED", "BLOOMFILTER" or "RTREE" are supported for scalar columns. Received INVALID', | ||||||||||||||
| ): | ||||||||||||||
|
Comment on lines
198
to
201
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The regex now matches the exact error text emitted by pylance 4.0.0 (including
Suggested change
|
||||||||||||||
| create_scalar_index( | ||||||||||||||
| uri=dataset_uri, | ||||||||||||||
|
|
||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
dataset_versionfor removed indices uses current version instead of the index's creation versionlance_ds.versionhere is the version aftermerge_index_metadatawas called, which is later than the version at which the existing (to-be-replaced) index was originally committed. Consider using the version from the index metadata if available: