Skip to content

Commit 79a6132

Browse files
fix: handle missing expression type in protobuf import correctly (#71)
This PR fixes the handling of `Expression` protobuf messages that do not of the `expression` type set. Such a message would be invalid Substrait but valid protobuf, so the import logic has to be able to handle that case gracefully. The PR now has a dedicated `case` for that case. Signed-off-by: Ingo Müller <[email protected]>
1 parent 7c55b1b commit 79a6132

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Target/SubstraitPB/Import.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,12 @@ importExpression(ImplicitLocOpBuilder builder, const Expression &message) {
213213
return importFieldReference(builder, message.selection());
214214
case Expression::kScalarFunction:
215215
return importScalarFunction(builder, message.scalar_function());
216+
case Expression::REX_TYPE_NOT_SET:
217+
return emitError(loc) << Twine("expression type not set");
216218
default: {
217219
const pb::FieldDescriptor *desc =
218220
Expression::GetDescriptor()->FindFieldByNumber(rex_type);
219-
return emitError(loc) << Twine("unsupported Expression type: ") +
221+
return emitError(loc) << Twine("unsupported expression type: ") +
220222
desc->name();
221223
}
222224
}

0 commit comments

Comments
 (0)