| 1008 | |
| 1009 | |
| 1010 | def test_invalid_expression_ser_des(): |
| 1011 | schema = pa.schema([ |
| 1012 | pa.field("x", pa.int32()), |
| 1013 | pa.field("y", pa.int32()) |
| 1014 | ]) |
| 1015 | expr = pc.equal(pc.field("x"), 7) |
| 1016 | bad_expr = pc.equal(pc.field("z"), 7) |
| 1017 | # Invalid number of names |
| 1018 | with pytest.raises(ValueError) as excinfo: |
| 1019 | pa.substrait.serialize_expressions([expr], [], schema) |
| 1020 | assert 'need to have the same length' in str(excinfo.value) |
| 1021 | with pytest.raises(ValueError) as excinfo: |
| 1022 | pa.substrait.serialize_expressions([expr], ["foo", "bar"], schema) |
| 1023 | assert 'need to have the same length' in str(excinfo.value) |
| 1024 | # Expression doesn't match schema |
| 1025 | with pytest.raises(ValueError) as excinfo: |
| 1026 | pa.substrait.serialize_expressions([bad_expr], ["expr"], schema) |
| 1027 | assert 'No match for FieldRef' in str(excinfo.value) |
| 1028 | |
| 1029 | |
| 1030 | def test_serializing_multiple_expressions(): |