Skip to content

Adds INNER JOIN, LEFT JOIN, Path Step Key & Fixes ExprStruct #1294

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

Merged
merged 3 commits into from
Dec 11, 2023

Conversation

johnedquinn
Copy link
Member

@johnedquinn johnedquinn commented Dec 11, 2023

Relevant Issues

  • None

Description

  • Adds INNER JOIN, LEFT JOIN, Path Step Key & Fixes ExprStruct
  • Going to add the other JOINS after this. Wanted to get the ExprStruct and PathStepKey out.

Other Information

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@johnedquinn johnedquinn marked this pull request as ready for review December 11, 2023 21:21
Copy link

github-actions bot commented Dec 11, 2023

Conformance comparison report

Base (7a65f05) 02b9b9f +/-
% Passing 92.54% 92.54% 0.00%
✅ Passing 5384 5384 0
❌ Failing 434 434 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5384

Number failing in both: 434

Number passing in Base (7a65f05) but now fail: 0

Number failing in Base (7a65f05) but now pass: 0

@johnedquinn johnedquinn requested a review from rchowell December 11, 2023 21:24
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (partiql-eval@7a65f05). Click here to learn what that means.

Additional details and impacted files
@@               Coverage Diff               @@
##             partiql-eval    #1294   +/-   ##
===============================================
  Coverage                ?   49.28%           
  Complexity              ?     1046           
===============================================
  Files                   ?      166           
  Lines                   ?    13392           
  Branches                ?     2500           
===============================================
  Hits                    ?     6600           
  Misses                  ?     6135           
  Partials                ?      657           
Flag Coverage Δ
CLI 11.87% <0.00%> (?)
EXAMPLES 80.28% <0.00%> (?)
LANG 54.72% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

import org.partiql.value.PartiQLValue
import org.partiql.value.PartiQLValueExperimental

internal abstract class RelJoin : Operator.Relation {
Copy link
Contributor

@rchowell rchowell Dec 11, 2023

Choose a reason for hiding this comment

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

Suggested change
internal abstract class RelJoin : Operator.Relation {
/**
* https://people.inf.elte.hu/miiqaai/elektroModulatorDva.pdf#page=756
*/
internal abstract class RelJoinNestedLoop : Operator.Relation {

I would keep pointers though rather than storing relations and iterators. This should be O(m*n) time but only O(1) space because it streams. I think you've made it O(m+n) space

Comment on lines +44 to +50
lhsIterator.forEach { lhsRecord ->
rhsIterator.forEach { rhsRecord ->
val input = lhsRecord + rhsRecord
val result = condition.eval(input)
getOutputRecord(result.isTrue(), lhsRecord, rhsRecord)?.let { return it }
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is simple enough for now, but we don't have to store both relations for this. You keep a pointer to the left-hand-side record and right-hand-side record. Advance the right-hand-side until condition holds, then yield. Once right-hand-side is exhausted, increment the left hand side.

We have to really test our PartiQLValue equality and hash now and we can use different join algorithms

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. I'm going to merge this now with the intention of modifying this in the next PR. There's only one way to go and that's up.

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.

3 participants