@@ -456,11 +456,7 @@ def _polyglot_non_null_filter_context(
456456 select : Any ,
457457 column_nullability_by_table : dict [str , dict [str , InferredNullability ]],
458458) -> NonNullFilterContext | None :
459- select_args : object = getattr (select , "args" , None )
460- if not isinstance (select_args , dict ):
461- return None
462- select_args_dict : dict [str , object ] = cast (dict [str , object ], select_args )
463- where_payload : object = select_args_dict .get (_POLYGLOT_PAYLOAD_WHERE_CLAUSE )
459+ where_payload : object = select .arg (_POLYGLOT_PAYLOAD_WHERE_CLAUSE )
464460 if not isinstance (where_payload , dict ):
465461 return None
466462 predicate : object = cast (dict [str , object ], where_payload ).get (_POLYGLOT_PAYLOAD_THIS )
@@ -616,7 +612,7 @@ def _polyglot_star_output_types(
616612
617613
618614def _polyglot_top_level_ctes (root : Any ) -> tuple [tuple [str , Any , bool ], ...]:
619- with_payload : object = getattr ( root , "args" , {}). get ("with" )
615+ with_payload : object = root . arg ("with" )
620616 raw_ctes : object = (
621617 cast (dict [str , object ], with_payload ).get ("ctes" )
622618 if isinstance (with_payload , dict )
@@ -678,10 +674,10 @@ def _polyglot_set_operation_output_types(
678674 inference_profile : ExpressionInferenceProfile ,
679675 expression_type_resolver : _ExpressionTypeResolver ,
680676) -> dict [str , str ]:
681- if bool (getattr ( operation , "args" , {}). get ("by_name" )):
677+ if bool (operation . arg ("by_name" )):
682678 branch_types : list [dict [str , str ]] = []
683679 for side in ("left" , "right" ):
684- branch : Any = getattr ( operation , "args" , {}). get (side )
680+ branch : Any = operation . arg (side )
685681 if branch is None :
686682 return {}
687683 branch_types .append (
@@ -707,7 +703,7 @@ def _polyglot_set_operation_output_types(
707703 }
708704 branch_slots : list [tuple [tuple [str , str | None ], ...]] = []
709705 for side in ("left" , "right" ):
710- branch : Any = getattr ( operation , "args" , {}). get (side )
706+ branch : Any = operation . arg (side )
711707 if branch is None :
712708 return {}
713709 inferred : tuple [tuple [str , str | None ], ...] = _polyglot_select_output_type_slots (
@@ -751,7 +747,7 @@ def _polyglot_select_output_type_slots(
751747 if str (getattr (select , "kind" , "" )) in _POLYGLOT_SET_OPERATION_KINDS :
752748 branch_slots : list [tuple [tuple [str , str | None ], ...]] = []
753749 for side in ("left" , "right" ):
754- branch : Any = getattr ( select , "args" , {}). get (side )
750+ branch : Any = select . arg (side )
755751 if branch is None :
756752 return ()
757753 slots : tuple [tuple [str , str | None ], ...] = _polyglot_select_output_type_slots (
@@ -764,7 +760,7 @@ def _polyglot_select_output_type_slots(
764760 return ()
765761 branch_slots .append (slots )
766762 left_slots , right_slots = branch_slots
767- if bool (getattr ( select , "args" , {}). get ("by_name" )):
763+ if bool (select . arg ("by_name" )):
768764 right_types : dict [str , str | None ] = dict (right_slots )
769765 return tuple (
770766 (
0 commit comments