Repository navigation
Implement FunctionVariantAdaptor to support variant type in functions - #90900
Conversation
|
Workflow [PR], commit [3485a2e] Summary: ❌
|
8c72faa to
2b33a29
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the flipCoordinates function to support the Geometry variant type in addition to the existing tuple-based geometric types (Point, Ring, Polygon, MultiPolygon). The implementation processes geometry data stored as variants by converting each geometry subtype, flipping its coordinates, and reconstructing the variant column.
Key changes:
- Added support for
Geometrytype (represented as a variant) in theflipCoordinatesfunction - Implemented coordinate flipping for all geometry subtypes through the variant type system
- Added comprehensive test coverage for the new
Geometrytype support
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Functions/flipCoordinates.cpp | Implements Geometry variant type support by adding variant column handling, geometry type conversion helpers, and a new executeForGeometry method that processes each geometry subtype |
| tests/queries/0_stateless/03444_flip_coordinates.sql | Adds test cases covering Geometry type with various subtypes (Point, LineString, Polygon, etc.) and verifies correct type preservation |
| tests/queries/0_stateless/03444_flip_coordinates.reference | Contains expected outputs for the new Geometry type test cases |
alexey-milovidov
left a comment
There was a problem hiding this comment.
The implementation with a temporary Field is suboptimal.
Change to something like "default implementation for variant".
You can ask @Avogar about it.
Moreover, I want all the implementation to be greatly simplified. Let it accept any dimensional array of points of any type and variants of them.
Just to clarify, "default implementation for variant" means "execute function on each underlying variant subcolumn separately and then combine the results into a single result according to discriminators". There are 2 different things we can do:
|
|
I was under the impression that it exists. If it's not, ok to just look into each subcolumn and pass it for processing here. |
It exists for Dynamic data type only. It has its own specifics, so for Variant we need separate default implementation (but it will be similar). Probably it's a good feature request. |
It sounds like the current implementation should work for now though sub optimal. Let me know if otherwise.
As per @Avogar 's suggestion, if it's going to be slightly more optimal, I can try default implementation for this function - I will follow up with Pavel with any questions.
How much of work would this be? |
|
I'd rather withdraw the flipCoordinates function from the release than accept this implementation. |
Not much. |
It's not good for me. |
Ok, I misunderstood your initial point. I'll avoid using the temporary field. I'll work on simplifying it and work on a more efficient implementation. |
ccafe22 to
35faf18
Compare
f73b113 to
5ae927a
Compare
Avogar
left a comment
There was a problem hiding this comment.
Looks really great! Amazing work! Some small adjustments are remaining
Avogar
left a comment
There was a problem hiding this comment.
Just a few minor comments and we can merge it
Co-authored-by: Pavel Kruglov <[email protected]>
|
test failures not related:
|
…unctions" This reverts commit e9d0862 (PR #90900). The `FunctionVariantAdaptor` feature caused a logical error exception in `arrayRemove` when comparing incompatible Variant types. The `equals` function would return `Nullable(Nothing)` for such comparisons, but `arrayRemove` assumed the result would be `UInt8`, leading to type mismatch in the `if` function's `executeGeneric` method. Fixes #95839 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Implement variant function adaptor. This is a permanent fix for #79634 to support
Geometrytype forflipCoordinatesfunction. An temporary patch for it #93303 was already merged and backported. After this PR is merged, the patch can be removed.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Implement FunctionVariantAdaptor to support variant type in functions
Documentation entry for user-facing changes