Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CH] Support lambda function in some high order functions #6159

Open
zhanglistar opened this issue Jun 20, 2024 · 1 comment · May be fixed by #6248
Open

[CH] Support lambda function in some high order functions #6159

zhanglistar opened this issue Jun 20, 2024 · 1 comment · May be fixed by #6248
Labels
enhancement New feature or request

Comments

@zhanglistar
Copy link
Contributor

Description

array_sort, filter, transform, aggregate.

@zhanglistar zhanglistar added the enhancement New feature or request label Jun 20, 2024
@lgbo-ustc
Copy link
Contributor

lgbo-ustc commented Jun 26, 2024

How a lambda function (x -> x % 2 == 1) in substrait looks like

{
    "scalarFunction": {
        "functionReference": 3,
        "outputType": {
            "bool": {
                "nullability": "NULLABILITY_NULLABLE"
            }
        },
        "arguments": [
            {
                "value": {
                    "scalarFunction": {
                        "functionReference": 4,
                        "outputType": {
                            "bool": {
                                "nullability": "NULLABILITY_NULLABLE"
                            }
                        },
                        "arguments": [
                            {
                                "value": {
                                    "scalarFunction": {
                                        "functionReference": 5,
                                        "outputType": {
                                            "i32": {
                                                "nullability": "NULLABILITY_NULLABLE"
                                            }
                                        },
                                        "arguments": [
                                            {
                                                "value": {
                                                    "scalarFunction": {
                                                        "functionReference": 6,
                                                        "outputType": {
                                                            "i32": {
                                                                "nullability": "NULLABILITY_REQUIRED"
                                                            }
                                                        },
                                                        "arguments": [
                                                            {
                                                                "value": {
                                                                    "literal": {
                                                                        "string": "x"
                                                                    }
                                                                }
                                                            }
                                                        ]
                                                    }
                                                }
                                            },
                                            {
                                                "value": {
                                                    "literal": {
                                                        "i32": 2
                                                    }
                                                }
                                            }
                                        ]
                                    }
                                }
                            },
                            {
                                "value": {
                                    "literal": {
                                        "i32": 1
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            {
                "value": {
                    "scalarFunction": {
                        "functionReference": 6,
                        "outputType": {
                            "i32": {
                                "nullability": "NULLABILITY_REQUIRED"
                            }
                        },
                        "arguments": [
                            {
                                "value": {
                                    "literal": {
                                        "string": "x"
                                    }
                                }
                            }
                        ]
                    }
                }
            }
        ]
    }
}
"functionReference": 3 -> lambdafunction
"functionReference": 4 -> equal
"functionReference": 5 -> modulus
"functionReference": 6 -> namedlambdavariable

You can lookup into PlannerActionsVisitorImpl::visitLambda(const QueryTreeNodePtr & node) for how a lambda function is transformed into actions dag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants