Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/duckdb_py/pyrelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,9 @@ static JoinType ParseJoinType(const string &type) {

unique_ptr<DuckDBPyRelation> DuckDBPyRelation::Join(DuckDBPyRelation *other, const py::object &condition,
const string &type) {
if (!other) {
throw InvalidInputException("No relation provided for join");
}

JoinType join_type;
string type_string = StringUtil::Lower(type);
Expand Down
7 changes: 7 additions & 0 deletions tests/fast/api/test_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def test_relational_join_with_condition(self):
res = rel.fetchall()
assert res == [(1, 2, 1, 3)]

def test_join_none_raises(self):
con = duckdb.connect()
rel = con.sql("SELECT 1 AS col1")

with pytest.raises(duckdb.InvalidInputException, match="No relation provided for join"):
rel.join(None, "col1")

@pytest.mark.xfail(condition=True, reason="Selecting from a duplicate binding causes an error")
def test_deduplicated_bindings(self, duckdb_cursor):
duckdb_cursor.execute("create table old as select * from (values ('42', 1), ('21', 2)) t(a, b)")
Expand Down
Loading