laskoviymishka commented on code in PR #2745:
URL: https://github.com/apache/iceberg-go/pull/2745#discussion_r4727396737


##########
utils.go:
##########
@@ -122,6 +122,27 @@ var lzseed = maphash.MakeSeed()
 
 type literalSet map[any]struct{ orig Literal }
 
+// Using distinct named types keeps byte-identical literals of different
+// Iceberg types from replacing one another in the interface-keyed map.
+// Geo keys also include the logical type because CRS and edge interpolation
+// are part of GeoLiteral.Equals.
+type (
+       binaryLiteralHash  uint64
+       fixedLiteralHash   uint64
+       variantLiteralHash uint64
+       geoLiteralHash     struct {
+               typ  string
+               hash uint64
+       }
+)
+
+func geoSetKey(v GeoLiteral) geoLiteralHash {
+       return geoLiteralHash{
+               typ:  v.Type().String(),

Review Comment:
   Could the geo key use the normalized `CRS()` and `Algorithm()` instead of 
`Type().String()`? `String()` prints the raw `crs` field while [`Equals` 
compares 
`CRS()`](https://github.com/apache/iceberg-go/blob/297e745a3d9b844030514c3af87bc420f1349e63/types.go#L1197-L1213),
 and [schema JSON keeps an explicit 
default](https://github.com/apache/iceberg-go/blob/297e745a3d9b844030514c3af87bc420f1349e63/types.go#L238-L276).
 With a type parsed from `geometry(OGC:CRS84)`, its literal is `Equals` to the 
same bytes under `GeometryType{}`, yet `Contains` returns false and the set 
holds two members; on `main` it's one.
   
   A struct of kind, `CRS()`, `Algorithm()` and the hash matches `Equals` by 
construction. Could the test also pair an explicit and implicit default (one 
member) and two geometry CRSs (two members)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to