-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Description
What happens?
I came upon a problem, where joining a table against itself using spatial join results in 0 rows - but join with the same predicates + an extra one using a "nested loop" join.
Probably related to nulls in the table- running the join and filtering for nulls I am seeing correct results.
To Reproduce
Load the CSV attached. You may need to recreate GEOM column so;
ALTER TABLE wypopo DROP COLUMN geom;
ALTER TABLE wypopo ADD COLUMN geom GEOMETRY;
UPDATE wypopo SET geom = st_point(polozenie_x, polozenie_y);
select count(*) from wypopo a join wypopo b on st_dwithin(a.geom, b.geom, 0); ┌──────────────┐
│ count_star() │
│ int64 │
├──────────────┤
│ 0 │
└──────────────┘
explain analyze select count(*) from wypopo a join wypopo b on st_dwithin(a.geom, b.geom, 0) ;┌────────────────────────────────────────────────┐
│┌──────────────────────────────────────────────┐│
││ Total Time: 0.0081s ││
│└──────────────────────────────────────────────┘│
└────────────────────────────────────────────────┘
┌───────────────────────────┐
│ QUERY │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ EXPLAIN_ANALYZE │
│ ──────────────────── │
│ 0 Rows │
│ (0.00s) │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ UNGROUPED_AGGREGATE │
│ ──────────────────── │
│ Aggregates: │
│ count_star() │
│ │
│ 1 Rows │
│ (0.00s) │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ EXTENSION │
│ ──────────────────── │
│ Join Type: INNER │
│ │
│ Conditions: ├──────────────┐
│ ST_DWithin(geom, geom) │ │
│ │ │
│ 0 Rows │ │
│ (0.00s) │ │
└─────────────┬─────────────┘ │
┌─────────────┴─────────────┐┌─────────────┴─────────────┐
│ TABLE_SCAN ││ TABLE_SCAN │
│ ──────────────────── ││ ──────────────────── │
│ Table: wypopo ││ Table: wypopo │
│ Type: Sequential Scan ││ Type: Sequential Scan │
│ Projections: geom ││ Projections: geom │
│ ││ │
│ 10000 Rows ││ 10000 Rows │
│ (0.00s) ││ (0.00s) │
└───────────────────────────┘└───────────────────────────┘
select count(*) from wypopo a join wypopo b on st_dwithin(a.geom, b.geom, 0) where a.geom is not null;┌──────────────┐
│ count_star() │
│ int64 │
├──────────────┤
│ 10277 │
└──────────────┘
select count(*) from wypopo a join wypopo b on st_dwithin(a.geom, b.geom, 0) where a.id<> b.id;100%
┌──────────────┐
│ count_star() │
│ int64 │
├──────────────┤
│ 330 │
└──────────────┘
OS:
MacOS
DuckDB Version:
1.3.2
DuckDB Client:
command line
Hardware:
No response
Full Name:
Grzegorz Mucha
Affiliation:
No affiliation ATM
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a stable release
Did you include all relevant data sets for reproducing the issue?
No - Other reason (please specify in the issue body)
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?
- Yes, I have
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels