1010import ibis .expr .datashape as ds
1111import ibis .expr .datatypes as dt
1212from ibis .common .annotations import attribute
13- from ibis .common .collections import FrozenDict
13+ from ibis .common .collections import FrozenDict , FrozenOrderedDict
1414from ibis .common .exceptions import IbisTypeError , IntegrityError , RelationError
1515from ibis .common .grounds import Concrete
1616from ibis .common .patterns import Between , InstanceOf
@@ -41,7 +41,7 @@ def __coerce__(cls, value):
4141
4242 @property
4343 @abstractmethod
44- def values (self ) -> FrozenDict [str , Value ]:
44+ def values (self ) -> FrozenOrderedDict [str , Value ]:
4545 """A mapping of column names to expressions which build up the relation.
4646
4747 This attribute is heavily used in rewrites as well as during field
@@ -59,13 +59,13 @@ def schema(self) -> Schema:
5959 ...
6060
6161 @property
62- def fields (self ) -> FrozenDict [str , Column ]:
62+ def fields (self ) -> FrozenOrderedDict [str , Column ]:
6363 """A mapping of column names to fields of the relation.
6464
6565 This calculated property shouldn't be overridden in subclasses since it
6666 is mostly used for convenience.
6767 """
68- return FrozenDict ({k : Field (self , k ) for k in self .schema })
68+ return FrozenOrderedDict ({k : Field (self , k ) for k in self .schema })
6969
7070 def to_expr (self ):
7171 from ibis .expr .types import Table
@@ -110,7 +110,7 @@ def _check_integrity(values, allowed_parents):
110110@public
111111class Project (Relation ):
112112 parent : Relation
113- values : FrozenDict [str , NonSortKey [Unaliased [Value ]]]
113+ values : FrozenOrderedDict [str , NonSortKey [Unaliased [Value ]]]
114114
115115 def __init__ (self , parent , values ):
116116 _check_integrity (values .values (), {parent })
@@ -152,7 +152,7 @@ def schema(self):
152152# TODO(kszucs): remove in favor of View
153153@public
154154class SelfReference (Reference ):
155- values = FrozenDict ()
155+ values = FrozenOrderedDict ()
156156
157157
158158@public
@@ -187,7 +187,7 @@ class JoinLink(Node):
187187class JoinChain (Relation ):
188188 first : Reference
189189 rest : VarTuple [JoinLink ]
190- values : FrozenDict [str , Unaliased [Value ]]
190+ values : FrozenOrderedDict [str , Unaliased [Value ]]
191191
192192 def __init__ (self , first , rest , values ):
193193 allowed_parents = {first }
@@ -259,8 +259,8 @@ class Limit(Simple):
259259@public
260260class Aggregate (Relation ):
261261 parent : Relation
262- groups : FrozenDict [str , Unaliased [Column ]]
263- metrics : FrozenDict [str , Unaliased [Scalar ]]
262+ groups : FrozenOrderedDict [str , Unaliased [Column ]]
263+ metrics : FrozenOrderedDict [str , Unaliased [Scalar ]]
264264
265265 def __init__ (self , parent , groups , metrics ):
266266 _check_integrity (groups .values (), {parent })
@@ -273,7 +273,7 @@ def __init__(self, parent, groups, metrics):
273273
274274 @attribute
275275 def values (self ):
276- return FrozenDict ({** self .groups , ** self .metrics })
276+ return FrozenOrderedDict ({** self .groups , ** self .metrics })
277277
278278 @attribute
279279 def schema (self ):
@@ -285,7 +285,7 @@ class Set(Relation):
285285 left : Relation
286286 right : Relation
287287 distinct : bool = False
288- values = FrozenDict ()
288+ values = FrozenOrderedDict ()
289289
290290 def __init__ (self , left , right , ** kwargs ):
291291 # convert to dictionary first, to get key-unordered comparison semantics
@@ -321,7 +321,7 @@ class Difference(Set):
321321@public
322322class PhysicalTable (Relation ):
323323 name : str
324- values = FrozenDict ()
324+ values = FrozenOrderedDict ()
325325
326326
327327@public
@@ -356,7 +356,7 @@ class SQLQueryResult(Relation):
356356 query : str
357357 schema : Schema
358358 source : Any
359- values = FrozenDict ()
359+ values = FrozenOrderedDict ()
360360
361361
362362@public
@@ -378,12 +378,12 @@ class SQLStringView(Relation):
378378 child : Relation
379379 query : str
380380 schema : Schema
381- values = FrozenDict ()
381+ values = FrozenOrderedDict ()
382382
383383
384384@public
385385class DummyTable (Relation ):
386- values : FrozenDict [str , Value ]
386+ values : FrozenOrderedDict [str , Value ]
387387
388388 @attribute
389389 def schema (self ):
0 commit comments