+
    JV-jß}  ã            
       ób  € ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RIH
t
Ht  ^ RIHt ]P                  P                  tR&R ltR t]P                  P'                  RRR.4      R	 4       t]P                  P'                  R
]P*                  ! R4      R^34      R 4       tR t]P                  P'                  RRR.4      R 4       tR tR t]P                  P'                  RRR.4      R 4       tR tR t]P                  P'                  RRR.4      R 4       tR t]P                  P'                  RRR.4      R 4       t ]P                  PB                  R 4       t"]P                  PB                  R 4       t#]P                  P'                  R]PH                  ! ]PJ                  ! R4      ^4      ]PH                  ! ]PJ                  ! R4      ]PJ                  ! R4      4      ]PJ                  ! R4      ^28„  .4      R 4       t&R t'R t(R  t)R! t*R" t+R# t,R$ t-R% t.R#   ] d    Rt ELi ; i)'é    N)Útobytes)ÚArrowInvalidÚArrowNotImplementedErrorc                 óF   € ^ RI Hp V! \        P                  ! 4       V 4      # )r   )Ú_get_udf_context)Úpyarrow._computer   ÚpaÚdefault_memory_pool)Úbatch_lengthr   s   & Úm/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/pyarrow/tests/test_substrait.pyÚmock_udf_contextr   &   s   € Ý1ÙœB×2Ò2Ó4°lÓCÐCó    c                 ó  € \         P                  P                  \        V 4      V4      p\        P
                  P                  W2P                  R 7      ;_uu_ 4       pVP                  V4       RRR4       V#   + '       g   i     T# ; i))ÚschemaN)	ÚosÚpathÚjoinÚstrr	   ÚipcÚRecordBatchFileWriterr   Úwrite_table)ÚtmpdirÚ	file_nameÚtabler   Úwriters   &&&  r   Ú_write_dummy_data_to_diskr   +   s`   € Ü�7‰7�<‰<œ˜F› YÓ/€DÜ	�‰×	%Ñ	% d·<±<Ð	%×	@Ô	@ÀFØ×Ñ˜5Ô!÷ 
Aà€K÷ 
AÖ	@à€Kús   ÁA8Á8B		Úuse_threadsTFc                 ó¶  € R pRp\         P                  ! . RO.R.R7      p\        WV4      p\        VP	                  R\
        P                  ! V4      P                  4       4      4      p\         P                  P                  V4      p\        P                  ! WqR7      pVP                  4       p	VP                  R.4      V	P                  R.4      8X  g   Q hR# )ax  
    {
        "version": { "major": 9999 },
        "relations": [
        {"rel": {
            "read": {
            "base_schema": {
                "struct": {
                "types": [
                            {"i64": {}}
                        ]
                },
                "names": [
                        "foo"
                        ]
            },
            "local_files": {
                "items": [
                {
                    "uri_file": "FILENAME_PLACEHOLDER",
                    "arrow": {}
                }
                ]
            }
            }
        }}
        ]
    }
    zread_data.arrowÚfoo©ÚnamesÚFILENAME_PLACEHOLDER©r   N©é   é   é   é   é   ©r	   r   r   r   ÚreplaceÚpathlibÚPathÚas_uriÚ
_substraitÚ_parse_json_planÚ	substraitÚ	run_queryÚread_allÚselect©
r   r   Úsubstrait_queryr   r   r   ÚqueryÚbufÚreaderÚres_tbs
   &&        r   Útest_run_serialized_queryr;   2   sµ   € ð€Oð< "€IÜ�HŠH’oÐ&¨u¨gÔ6€EÜ$ V¸Ó>€DÜ�O×+Ñ+Ø¤§¢¨TÓ 2× 9Ñ 9Ó ;ó=ó >€Eô �-‰-×
(Ñ
(¨Ó
/€Cä× Ò  Ô>€FØ�_‰_Ó€Fà�<‰<˜˜Ó  F§M¡M°5°'Ó$:Ô:Ð:Ò:r   r7   s   buffers   bytesc                 óÔ  € \        V\        P                  \        34      '       gU   R \	        V4       R2p\
        P                  ! \        VR7      ;_uu_ 4        \        P                  ! V4       RRR4       R# Rp\
        P                  ! \        VR7      ;_uu_ 4        \        P                  ! V4       RRR4       R#   + '       g   i     R# ; i  + '       g   i     R# ; i)z)Expected 'pyarrow.Buffer' or bytes, got 'Ú'©ÚmatchNz1ParseFromZeroCopyStream failed for substrait.Plan)Ú
isinstancer	   ÚBufferÚbytesÚtypeÚpytestÚraisesÚ	TypeErrorr1   r2   r   )r   r7   Úmsgs   && r   Útest_run_query_input_typesrH   `   s™   € ô �eœbŸi™i¬Ð/×0Ò0Ø9¼$¸u»+¸ÀaÐHˆÜ�]Š]œ9¨C×0Ö0Ü×Ò Ô&÷ 1áð >€CÜ	�Š”|¨3×	/Ö	/Ü×Ò˜EÔ"÷ 
0Ñ	/÷ 1Ö0áú÷ 
0×	/Ð	/ús   ÁCÂ!CÃC	ÃC'	c                  ó  € R p \         P                  P                  \        V 4      4      pRp\        P
                  ! \        VR7      ;_uu_ 4        \        P                  ! V4       RRR4       R#   + '       g   i     R# ; i)z2
    {
        "relations": [
        ]
    }
    zPlan has no relationsr>   N)	r	   r/   r0   r   rD   rE   r   r1   r2   )r7   r8   Úexec_messages      r   Útest_invalid_planrK   p   sV   € ð€Eô �-‰-×
(Ñ
(¬°«Ó
8€CØ*€LÜ	�Š”|¨<×	8Ö	8Ü×Ò˜CÔ ÷ 
9×	8×	8Ò	8ús   ÁA2Á2B	c                 óÈ  € R pRp\         P                  ! . RO.R.R7      p\        WV4      p\        VP	                  R\
        P                  ! V4      P                  4       4      4      p\         P                  P                  \        V4      4      p\        P                  ! WqR7      pVP                  4       p	VP                  R.4      V	P                  R.4      8X  g   Q hR# )aÛ  
    {
        "version": { "major": 9999 },
        "relations": [
        {"rel": {
            "read": {
            "base_schema": {
                "struct": {
                "types": [
                            {"i64": {}}
                        ]
                },
                "names": [
                        "bar"
                        ]
            },
            "local_files": {
                "items": [
                {
                    "uri_file": "FILENAME_PLACEHOLDER",
                    "arrow": {},
                    "metadata" : {
                      "created_by" : {},
                    }
                }
                ]
            }
            }
        }}
        ]
    }
    zbinary_json_data.arrowÚbarr    r"   r#   Nr$   r*   r5   s
   &&        r   Ú(test_binary_conversion_with_json_optionsrN   }   s¸   € ð€OðB )€IÜ�HŠH’oÐ&¨u¨gÔ6€EÜ$ V¸Ó>€DÜ�O×+Ñ+Ø¤§¢¨TÓ 2× 9Ñ 9Ó ;ó=ó >€Eä
�-‰-×
(Ñ
(¬°«Ó
8€Cä× Ò  Ô>€FØ�_‰_Ó€Fà�<‰<˜˜Ó  F§M¡M°5°'Ó$:Ô:Ð:Ò:r   c                 óZ   € V R V 2pV  F  pVP                  V4      '       g   K   R# 	  R# )Ú#TF)Úendswith)ÚfnsÚext_fileÚfn_nameÚsuffixÚfns   &&&  r   Úhas_functionrW   ¯   s3   € Øˆz˜˜7˜)Ð$€FÛˆØ�;‰;�v×ÔÚñ ñ r   c                  ó–   € \         P                  P                  4       p \        V R R4      '       g   Q h\        V R R4      '       g   Q hR# )zfunctions_arithmetic.yamlÚaddÚsumN)r	   r/   Úget_supported_functionsrW   )Úsupported_functionss    r   Útest_get_supported_functionsr]   ·   sU   € ÜŸ-™-×?Ñ?ÓAÐô Ð+Ø3°U÷<ò <ð <ð <äÐ+Ø3°U÷<ò <ð <ò <r   c                 óî  aaa€ \         P                  P                  R . RO/4      o\         P                  P                  R . RO/4      o\         P                  ! \         P                  ! R \         P
                  ! 4       4      .4      oVVV3R lpRp\         P                  P                  \        V4      4      p\         P                  P                  W1V R7      pVP                  4       pVS8X  g   Q hR# )Úxc                 ó’   <€ V '       g   \        R 4      hV ^ ,          R8X  d   VS8X  g   Q hS# V ^,          R8X  d   S# \        R4      h)úNo names providedÚt1Út2úUnrecognized table name©Ú	Exception)r!   r   Úschema_1Útest_table_1Útest_table_2s   &&€€€r   Útable_providerÚ(test_named_table.<locals>.table_providerÇ   sP   ø€ ßÜÐ/Ó0Ð0Ø�1�X˜ÔØ˜XÔ%Ð%Ð%ØÐØ�1�X˜ÔØÐäÐ5Ó6Ð6r   að  
    {
        "version": { "major": 9999 },
        "relations": [
        {"rel": {
            "read": {
            "base_schema": {
                "struct": {
                "types": [
                            {"i64": {}}
                        ]
                },
                "names": [
                        "x"
                        ]
            },
            "namedTable": {
                    "names": ["t1"]
            }
            }
        }}
        ]
    }
    ©rj   r   N©r%   r&   r'   )r(   r)   é   )r	   ÚTableÚfrom_pydictr   ÚfieldÚint64r/   r0   r   r1   r2   r3   )	r   rj   r6   r8   r9   r:   rg   rh   ri   s	   &     @@@r   Útest_named_tablers   Á   s·   ú€ ä—8‘8×'Ñ'¨ªiÐ(8Ó9€LÜ—8‘8×'Ñ'¨ªiÐ(8Ó9€LÜ�yŠyœ"Ÿ(š( 3¬¯ª«
Ó3Ð4Ó5€H÷	7ð€Oô2 �-‰-×
(Ñ
(¬°Ó)AÓ
B€CÜ�\‰\×#Ñ#Ø¸ð $ó E€Fà�_‰_Ó€FØ�\Ô!Ð!Ò!r   c                  ób  a€ \         P                  P                  R . RO/4      oV3R lp Rp\         P                  P	                  \        V4      4      pRp\        P                  ! \        VR7      ;_uu_ 4        \        P                  ! W R7       RRR4       R#   + '       g   i     R# ; i)r_   c                 ó`   <€ V '       g   \        R 4      hV ^ ,          R8X  d   S# \        R4      h©ra   rb   rd   re   ©r!   Ú_rh   s   &&€r   rj   Ú;test_named_table_invalid_table_name.<locals>.table_providerõ   ó0   ø€ ßÜÐ/Ó0Ð0Ø�1�X˜ÔØÐäÐ5Ó6Ð6r   að  
    {
        "version": { "major": 9999 },
        "relations": [
        {"rel": {
            "read": {
            "base_schema": {
                "struct": {
                "types": [
                            {"i64": {}}
                        ]
                },
                "names": [
                        "x"
                        ]
            },
            "namedTable": {
                    "names": ["t3"]
            }
            }
        }}
        ]
    }
    zInvalid NamedTable Sourcer>   ©rj   Nrm   )r	   ro   rp   r/   r0   r   rD   rE   r   r1   r2   )rj   r6   r8   rJ   rh   s       @r   Ú#test_named_table_invalid_table_namer|   ò   sv   ø€ Ü—8‘8×'Ñ'¨ªiÐ(8Ó9€Lõ7ð€Oô2 �-‰-×
(Ñ
(¬°Ó)AÓ
B€CØ.€LÜ	�Š”|¨<×	8Ö	8Ü×Ò˜CÕ?÷ 
9×	8×	8Ò	8ús   Á;BÂB.	c                  óx  a€ \         P                  P                  R . RO/4      oV3R lp Rp\        V4      p\         P                  P                  \        V4      4      pRp\        P                  ! \        VR7      ;_uu_ 4        \        P                  ! W0R7       RRR4       R#   + '       g   i     R# ; i)r_   c                 ó`   <€ V '       g   \        R 4      hV ^ ,          R8X  d   S# \        R4      hrv   re   rw   s   &&€r   rj   Ú4test_named_table_empty_names.<locals>.table_provider  rz   r   aì  
    {
        "version": { "major": 9999 },
        "relations": [
        {"rel": {
            "read": {
            "base_schema": {
                "struct": {
                "types": [
                            {"i64": {}}
                        ]
                },
                "names": [
                        "x"
                        ]
            },
            "namedTable": {
                    "names": []
            }
            }
        }}
        ]
    }
    z!names for NamedTable not providedr>   r{   Nrm   )r	   ro   rp   r   r/   r0   rD   rE   r   r1   r2   )rj   r6   r7   r8   rJ   rh   s        @r   Útest_named_table_empty_namesr€     s   ø€ Ü—8‘8×'Ñ'¨ªiÐ(8Ó9€Lõ7ð€Oô0 �OÓ$€EÜ
�-‰-×
(Ñ
(¬°«Ó
8€CØ6€LÜ	�Š”|¨<×	8Ö	8Ü×Ò˜CÕ?÷ 
9×	8×	8Ò	8ús   ÂB(Â(B9	c           	      ój  a
€ \         P                  P                  R . RO/4      o
V
3R lpRp\         P                  P	                  V4      p\         P
                  P                  WBVR7      pVP                  4       pV w  rxS
P                  ^RV! \        ^
4      S
R ,          4      4      p	Wi8X  g   Q hR# )r_   c                 ó`   <€ V '       g   \        R 4      hV ^ ,          R8X  d   S# \        R4      hrv   re   ©r!   rx   Ú
test_tables   &&€r   rj   Ú.test_udf_via_substrait.<locals>.table_providerJ  ó0   ø€ ßÜÐ/Ó0Ð0Ø�1�X˜ÔØÐäÐ5Ó6Ð6r   s	  
    {
  "extensionUris": [
    {
      "extensionUriAnchor": 1
    },
    {
      "extensionUriAnchor": 2,
      "uri": "urn:arrow:substrait_simple_extension_function"
    }
  ],
  "extensions": [
    {
      "extensionFunction": {
        "extensionUriReference": 2,
        "functionAnchor": 1,
        "name": "y=x+1"
      }
    }
  ],
  "relations": [
    {
      "root": {
        "input": {
          "project": {
            "common": {
              "emit": {
                "outputMapping": [
                  1,
                  2,
                ]
              }
            },
            "input": {
              "read": {
                "baseSchema": {
                  "names": [
                    "t",
                  ],
                  "struct": {
                    "types": [
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                    ],
                    "nullability": "NULLABILITY_REQUIRED"
                  }
                },
                "namedTable": {
                  "names": [
                    "t1"
                  ]
                }
              }
            },
            "expressions": [
              {
                "selection": {
                  "directReference": {
                    "structField": {}
                  },
                  "rootReference": {}
                }
              },
              {
                "scalarFunction": {
                  "functionReference": 1,
                  "outputType": {
                    "i64": {
                      "nullability": "NULLABILITY_NULLABLE"
                    }
                  },
                  "arguments": [
                    {
                      "value": {
                        "selection": {
                          "directReference": {
                            "structField": {}
                          },
                          "rootReference": {}
                        }
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        "names": [
          "x",
          "y",
        ]
      }
    }
  ]
}
    rl   ÚyNrm   )
r	   ro   rp   r/   r0   r1   r2   r3   Ú
add_columnr   )Úunary_func_fixturer   rj   r6   r8   r9   r:   ÚfunctionÚnameÚexpected_tbr„   s   &&        @r   Útest_udf_via_substraitr�   F  s§   ø€ ä—‘×%Ñ% sªIÐ&6Ó7€Jõ7ðc€OôJ �-‰-×
(Ñ
(¨Ó
9€CÜ�\‰\×#Ñ#Ø¸ð $ó E€Fà�_‰_Ó€Fà'�N€HØ×'Ñ'¨¨3±Ü˜Ó˜j¨�oó1/ó 0€KàÔ Ð Ò r   c                  ó¤  a€ \         P                  P                  R . RO/4      oV3R lp Rp\         P                  P	                  V4      p\
        P                  ! \         P                  4      ;_uu_ 4       p\         P                  P                  W R7       RRR4       R\        XP                  4      9   g   Q hR#   + '       g   i     L.; i)r_   c                 ó`   <€ V '       g   \        R 4      hV ^ ,          R8X  d   S# \        R4      hrv   re   rƒ   s   &&€r   rj   Ú=test_udf_via_substrait_wrong_udf_name.<locals>.table_providerÅ  r†   r   s	  
    {
  "extensionUris": [
    {
      "extensionUriAnchor": 1
    },
    {
      "extensionUriAnchor": 2,
      "uri": "urn:arrow:substrait_simple_extension_function"
    }
  ],
  "extensions": [
    {
      "extensionFunction": {
        "extensionUriReference": 2,
        "functionAnchor": 1,
        "name": "wrong_udf_name"
      }
    }
  ],
  "relations": [
    {
      "root": {
        "input": {
          "project": {
            "common": {
              "emit": {
                "outputMapping": [
                  1,
                  2,
                ]
              }
            },
            "input": {
              "read": {
                "baseSchema": {
                  "names": [
                    "t",
                  ],
                  "struct": {
                    "types": [
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                    ],
                    "nullability": "NULLABILITY_REQUIRED"
                  }
                },
                "namedTable": {
                  "names": [
                    "t1"
                  ]
                }
              }
            },
            "expressions": [
              {
                "selection": {
                  "directReference": {
                    "structField": {}
                  },
                  "rootReference": {}
                }
              },
              {
                "scalarFunction": {
                  "functionReference": 1,
                  "outputType": {
                    "i64": {
                      "nullability": "NULLABILITY_NULLABLE"
                    }
                  },
                  "arguments": [
                    {
                      "value": {
                        "selection": {
                          "directReference": {
                            "structField": {}
                          },
                          "rootReference": {}
                        }
                      }
                    }
                  ]
                }
              }
            ]
          }
        },
        "names": [
          "x",
          "y",
        ]
      }
    }
  ]
}
    r{   NzNo function registeredrm   )r	   ro   rp   r/   r0   rD   rE   ÚArrowKeyErrorr1   r2   r   Úvalue)rj   r6   r8   Úexcinfor„   s       @r   Ú%test_udf_via_substrait_wrong_udf_namer”   Â  s‘   ø€ Ü—‘×%Ñ% sªIÐ&6Ó7€Jõ7ðc€OôJ �-‰-×
(Ñ
(¨Ó
9€CÜ	�Š”r×'Ñ'×	(Ô	(¨GÜ
�‰×Ñ˜sÐÔB÷ 
)à#¤s¨7¯=©=Ó'9Ô9Ð9Ò9÷ 
)×	(ús   Á8!B?Â?C	c                 óf  a€ \         P                  P                  R . RO/4      oV3R lpRp\         P                  P	                  \        V4      4      p\         P                  P                  W1V R7      pVP                  4       p\         P                  P                  R. RO/4      pWV8X  g   Q hR# )r_   c                 ó   <€ S# ©N© )r!   r   Úin_tables   &&€r   rj   Ú/test_output_field_names.<locals>.table_provider<  s   ø€ Øˆr   aø  
    {
      "version": { "major": 9999 },
      "relations": [
        {
          "root": {
            "input": {
              "read": {
                "base_schema": {
                  "struct": {
                    "types": [{"i64": {}}]
                  },
                  "names": ["x"]
                },
                "namedTable": {
                  "names": ["t1"]
                }
              }
            },
            "names": ["out"]
          }
        }
      ]
    }
    rl   ÚoutNrm   )	r	   ro   rp   r/   r0   r   r1   r2   r3   )r   rj   r6   r8   r9   r:   Úexpectedr™   s   &      @r   Útest_output_field_namesr�   8  s“   ø€ ä�x‰x×#Ñ# Sª)Ð$4Ó5€Hõð€Oô4 �-‰-×
(Ñ
(¬°Ó)AÓ
B€CÜ�\‰\×#Ñ#Ø¸ð $ó E€Fà�_‰_Ó€Fä�x‰x×#Ñ# UªIÐ$6Ó7€HàÔÐÒr   c           	      ól  a€ \         P                  P                  R . ROR. ROR. RO/4      oV3R lpRp\         P                  P	                  V4      p\         P
                  P                  W1RR7      pVP                  4       p\         P                  P                  R ^^.RRR	./4      pWV8X  g   Q hR
# )ÚkÚv1Úv2c                 ó   <€ S# r—   r˜   rƒ   s   &&€r   rj   Ú7test_scalar_aggregate_udf_basic.<locals>.table_providerk  ó	   ø€ ØÐr   s  
{
  "extensionUris": [
    {
      "extensionUriAnchor": 1,
      "uri": "urn:arrow:substrait_simple_extension_function"
    },
  ],
  "extensions": [
    {
      "extensionFunction": {
        "extensionUriReference": 1,
        "functionAnchor": 1,
        "name": "sum_mean"
      }
    }
  ],
  "relations": [
    {
      "root": {
        "input": {
          "extensionSingle": {
            "common": {
              "emit": {
                "outputMapping": [
                  0,
                  1
                ]
              }
            },
            "input": {
              "read": {
                "baseSchema": {
                  "names": [
                    "k",
                    "v1",
                    "v2",
                  ],
                  "struct": {
                    "types": [
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "i64": {
                          "nullability": "NULLABILITY_NULLABLE"
                        }
                      },
                      {
                        "fp64": {
                          "nullability": "NULLABILITY_NULLABLE"
                        }
                      }
                    ],
                    "nullability": "NULLABILITY_REQUIRED"
                  }
                },
                "namedTable": {
                  "names": ["t1"]
                }
              }
            },
            "detail": {
              "@type": "/arrow.substrait_ext.SegmentedAggregateRel",
              "segmentKeys": [
                {
                  "directReference": {
                    "structField": {}
                  },
                  "rootReference": {}
                }
              ],
              "measures": [
                {
                  "measure": {
                    "functionReference": 1,
                    "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
                    "outputType": {
                      "fp64": {
                        "nullability": "NULLABILITY_NULLABLE"
                      }
                    },
                    "arguments": [
                      {
                        "value": {
                          "selection": {
                            "directReference": {
                              "structField": {
                                "field": 1
                              }
                            },
                            "rootReference": {}
                          }
                        }
                      },
                      {
                        "value": {
                          "selection": {
                            "directReference": {
                              "structField": {
                                "field": 2
                              }
                            },
                            "rootReference": {}
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        },
        "names": [
          "k",
          "v_avg"
        ]
      }
    }
  ],
}
Frl   Úv_avgg      @g      @N©r%   r%   r&   r&   )r%   r&   r'   r(   )ç      ð?r§   r§   r§   ©r	   ro   rp   r/   r0   r1   r2   r3   ©Úvarargs_agg_func_fixturerj   r6   r8   r9   r:   rŒ   r„   s   &      @r   Útest_scalar_aggregate_udf_basicr«   c  s´   ø€ ô —‘×%Ñ%Ø	Šl˜D¢,Ø	Ò#ð	%ó€Jõ
ð|€Oôz �-‰-×
(Ñ
(¨Ó
9€CÜ�\‰\×#Ñ#Ø¸ð $ó ?€Fà�_‰_Ó€Fä—(‘(×&Ñ&Øˆa�ˆVØ�#�s�ð(ó €Kð
 Ô Ð Ò r   c                 ó|  a€ \         P                  P                  R . R
OR. ROR. ROR. RO/4      oV3R lpRp\         P                  P	                  V4      p\         P
                  P                  W1RR7      pVP                  4       p\         P                  P                  R . ROR. ROR. RO/4      pWV8X  g   Q hR	# )ÚtrŸ   r    r¡   c                 ó   <€ S# r—   r˜   rƒ   s   &&€r   rj   Ú5test_hash_aggregate_udf_basic.<locals>.table_provider  r¤   r   s  
{
  "extensionUris": [
    {
      "extensionUriAnchor": 1,
      "uri": "urn:arrow:substrait_simple_extension_function"
    },
  ],
  "extensions": [
    {
      "extensionFunction": {
        "extensionUriReference": 1,
        "functionAnchor": 1,
        "name": "sum_mean"
      }
    }
  ],
  "relations": [
    {
      "root": {
        "input": {
          "extensionSingle": {
            "common": {
              "emit": {
                "outputMapping": [
                  0,
                  1,
                  2
                ]
              }
            },
            "input": {
              "read": {
                "baseSchema": {
                  "names": [
                    "t",
                    "k",
                    "v1",
                    "v2",
                  ],
                  "struct": {
                    "types": [
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "i64": {
                          "nullability": "NULLABILITY_NULLABLE"
                        }
                      },
                      {
                        "fp64": {
                          "nullability": "NULLABILITY_NULLABLE"
                        }
                      }
                    ],
                    "nullability": "NULLABILITY_REQUIRED"
                  }
                },
                "namedTable": {
                  "names": ["t1"]
                }
              }
            },
            "detail": {
              "@type": "/arrow.substrait_ext.SegmentedAggregateRel",
              "groupingKeys": [
                {
                  "directReference": {
                    "structField": {
                      "field": 1
                    }
                  },
                  "rootReference": {}
                }
              ],
              "segmentKeys": [
                {
                  "directReference": {
                    "structField": {}
                  },
                  "rootReference": {}
                }
              ],
              "measures": [
                {
                  "measure": {
                    "functionReference": 1,
                    "phase": "AGGREGATION_PHASE_INITIAL_TO_RESULT",
                    "outputType": {
                      "fp64": {
                        "nullability": "NULLABILITY_NULLABLE"
                      }
                    },
                    "arguments": [
                      {
                        "value": {
                          "selection": {
                            "directReference": {
                              "structField": {
                                "field": 2
                              }
                            },
                            "rootReference": {}
                          }
                        }
                      },
                      {
                        "value": {
                          "selection": {
                            "directReference": {
                              "structField": {
                                "field": 3
                              }
                            },
                            "rootReference": {}
                          }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        },
        "names": [
          "t",
          "k",
          "v_avg"
        ]
      }
    }
  ],
}
Frl   r¥   N)r%   r%   r%   r%   r&   r&   r&   r&   )r%   r   r   r%   r   r%   r   r%   )r%   r&   r'   r(   r)   rn   é   é   )r§   r§   r§   r§   g       @g      @g      @g      @r¦   )r%   r   r   r%   )ç      @r²   g      "@g      &@r¨   r©   s   &      @r   Útest_hash_aggregate_udf_basicr³   ø  s»   ø€ ô —‘×%Ñ%Ø	Ò&Ø	Ò&Ø	Ò'Ø	Ò7ð	9ó€JõðN€Oô^ �-‰-×
(Ñ
(¨Ó
9€CÜ�\‰\×#Ñ#Ø¸ð $ó ?€Fà�_‰_Ó€Fä—(‘(×&Ñ&ØŠ\ØŠ\ØÒ&ð(ó €Kð Ô Ð Ò r   Úexprr_   r‡   c                 óÜ  € \         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      p\         P                  P                  V .R.V4      p\         P                  P                  V4      pWP                  8X  g   Q h\        VP                  4      ^8X  g   Q hRVP                  9   g   Q hR# )r_   r‡   Ú	test_exprN)	r	   r   rq   Úint32r1   Úserialize_expressionsÚdeserialize_expressionsÚlenÚexpressions)r´   r   r8   Úreturneds   &   r   Útest_serializing_expressionsr½   £  s®   € ô �YŠYÜ
�Š�”b—h’h“jÓ!Ü
�Š�”b—h’h“jÓ!ðó €Fô
 �,‰,×
,Ñ
,¨d¨V°k°]ÀFÓ
K€CÜ�|‰|×3Ñ3°CÓ8€HØ—_‘_Ô$Ð$Ð$Üˆx×#Ñ#Ó$¨Ô)Ð)Ð)Ø˜(×.Ñ.Ô.Ð.Ò.r   c                  ó‚  a€ R \         P                  ! R4      ^ 3R\         P                  ! R4      ^ 3R\         P                  ! R4      ^ 3R\         P                  ! 4       ^ 3R\         P                  ! 4       R3R	\         P
                  ! 4       R
3/p \         P                  ! V P                  4        UUUu. uF  w  pw  r#\         P                  ! W4      NK   	  uppp4      oV3R lpV P                  4        F<  w  pw  r%V! \        P                  ! V4      \         P                  ! WRR7      8H  4       K>  	  R# u upppi )Útime_secondsÚsÚtime_millisÚmsÚ
time_nanosÚnsÚdate_millisÚlarge_stringÚtest_stringÚlarge_binarys   test_stringc                 ó²   <€ \         P                  P                  V .R .S4      p\         P                  P                  V4      pSVP                  8X  g   Q hR# ©r¶   N)r	   r1   r¸   r¹   r   )r´   r8   r¼   r   s   &  €r   Úcheck_round_tripÚ3test_arrow_specific_types.<locals>.check_round_tripÀ  sE   ø€ Ü�l‰l×0Ñ0°$°¸+¸ÈÓOˆÜ—<‘<×7Ñ7¸Ó<ˆØ˜Ÿ™Ô(Ð(Ò(r   )rC   N)r	   Útime32Útime64Údate64rÆ   rÈ   r   Úitemsrq   ÚpcÚscalar)Úfieldsr‹   Útyprx   rË   Úvalr   s         @r   Útest_arrow_specific_typesrÖ   µ  sè   ø€ àœŸš 3›¨Ð+ØœŸ	š	 $›¨Ð+Ø”r—y’y “¨Ð*ØœŸ	š	› QÐ'ØœŸšÓ*¨MÐ:ØœŸšÓ*¨NÐ;ð€Fô �YŠYÀ&Ç,Á,Ä.ÕQÁ.±°±h°sœŸš Ö+Á.ÓQÓR€Fõ)ð
 #ŸL™LžNÑˆ‰jˆsÙœŸš $›¬2¯9ª9°SÔ+CÑCÖDó +ùô Rs   Â5$D:c                  óÂ  aa€ \         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      \         P                  ! R\         P
                  ! \         P                  ! 4       \         P                  ! 4       4      4      \         P                  ! R\         P                  ! \         P                  ! 4       \         P                  ! 4       4      4      .4      o\         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      oVV3R lp S F  pV ! V4       K  	  R# )Úbinary_viewÚstring_viewÚ
dictionaryÚreec                 ó  <€ \         P                  ! \         P                  ! V P                  4      4      p\        P
                  P                  V.R .S4      p\        P
                  P                  V4      pSVP                  8X  g   Q hR# rÊ   )	rÑ   Úis_nullrq   r‹   r	   r1   r¸   r¹   r   )rq   r´   r8   r¼   Ú
alt_schemar   s   &   €€r   Úcheck_one_wayÚ/test_arrow_one_way_types.<locals>.check_one_wayÛ  s`   ø€ Ü�zŠzœ"Ÿ(š( 5§:¡:Ó.Ó/ˆÜ�l‰l×0Ñ0°$°¸+¸ÈÓOˆÜ—<‘<×7Ñ7¸Ó<ˆØ˜XŸ_™_Ô,Ð,Ò,r   N)
r	   r   rq   rØ   rÙ   rÚ   r·   ÚstringÚrun_end_encodedÚbinary)rß   rq   rÞ   r   s     @@r   Útest_arrow_one_way_typesrä   É  s
  ù€ Ü�YŠYä�HŠH�]¤B§N¢NÓ$4Ó5Ü�HŠH�]¤B§N¢NÓ$4Ó5Ü�HŠH�\¤2§=¢=´·²³¼R¿YºY»[Ó#IÓJÜ�HŠH�UœB×.Ò.¬r¯xªx«z¼2¿9º9»;ÓGÓHð		
ó€Fô —’ä�HŠH�]¤B§I¢I£KÓ0Ü�HŠH�]¤B§I¢I£KÓ0Ü�HŠH�\¤2§9¢9£;Ó/Ü�HŠH�UœBŸIšI›KÓ(ð		
ó€Jö-ó ˆÙ�eÖó r   c                  ór  € \         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      p \        P
                  ! \        P                  ! R 4      ^4      p\        P
                  ! \        P                  ! R4      ^4      p\        P                  ! \        4      ;_uu_ 4       p\         P                  P                  V.. V 4       RRR4       R\        XP                  4      9   g   Q h\        P                  ! \        4      ;_uu_ 4       p\         P                  P                  V.RR.V 4       RRR4       R\        VP                  4      9   g   Q h\        P                  ! \        4      ;_uu_ 4       p\         P                  P                  V.R.V 4       RRR4       R\        VP                  4      9   g   Q hR#   + '       g   i     EL; i  + '       g   i     L¬; i  + '       g   i     LU; i)	r_   r‡   ÚzNzneed to have the same lengthr   rM   r´   zNo match for FieldRef)r	   r   rq   r·   rÑ   ÚequalrD   rE   Ú
ValueErrorr1   r¸   r   r’   )r   r´   Úbad_exprr“   s       r   Útest_invalid_expression_ser_desrê   å  sb  € Ü�YŠYÜ
�Š�”b—h’h“jÓ!Ü
�Š�”b—h’h“jÓ!ðó €Fô �8Š8”B—H’H˜S“M 1Ó%€DÜ�xŠxœŸš › qÓ)€Hä	�Š”z×	"Ô	" gÜ
�‰×*Ñ*¨D¨6°2°vÔ>÷ 
#à)¬S°·±Ó-?Ô?Ð?Ð?Ü	�Š”z×	"Ô	" gÜ
�‰×*Ñ*¨D¨6°E¸5°>À6ÔJ÷ 
#à)¬S°·±Ó-?Ô?Ð?Ð?ä	�Š”z×	"Ô	" gÜ
�‰×*Ñ*¨H¨:¸°xÀÔH÷ 
#à"¤c¨'¯-©-Ó&8Ô8Ð8Ò8÷ 
#×	"Ð	"ú÷ 
#×	"ú÷ 
#×	"ús$   Ã!#G?Å
%HÆ5$H&Ç?H	ÈH#	È&H6	c                  ó*  € \         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      p \        P
                  ! \        P                  ! R 4      ^4      \        P
                  ! \        P                  ! R 4      \        P                  ! R4      4      .p\         P                  P                  VRR.V 4      p\         P                  P                  V4      pWP                  8X  g   Q h\        VP                  4      ^8X  g   Q h\        P
                  ! \        P                  ! ^ 4      ^4      \        P
                  ! \        P                  ! ^ 4      \        P                  ! ^4      4      .p\        VP                  R,          4      \        V^ ,          4      8X  g   Q h\        VP                  R,          4      \        V^,          4      8X  g   Q hR# )r_   r‡   ÚfirstÚsecondN)r	   r   rq   r·   rÑ   rç   r1   r¸   r¹   rº   r»   r   )r   Úexprsr8   r¼   Ú
norm_exprss        r   Ú%test_serializing_multiple_expressionsrð   ù  sW  € Ü�YŠYÜ
�Š�”b—h’h“jÓ!Ü
�Š�”b—h’h“jÓ!ðó €Fô �XŠX”b—h’h˜s“m QÓ'¬¯ª´"·(²(¸3³-ÄÇÂÈ#ÃÓ)OÐP€EÜ
�,‰,×
,Ñ
,¨U°W¸hÐ4GÈÓ
P€CÜ�|‰|×3Ñ3°CÓ8€HØ—_‘_Ô$Ð$Ð$Üˆx×#Ñ#Ó$¨Ô)Ð)Ð)ä—(’(œ2Ÿ8š8 A›;¨Ó*¬B¯HªH´R·X²X¸a³[Ä"Ç(Â(È1Ã+Ó,NÐO€JÜˆx×#Ñ# GÕ,Ó-´°ZÀµ]Ó1CÔCÐCÐCÜˆx×#Ñ# HÕ-Ó.´#°jÀµmÓ2DÔDÐDÒDr   c                  óŠ  € \         P                  ! \         P                  ! R \         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      p \        P
                  ! \        P                  ! R 4      ^4      p\        P
                  ! \        P                  ! ^ 4      ^4      pVP                  V 4      p\         P                  P                  V4      pWP                  8X  g   Q h\        VP                  4      ^8X  g   Q h\        VP                  R,          4      \        V4      8X  g   Q h\         P                  P                  W.RR.V 4      p\        P                  ! \        4      ;_uu_ 4       p\        P                   P#                  V4       RRR4       R\        XP$                  4      9   g   Q h\         P                  P                  V.R.V 4      p\        P                   P#                  V4      p\        V4      \        V4      8X  g   Q hR#   + '       g   i     L‹; i)r_   r‡   Ú
expressionrì   rí   Nzcontained multiple expressionsÚ	weirdname)r	   r   rq   r·   rÑ   rç   Úto_substraitr1   r¹   rº   r»   r   r¸   rD   rE   rè   Ú
ExpressionÚfrom_substraitr’   )r   r´   Ú	expr_normr8   r¼   r“   Úexpr2s          r   Útest_serializing_with_computerù   	  s�  € Ü�YŠYÜ
�Š�”b—h’h“jÓ!Ü
�Š�”b—h’h“jÓ!ðó €Fô �8Š8”B—H’H˜S“M 1Ó%€DÜ—’œŸš !› aÓ(€IØ
×
Ñ
˜FÓ
#€CÜ�|‰|×3Ñ3°CÓ8€Hà—_‘_Ô$Ð$Ð$Üˆx×#Ñ#Ó$¨Ô)Ð)Ð)äˆx×#Ñ# LÕ1Ó2´c¸)³nÔDÐDÐDô �,‰,×
,Ñ
,¨d¨\¸GÀXÐ;NÐPVÓ
W€CÜ	�Š”z×	"Ô	" gÜ
�‰×$Ñ$ SÔ)÷ 
#à+¬s°7·=±=Ó/AÔAÐAÐAô �,‰,×
,Ñ
,¨d¨V°k°]ÀFÓ
K€CÜ�M‰M×(Ñ(¨Ó-€EÜˆu‹:œ˜Y›Ô'Ð'Ò'÷ 
#×	"ús   Æ H2È2I	c                  ó  € \         P                  ! \         P                  ! R \         P                  ! 4       4      .4      p \        P
                  ! ^
4      p\        P
                  ! ^4      p\        P                  ! W4      .p\        P                  ! \        4      ;_uu_ 4        \         P                  P                  VR.V 4       RRR4       \         P                  P                  VR.V RR7      p\         P                  P                  V4      pWP                  8X  g   Q h\        VP                  4      ^8X  g   Q h\        VP                  R,          4      \        V^ ,          4      8X  g   Q hR#   + '       g   i     L¶; i)r_   r´   NT)Úallow_arrow_extensions)r	   r   rq   Úuint32rÑ   rÒ   Ú
shift_leftrD   rE   r   r1   r¸   r¹   rº   r»   r   )r   ÚaÚbrî   r8   r¼   s         r   Útest_serializing_udfsr   $  s  € ô �YŠYÜ
�Š�”b—i’i“kÓ"ðó €Fô 	�	Š	�"‹€AÜ
�	Š	�!‹€AÜ�]Š]˜1Ó Ð!€Eä	�ŠÔ/×	0Õ	0Ü
�‰×*Ñ*¨5°6°(¸FÔC÷ 
1ô �,‰,×
,Ñ
,Ø�ˆx˜¸ð -ó >€Cä�|‰|×3Ñ3°CÓ8€HØ—_‘_Ô$Ð$Ð$Üˆx×#Ñ#Ó$¨Ô)Ð)Ð)Üˆx×#Ñ# FÕ+Ó,´°E¸!µH³Ô=Ð=Ò=÷ 
1×	0ús   Â%#E6Å6F	c                  ó´  € R p \         P                  ! \         P                  ! R\         P                  ! 4       4      \         P                  ! R\         P                  ! 4       4      .4      p\         P
                  P                  V 4      pW8X  g   Q h\         P
                  P                  V4      pVP                  V 8X  g   Q h\         P
                  P                  V4      pW8X  g   Q h\         P
                  P                  VP                  4      pW8X  g   Q h\         P
                  P                  VP                  4      pVP                  V8X  g   Q hR# )s   
x
y
*
br_   r‡   N)
r	   r   rq   r·   rá   r1   Údeserialize_schemaÚserialize_schemar¹   rò   )Úsubstrait_schemaÚexpected_schemar¼   Úarrow_substrait_schemas       r   Útest_serializing_schemar  :  s  € ØVÐÜ—i’iÜ
�Š�”b—h’h“jÓ!Ü
�Š�”b—i’i“kÓ"ð!ó €Oô �|‰|×.Ñ.Ð/?Ó@€HØÔ&Ð&Ð&äŸ\™\×:Ñ:¸8ÓDÐØ!×(Ñ(Ð,<Ô<Ð<Ð<ä�|‰|×.Ñ.Ð/EÓF€HØÔ&Ð&Ð&ä�|‰|×.Ñ.Ð/E×/LÑ/LÓM€HØÔ&Ð&Ð&ä�|‰|×3Ñ3Ð4J×4UÑ4UÓV€HØ�?‰?˜oÔ-Ð-Ò-r   c                  ó   €  ! R  R4      p Rp\         P                  P                  P                  V ! V4      4      p\	        VP
                  4      ^8X  g   Q hRVP
                  9   g   Q hRVP
                  9   g   Q hR# )c                   ó,   a € ] tR tRt o R tR tRtV tR# )Ú7test_bound_expression_from_Message.<locals>.FakeMessageiQ  c                ó   € Wn         R # r—   ©r´   )Úselfr´   s   &&r   Ú__init__Ú@test_bound_expression_from_Message.<locals>.FakeMessage.__init__R  s   € ØŽIr   c                ó   € V P                   # r—   r  )r  s   &r   ÚSerializeToStringÚItest_bound_expression_from_Message.<locals>.FakeMessage.SerializeToStringU  s   € Ø—9‘9Ðr   r  N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r  r  Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   ÚFakeMessager
  Q  s   ø‡ € ò	÷	ð 	r   r  sj   

project_release

 project_version"0
project_version
project_release
:
bÚproject_releaseÚproject_versionN)r	   r1   ÚBoundExpressionsrö   rº   r»   )r  Úmessagerî   s      r   Ú"test_bound_expression_from_Messager  P  sv   € ÷ñ ðA€Gô �L‰L×)Ñ)×8Ñ8¹ÀWÓ9MÓN€EÜˆu× Ñ Ó! QÔ&Ð&Ð&Ø × 1Ñ 1Ô1Ð1Ð1Ø × 1Ñ 1Ô1Ð1Ò1r   )é
   )/r   r,   rD   Úpyarrowr	   Úpyarrow.computeÚcomputerÑ   Úpyarrow.libr   r   r   Úpyarrow.substraitr1   ÚImportErrorÚmarkÚ
pytestmarkr   r   Úparametrizer;   Ú	py_bufferrH   rK   rN   rW   r]   rs   r|   r€   r�   r”   r�   Únumpyr«   r³   rç   rq   r½   rÖ   rä   rê   rð   rù   r   r  r  r˜   r   r   Ú<module>r,     s_  ðó$ 
Û ã ã Ý Ý ß >ðÝ)ð �[‰[×"Ñ"€
ôDò
ð ‡�×Ñ˜¨¨u¨Ó6ñ*;ó 7ð*;ðZ ‡�×Ñ˜ 2§<¢<°	Ó#:¸HÀaÐ"HÓIñ#ó Jð#ò
!ð ‡�×Ñ˜¨¨u¨Ó6ñ,;ó 7ð,;òbò<ð ‡�×Ñ˜¨¨u¨Ó6ñ-"ó 7ð-"ò`'@òT'@ðT ‡�×Ñ˜¨¨u¨Ó6ñx!ó 7ðx!òvs:ðl ‡�×Ñ˜¨¨u¨Ó6ñ'ó 7ð'ðT ‡�×ÑñQ!ó ðQ!ðh ‡�×Ññg!ó ðg!ðT ‡�×Ñ˜Ø‡H‚HˆR�XŠX�c‹]˜AÓØ‡H‚HˆR�XŠX�c‹]˜BŸHšH S›MÓ*Ø‡H‚HˆSƒM�BÑð"ó ñ

/óð

/òEò(ò89ò(Eò (ò6>ò,.ô,2øðe! ô ØƒIðús   ¦H! È!	H.È-H.