Skip to content

Commit 3adb700

Browse files
committed
fix: check nullability
1 parent af94be0 commit 3adb700

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/substrait/extension_registry.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,30 @@ def covers(
165165
return False
166166
if getattr(covered.varchar, "length", 0) > getattr(parameterized_type, "length", 0):
167167
return False
168+
return True
168169
return _check_nullability(check_nullability,parameterized_type,covered,kind)
169170

170171
if isinstance(parameterized_type, SubstraitTypeParser.FixedCharContext):
171172
if kind != "fixed_char":
172173
return False
173174
if getattr(covered.fixed_char, "length", 0) > getattr(parameterized_type, "length", 0):
174175
return False
176+
return True
175177
return _check_nullability(check_nullability,parameterized_type,covered,kind)
176178

177179
if isinstance(parameterized_type, SubstraitTypeParser.FixedBinaryContext):
178180
if kind != "fixed_binary":
179181
return False
180182
if getattr(covered.fixed_binary, "length", 0) > getattr(parameterized_type, "length", 0):
181183
return False
184+
return True
182185
return _check_nullability(check_nullability,parameterized_type,covered,kind)
183186
if isinstance(parameterized_type, SubstraitTypeParser.DecimalContext):
184187
if kind != "decimal":
185188
return False
186189
if not _check_nullability(check_nullability,parameterized_type,covered,kind):
187190
return False
191+
return True
188192
# precision / scale are both optional – a missing value means “no limit”.
189193
covered_scale = getattr(covered.decimal, "scale", 0)
190194
param_scale = getattr(parameterized_type, "scale", 0)
@@ -203,16 +207,18 @@ def covers(
203207
return False
204208
if not _check_nullability(check_nullability,parameterized_type,covered,kind):
205209
return False
206-
covered_prec = getattr(covered.precision_timestamp, "precision", 0)
207-
param_prec = getattr(parameterized_type, "precision", 0)
208-
return covered_prec == param_prec
210+
return True
211+
# covered_prec = getattr(covered.precision_timestamp, "precision", 0)
212+
# param_prec = getattr(parameterized_type, "precision", 0)
213+
# return covered_prec == param_prec
209214

210215

211216
if isinstance(parameterized_type, SubstraitTypeParser.PrecisionTimestampTZContext):
212217
if kind != "precision_timestamp_tz":
213218
return False
214219
if not _check_nullability(check_nullability,parameterized_type,covered,kind):
215220
return False
221+
return True
216222
covered_prec = getattr(covered.precision_timestamp_tz, "precision", 0)
217223
param_prec = getattr(parameterized_type, "precision", 0)
218224
return covered_prec == param_prec

0 commit comments

Comments
 (0)