Skip to content

Commit

Permalink
fix: intial
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Jul 7, 2023
1 parent 6a57a08 commit 9a2773d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/src/arrow/acero/hash_join_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ Status HashJoinSchema::ValidateSchemas(JoinType join_type, const Schema& left_sc
const auto& type = *field->type();
if (!IsTypeSupported(type)) {
return Status::Invalid("Data type ", type,
" is not supported in join non-key field");
" is not supported in join non-key field ", field->name());
}
}
for (const auto& field : right_schema.fields()) {
const auto& type = *field->type();
if (!IsTypeSupported(type)) {
return Status::Invalid("Data type ", type,
" is not supported in join non-key field");
" is not supported in join non-key field ", field->name());
}
}

Expand Down
24 changes: 24 additions & 0 deletions python/pyarrow/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -2422,3 +2422,27 @@ def test_numpy_asarray(constructor):
result = np.asarray(table3, dtype="int32")
np.testing.assert_allclose(result, expected)
assert result.dtype == "int32"


def test_invalid_non_join_column():
NUM_ITEMS = 30
t1 = pa.Table.from_pydict({
'id': [x.to_bytes(4, 'big') for x in range(NUM_ITEMS)],
'array_column': [[z for z in range(3)] for x in range(NUM_ITEMS)],
})
t2 = pa.Table.from_pydict({
'id': [x.to_bytes(4, 'big') for x in range(NUM_ITEMS)],
'value': [x for x in range(NUM_ITEMS)]
})

# check as left table
with pytest.raises(pa.lib.ArrowInvalid) as excinfo:
t1.join(t2, 'id', join_type='inner')
exp_error_msg = "Data type list<item: int64> is not supported " \
+ "in join non-key field array_column"
assert exp_error_msg in str(excinfo.value)

# check as right table
with pytest.raises(pa.lib.ArrowInvalid) as excinfo:
t2.join(t1, 'id', join_type='inner')
assert exp_error_msg in str(excinfo.value)

0 comments on commit 9a2773d

Please sign in to comment.