rdblue commented on code in PR #6525:
URL: https://github.com/apache/iceberg/pull/6525#discussion_r1068822911
##########
python/tests/expressions/test_evaluator.py:
##########
@@ -52,112 +55,126 @@
)
+def _record_simple(id: int, data: Optional[str]) -> Record:
+ r = Record(SIMPLE_SCHEMA.as_struct())
Review Comment:
Overall, I'm okay with the changes and I approved this PR. But I think it's
a little awkward to need to construct `Record` instances this way.
I think we may be able to do both if we make `Record.__init__` like this:
```python
def Record:
def __init__(self, *data, struct=None):
self.struct = struct
size = len(struct) if struct else len(data)
self.data = list([None] * size)
for pos, value in enumerate(data):
self.data[pos] = value
```
That allows passing `struct` as a keyword arg, or passing raw values so both
of these work correctly:
```python
Record(1, "a")
Record(struct=StructType(...))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]