Skip to content

Commit

Permalink
Delegate to sphgeom to decode concatenated UnionRegions.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Dec 9, 2024
1 parent d9c885b commit fd56d7f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions python/lsst/daf/butler/ddl.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

import astropy.time
import sqlalchemy
from lsst.sphgeom import Region, UnionRegion
from lsst.sphgeom import Region
from lsst.utils.iteration import ensure_iterable
from sqlalchemy.dialects.postgresql import UUID

Expand Down Expand Up @@ -181,14 +181,7 @@ def process_bind_param(self, value: Region | None, dialect: sqlalchemy.engine.Di
def process_result_value(self, value: str | None, dialect: sqlalchemy.engine.Dialect) -> Region | None:
if value is None:
return None
regions = [
# For some reason super() doesn't work here!
Region.decode(Base64Bytes.process_result_value(self, union_member, dialect))
for union_member in value.split(":")
]
if len(regions) == 1:
return regions[0]
return UnionRegion(*regions)
return Region.decodeBase64(value)

@property
def python_type(self) -> type[Region]:
Expand Down

0 comments on commit fd56d7f

Please sign in to comment.