Class ExtractSpatialJoins
For example:
- SELECT ... FROM a, b WHERE ST_Contains(b.geometry, a.geometry)
- SELECT ... FROM a, b WHERE ST_Intersects(b.geometry, a.geometry)
- SELECT ... FROM a, b WHERE ST_Distance(b.geometry, a.geometry) invalid input: '<'= 300
- SELECT ... FROM a, b WHERE 15.5 > ST_Distance(b.geometry, a.geometry)
Joins expressed via ST_Contains and ST_Intersects functions must match all of the following criteria:
- arguments of the spatial function are non-scalar expressions; - one of the arguments uses symbols from left side of the join, the other from right.
Joins expressed via ST_Distance function must use less than or less than or equals operator to compare ST_Distance value with a radius and must match all of the following criteria:
- arguments of the spatial function are non-scalar expressions; - one of the arguments uses symbols from left side of the join, the other from right; - radius is either scalar expression or uses symbols only from the right (build) side of the join.
For inner join, replaces cross join node and a qualifying filter on top with a single spatial join node.
For both inner and left joins, pushes non-trivial expressions of the spatial function arguments and radius into projections on top of join child nodes.
Examples:
Point-in-polygon inner join
ST_Contains(ST_GeometryFromText(a.wkt), ST_Point(b.longitude, b.latitude))
becomes a spatial join
ST_Contains(st_geometryfromtext, st_point)
with st_geometryfromtext -> 'ST_GeometryFromText(a.wkt)' and
st_point -> 'ST_Point(b.longitude, b.latitude)' projections on top of child nodes.
Distance query
ST_Distance(ST_Point(a.lon, a.lat), ST_Point(b.lon, b.lat)) invalid input: '<'= 10 / (111.321 * cos(radians(b.lat)))
becomes a spatial join
ST_Distance(st_point_a, st_point_b) invalid input: '<'= radius
with st_point_a -> 'ST_Point(a.lon, a.lat)', st_point_b -> 'ST_Point(b.lon, b.lat)'
and radius -> '10 / (111.321 * cos(radians(b.lat)))' projections on top of child nodes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
ConstructorsConstructorDescriptionExtractSpatialJoins(PlannerContext plannerContext, SplitManager splitManager, PageSourceManager pageSourceManager, IrTypeAnalyzer typeAnalyzer) -
Method Summary
-
Constructor Details
-
ExtractSpatialJoins
public ExtractSpatialJoins(PlannerContext plannerContext, SplitManager splitManager, PageSourceManager pageSourceManager, IrTypeAnalyzer typeAnalyzer)
-
-
Method Details
-
rules
-