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
Add Rust bindings for Schema #650
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #650 +/- ##
==========================================
+ Coverage 84.18% 84.36% +0.17%
==========================================
Files 113 115 +2
Lines 10403 10526 +123
==========================================
+ Hits 8758 8880 +122
- Misses 1645 1646 +1
|
daft/logical/schema2.py
Outdated
|
||
def __iter__(self) -> Iterator[Field]: | ||
col_names = self.column_names() | ||
return (self[name] for name in col_names) |
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.
return iter
of the tuple
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.
This actually returns a generator rather than a tuple
:
>>> x = (i for i in range(10))
>>> type(x)
<class 'generator'>
I can do yield from
instead if its clearer?
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.
nah its fine then
s._schema = schema | ||
return s | ||
|
||
def __getitem__(self, key: str) -> Field: |
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.
runtime check that key is a str
to avoid panic in pyo3
Ok(self.schema.names()?) | ||
} | ||
|
||
pub fn union(&self, other: &PySchema) -> PyResult<PySchema> { |
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.
this union method should be implemented in Schema
rather than having the logic in the pybindings
Adds a
schema2.py
which includes Rust bindings for schema