@@ -237,12 +237,19 @@ def as_bound(self) -> type[BoundReference]:
237237 return BoundReference
238238
239239
240- class And (BooleanExpression ):
240+ class And (IcebergBaseModel , BooleanExpression ):
241241 """AND operation expression - logical conjunction."""
242242
243+ model_config = ConfigDict (arbitrary_types_allowed = True )
244+
245+ type : TypingLiteral ["and" ] = Field (default = "and" , alias = "type" )
243246 left : BooleanExpression
244247 right : BooleanExpression
245248
249+ def __init__ (self , left : BooleanExpression , right : BooleanExpression , * rest : BooleanExpression ) -> None :
250+ if isinstance (self , And ) and not hasattr (self , "left" ) and not hasattr (self , "right" ):
251+ super ().__init__ (left = left , right = right )
252+
246253 def __new__ (cls , left : BooleanExpression , right : BooleanExpression , * rest : BooleanExpression ) -> BooleanExpression : # type: ignore
247254 if rest :
248255 return _build_balanced_tree (And , (left , right , * rest ))
@@ -254,6 +261,7 @@ def __new__(cls, left: BooleanExpression, right: BooleanExpression, *rest: Boole
254261 return left
255262 else :
256263 obj = super ().__new__ (cls )
264+ obj .__pydantic_fields_set__ = set ()
257265 obj .left = left
258266 obj .right = right
259267 return obj
@@ -264,7 +272,7 @@ def __eq__(self, other: Any) -> bool:
264272
265273 def __str__ (self ) -> str :
266274 """Return the string representation of the And class."""
267- return f"And( left={ str (self .left )} , right={ str (self .right )} )"
275+ return f"{ str ( self . __class__ . __name__ ) } ( left={ repr (self .left )} , right={ repr (self .right )} )"
268276
269277 def __repr__ (self ) -> str :
270278 """Return the string representation of the And class."""
0 commit comments