MCPcopy Create free account
hub / github.com/apache/arrow / test_scalar_aggregate_udf_basic

Function test_scalar_aggregate_udf_basic

python/pyarrow/tests/test_substrait.py:612–757  ·  view source on GitHub ↗
(varargs_agg_func_fixture)

Source from the content-addressed store, hash-verified

610
611@pytest.mark.numpy
612def test_scalar_aggregate_udf_basic(varargs_agg_func_fixture):
613
614 test_table = pa.Table.from_pydict(
615 {"k": [1, 1, 2, 2], "v1": [1, 2, 3, 4],
616 "v2": [1.0, 1.0, 1.0, 1.0]}
617 )
618
619 def table_provider(names, _):
620 return test_table
621
622 substrait_query = b"""
623{
624 "extensionUris": [
625 {
626 "extensionUriAnchor": 1,
627 "uri": "urn:arrow:substrait_simple_extension_function"
628 },
629 ],
630 "extensions": [
631 {
632 "extensionFunction": {
633 "extensionUriReference": 1,
634 "functionAnchor": 1,
635 "name": "sum_mean"
636 }
637 }
638 ],
639 "relations": [
640 {
641 "root": {
642 "input": {
643 "extensionSingle": {
644 "common": {
645 "emit": {
646 "outputMapping": [
647 0,
648 1
649 ]
650 }
651 },
652 "input": {
653 "read": {
654 "baseSchema": {
655 "names": [
656 "k",
657 "v1",
658 "v2",
659 ],
660 "struct": {
661 "types": [
662 {
663 "i64": {
664 "nullability": "NULLABILITY_REQUIRED"
665 }
666 },
667 {
668 "i64": {
669 "nullability": "NULLABILITY_NULLABLE"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected