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

Improve UDF handling in delegation strategy #2699

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

rick-nguyen
Copy link
Contributor

This PR adds a flag that allows us to maintain UDF context when visiting UDF call nodes in delegation strategy. This is needed to provide accurate warnings when using UDF inside filter function args.

@rick-nguyen rick-nguyen requested a review from a team as a code owner October 16, 2024 14:58
@LucGenetier
Copy link
Contributor

✅ No public API change.

@rick-nguyen rick-nguyen changed the title Draft: Improve UDF handling in delegation strategy Improve UDF handling in delegation strategy Oct 21, 2024
@LucGenetier
Copy link
Contributor

✅ No public API change.

@LucGenetier
Copy link
Contributor

✅ No public API change.

@LucGenetier
Copy link
Contributor

✅ No public API change.

@rick-nguyen rick-nguyen added the Breaking Internals Breaking change - may require a PA Client update. label Oct 22, 2024
@LucGenetier
Copy link
Contributor

✅ No public API change.

@LucGenetier
Copy link
Contributor

✅ No public API change.

[Theory]
[InlineData(
"DelegatableUDF(Value: Number):Boolean = Value > 5;",
"DelegatableUDF2():MyDataSourceTableType = Filter(MyDataSource, DelegatableUDF(Value));",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DelegatableUDF

The fact that we can delegate this is surprising to me... do we expand the UDFs when translating it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to support it at least for non-row scope scenarios. For row-scope scenarios, it gets complicated in translation which we need to design it well.

Using UDF which is non-row scope shouldn't make the parent function call non-delegable. This works today at least which is good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example,
UDF2(Name:Text) = Name;

This UDF2 could be row-scoped or non-row scoped depending in the context it is used.

Filter(Accounts, Name = UDF2(Name)) --> Row scoped
Filter(Accounts, Name = UDF2("")) --> Non-Row scoped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Internals Breaking change - may require a PA Client update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants