Added row-level checks for geometry columns#636
Conversation
|
✅ 491/491 passed, 1 flaky, 41 skipped, 3h14m27s total Flaky tests:
Running from acceptance #3401 |
|
All commits in PR should be signed ('git commit -S ...'). See https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits |
3a32a50 to
ddfcbf3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #636 +/- ##
==========================================
+ Coverage 88.75% 90.40% +1.65%
==========================================
Files 64 64
Lines 6306 6350 +44
==========================================
+ Hits 5597 5741 +144
+ Misses 709 609 -100 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c172bcf to
2ccdcdf
Compare
|
Nice work! I was wondering, what use cases would you solve with the area_eq and area_not_eq checks? Also, for the user it is unclear what kind of area we are talking about (for general geom the coords are in meters and you would typically do it in m^2 in the grid, but for geog the user might be expecting that the lat/lon coords would lead to the area on earth in m^2) |
Do you think we should have separate check methods for geometry and geography? The geometry checks could allow the user to set an SRID to control the area units of measure. I believe |
There was a problem hiding this comment.
Pull Request Overview
This PR adds eight new geometry validation functions for data quality checks on spatial data, covering area and point count validations with standard comparison operators.
- Implements area validation functions (
has_area_less_than,has_area_greater_than,has_area_equal_to,has_area_not_equal_to) - Implements point count validation functions (
has_num_points_less_than,has_num_points_greater_than,has_num_points_equal_to,has_num_points_not_equal_to) - Adds comprehensive test coverage including unit tests, integration tests, and performance benchmarks
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/databricks/labs/dqx/geo/check_funcs.py |
Implements the 8 new geometry check functions and a helper function for spatial comparisons |
tests/integration/test_row_checks_geo.py |
Adds integration tests for all new geometry check functions |
tests/perf/test_apply_checks.py |
Adds performance benchmark tests for the new functions |
tests/perf/.benchmarks/baseline.json |
Records baseline performance metrics for the new functions |
tests/resources/all_row_geo_checks.yaml |
Adds YAML configuration examples for the new checks |
tests/integration/test_apply_checks.py |
Integrates the new check functions into existing test suite |
src/databricks/labs/dqx/llm/resources/yaml_checks_examples.yml |
Adds YAML examples for LLM resources |
docs/dqx/docs/reference/quality_checks.mdx |
Documents the new functions in the quality checks reference |
docs/dqx/docs/reference/benchmarks.mdx |
Updates benchmark documentation with new function metrics |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| limit: 100.0 | ||
| - criticality: error | ||
| check: | ||
| function: has_area_less_than | ||
| arguments: | ||
| column: polygon_geom | ||
| limit: 0.1 |
There was a problem hiding this comment.
Inconsistent parameter naming: has_area_greater_than and has_area_less_than use limit while has_area_equal_to and has_area_not_equal_to use value. All area functions should use the same parameter name for consistency.
| limit: 100.0 | |
| - criticality: error | |
| check: | |
| function: has_area_less_than | |
| arguments: | |
| column: polygon_geom | |
| limit: 0.1 | |
| value: 100.0 | |
| - criticality: error | |
| check: | |
| function: has_area_less_than | |
| arguments: | |
| column: polygon_geom | |
| value: 0.1 |
| limit: 100.0 | ||
| - criticality: error | ||
| check: | ||
| function: has_area_less_than | ||
| arguments: | ||
| column: polygon_geom | ||
| limit: 0.1 |
There was a problem hiding this comment.
Inconsistent parameter naming: has_area_greater_than and has_area_less_than use limit while has_area_equal_to and has_area_not_equal_to use value. All area functions should use the same parameter name for consistency.
| limit: 100.0 | |
| - criticality: error | |
| check: | |
| function: has_area_less_than | |
| arguments: | |
| column: polygon_geom | |
| limit: 0.1 | |
| value: 100.0 | |
| - criticality: error | |
| check: | |
| function: has_area_less_than | |
| arguments: | |
| column: polygon_geom | |
| value: 0.1 |
| function: has_area_greater_than | ||
| arguments: | ||
| column: polygon_geom | ||
| limit: 100.0 |
There was a problem hiding this comment.
Inconsistent parameter naming in documentation: has_area_greater_than and has_area_less_than use limit while has_area_equal_to and has_area_not_equal_to use value. This should match the actual API which uses value for all functions.
| function: has_area_less_than | ||
| arguments: | ||
| column: polygon_geom | ||
| limit: 0.1 |
There was a problem hiding this comment.
Inconsistent parameter naming in documentation: has_area_greater_than and has_area_less_than use limit while has_area_equal_to and has_area_not_equal_to use value. This should match the actual API which uses value for all functions.
Changes
Added row-level checks for geometry columns (e.g. WKT):
is_area_less_thanis_area_greater_thanis_area_equal_tois_area_not_equal_tois_num_points_less_thanis_num_points_greater_thanis_num_points_equal_tois_num_points_not_equal_toLinked issues
Resolves #605
Tests