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

Route using map rather than fold to prevent state from parameters affecting the outer state #3310

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rafaelbey
Copy link
Contributor

@rafaelbey rafaelbey commented Dec 18, 2024

What type of PR is this?

Bug Fix

What does this PR do / why is it needed ?

Currently, routing does a fold of the parameters of a function, and takes the output of that fold as the state to also route the outer function.

This has two side effect:

  • The firsts parameters affect the routing of subsequent parameters
  • The output of the fold affect the routing of the outer function

One visible outcome is when expressions have multiple from(), where these are not properly respected, leading to incorrect routing.

This PR also start treating let as a specialize function to ensure the platform generates the proper allocations nodes.

List of features this would enable:

  • let statement routed thru platform to ensure allocation node is created regardless of assignee is routed:
let var = now()->from(runtime)
  • let of relation expression and reference it on subsequent expressions:
let rel = #>{database}#->from(runtime);
$rel->filter(...);
  • let of function with multiple expressions
function hello(): String[1]
{
 let a = 'hello';
 let b = 'world';
 $a + $b;
}

// to route/execute
let r = hello();
$r + '!';
  • write with multiple from calls (cross-store)
#>{database}#->from(runtimeABC)->write(#>{anotherDatabase}#)->with(runtimeXYZ);
  • join with multiple from calls (cross-store)
#>{database}#->from(runtimeABC)->join(#>{anotherDatabase}#->from(runtimeXYZ));

@rafaelbey rafaelbey requested a review from a team as a code owner December 18, 2024 21:08
@rafaelbey rafaelbey marked this pull request as draft December 18, 2024 21:08
Copy link

github-actions bot commented Dec 18, 2024

Test Results

0 files   -   1 017  0 suites   - 1 017   0s ⏱️ - 1h 43m 21s
0 tests  - 12 824  0 ✔️  - 12 715  0 💤  - 109  0 ±0 
0 runs   - 18 828  0 ✔️  - 18 719  0 💤  - 109  0 ±0 

Results for commit 99feeda. ± Comparison against base commit d467d9a.

♻️ This comment has been updated with latest results.

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

Successfully merging this pull request may close these issues.

1 participant