Skip to content

Conversation

aceforeverd
Copy link
Collaborator

@aceforeverd aceforeverd commented Sep 27, 2023

support online for SQLs:

  1. t1 last join (t2 last join t3)

What's changed:

  • lazy last join support for request mode
  • fix the compilation issue for join(filter) in cluster mode, support SQL last join (filter) in request mode with cluster optimized #3531
  • refactor performance check over physical plan
    • either one and only one request table, or zero tables involved
  • optimizer(cluster): apply only for JOIN(ROW, TABLE), skip for cases like JOIN(TABLE, ...)
  • optimizer(group_and_sort)
    • support apply JOIN (..., JOIN(...))
    • correct column resolving from clause to table: resolve in current schemas context and save in cache, search cache in DataProvider node
  • cleanup unused codes

For SQL `A last join (B last join C)`, it'll optimize and run `B last
join C` lazily. Both batch mode and request(batch-request) mode are
considered.
and also:
- rm redundant code path in group_and_sort_optimized.cc
@github-actions github-actions bot added the execute-engine hybridse sql engine label Sep 27, 2023
/**
* Resolve column id with given column expression [ColumnRefNode, ColumnId]
*/
base::Status ResolveColumnID(const node::ExprNode* column, size_t* column_id) const;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

delete due to no implementation.

@@ -522,39 +586,6 @@ bool GroupAndSortOptimized::KeyAndOrderOptimized(
sort, new_in);
}

bool GroupAndSortOptimized::SortOptimized(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

never covered

&child_column_id, &source_column_id, &source);

// try loose the relation
if (!status.isOK() && !col->GetRelationName().empty()) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deleted. do not make sense from try twice

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (9190ecf) 75.25% compared to head (a477dc2) 75.36%.
Report is 12 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3533      +/-   ##
============================================
+ Coverage     75.25%   75.36%   +0.10%     
  Complexity      587      587              
============================================
  Files           701      717      +16     
  Lines        129041   129709     +668     
  Branches       1280     1280              
============================================
+ Hits          97115    97751     +636     
- Misses        31640    31672      +32     
  Partials        286      286              
Files Coverage Δ
...se/examples/toydb/src/testing/toydb_engine_test.cc 97.53% <ø> (ø)
hybridse/include/node/node_manager.h 100.00% <ø> (ø)
hybridse/include/node/sql_node.h 84.93% <100.00%> (+0.07%) ⬆️
hybridse/include/passes/expression/expr_pass.h 100.00% <ø> (ø)
hybridse/include/vm/engine.h 97.36% <ø> (ø)
hybridse/include/vm/physical_op.h 91.04% <100.00%> (-0.07%) ⬇️
hybridse/include/vm/schemas_context.h 100.00% <ø> (ø)
hybridse/src/node/node_manager.cc 89.16% <100.00%> (ø)
hybridse/src/passes/physical/cluster_optimized.cc 83.21% <100.00%> (+0.12%) ⬆️
...dse/src/passes/physical/group_and_sort_optimized.h 100.00% <ø> (ø)
... and 11 more

... and 34 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

correct expr resolving in group_and_sort_optimized
Skip for the case `JOIN(TABLE, ...)`. Cluster optimize only happen with
`JOIN(ROW, TABLE)`.
Do not optimize target table if resolved column is from different table,
even column name does be the same.
@aceforeverd aceforeverd marked this pull request as ready for review October 7, 2023 06:48
@aceforeverd aceforeverd changed the title feat: lazy last join feat(sql): lazy last join Oct 12, 2023
aceforeverd added a commit to aceforeverd/fedb that referenced this pull request Oct 16, 2023
@aceforeverd aceforeverd merged commit 024a0d0 into 4paradigm:main Oct 16, 2023
@aceforeverd aceforeverd deleted the feat-lazy-last-join branch October 16, 2023 12:29
aceforeverd added a commit to aceforeverd/fedb that referenced this pull request Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
execute-engine hybridse sql engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support SQL last join (filter) in request mode with cluster optimized
3 participants