mattmartin14 commented on PR #1534: URL: https://github.com/apache/iceberg-python/pull/1534#issuecomment-2632000004
@Fokko - FYI, i tried updating the literals.py file and added in the "date_to_days" function; but when i ran my unit test, i got an error; below are the details: *code update* ```python def literal(value: L) -> Literal[L]: """ Construct an Iceberg Literal based on Python primitive data type. Args: value (Python primitive type): the value to be associated with literal. Example: from pyiceberg.expressions.literals import literal. >>> literal(123) LongLiteral(123) """ if isinstance(value, float): return DoubleLiteral(value) # type: ignore elif isinstance(value, bool): return BooleanLiteral(value) elif isinstance(value, int): return LongLiteral(value) elif isinstance(value, str): return StringLiteral(value) elif isinstance(value, UUID): return UUIDLiteral(value.bytes) # type: ignore elif isinstance(value, bytes): return BinaryLiteral(value) elif isinstance(value, Decimal): return DecimalLiteral(value) elif isinstance(value, date): return (date_to_days(value)) else: raise TypeError(f"Invalid literal value: {repr(value)}") ``` error message when running tests.table.test_merge_rows test_merge_scenario_1c_simple(): ```bash File "/Users/vaa7rq/oss/pyiceberg_merge/iceberg-python/pyiceberg/expressions/__init__.py", line 516, in bind return self.as_bound(bound_term, {lit.to(bound_term.ref().field.field_type) for lit in self.literals}) ^^^^^^ AttributeError: 'int' object has no attribute 'to' ``` I'm puzzled on this one. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org