Skip to content

Commit

Permalink
fix(datatypes): infer bytes literal as binary #2915 (#3124)
Browse files Browse the repository at this point in the history
  • Loading branch information
saulpw authored Nov 19, 2021
1 parent f8b5cd8 commit 887efbd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ibis/expr/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,11 @@ def infer_string(value: str) -> String:
return string


@infer.register(bytes)
def infer_bytes(value: bytes) -> Binary:
return binary


@infer.register(builtins.float)
def infer_floating(value: builtins.float) -> Double:
return double
Expand Down
1 change: 1 addition & 0 deletions ibis/tests/expr/test_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ class Foo(enum.Enum):
(False, dt.boolean),
(True, dt.boolean),
('foo', dt.string),
(b'fooblob', dt.binary),
(datetime.date.today(), dt.date),
(datetime.datetime.now(), dt.timestamp),
(datetime.timedelta(days=3), dt.Interval(unit='D')),
Expand Down
1 change: 1 addition & 0 deletions ibis/tests/expr/test_value_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_unicode():
(-2147483649, 'int64'),
(1.5, 'double'),
('foo', 'string'),
(b'fooblob', 'binary'),
([1, 2, 3], 'array<int8>'),
],
)
Expand Down

0 comments on commit 887efbd

Please sign in to comment.