Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/substrait/derivation_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ def _evaluate(x, values: dict):
elif isinstance(
parametrized_type, SubstraitTypeParser.PrecisionIntervalDayContext
):
if parametrized_type.precision is None:
return Type(
interval_day=Type.IntervalDay(
nullability=nullability,
)
)
precision = _evaluate(parametrized_type.precision, values)
return Type(
interval_day=Type.IntervalDay(
Expand Down
9 changes: 9 additions & 0 deletions tests/test_derivation_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ def test_interval_day():
)


def test_interval_day_no_precision():
assert evaluate("interval_day") == Type(
interval_day=Type.IntervalDay(nullability=Type.NULLABILITY_REQUIRED)
)
assert evaluate("interval_day?") == Type(
interval_day=Type.IntervalDay(nullability=Type.NULLABILITY_NULLABLE)
)


def test_struct_simple():
"""Test simple struct with two i32 fields."""
result = evaluate("struct<i32, i32>", {})
Expand Down