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

Support equal/not_equal on a link column against a Mixed value #4597

Merged
merged 2 commits into from
Apr 9, 2021

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented Apr 8, 2021

What, How & Why?

Functionality requested by SDKs

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)

@jedelbo jedelbo requested a review from ironage April 8, 2021 11:57
ObjLink link = value.get_link();
auto target_table = table.get_link_target(column_key);
if (target_table->get_key() == link.get_table_key()) {
key = link.get_obj_key();
Copy link
Contributor

Choose a reason for hiding this comment

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

If the tables don't match, this code will still create matches on null links, but I don't think we want to do that. For mismatching tables, should we also throw the type mismatch error? Or maybe we can allow it but make a FALSEPREDICATE node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to return a FalseExpression in case of mismatching tables.

else if (m_column_type == col_type_Link) {
for (auto& key : m_target_keys) {
if (key) {
// LinkColumn stores link to row N as the integer N + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment has become stale and is not relevant to the code anymore, not related to your changes just noticing now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

ObjKey key = m_target_keys[0];

if (m_column_type == col_type_LinkList || m_condition_column_key.is_set()) {
if (!key) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if the query engine allows this or not, but maybe add an extra check to prevent matching null keys to an empty list

Suggested change
if (!key) {
if (!key && start != end) {

Copy link
Contributor Author

@jedelbo jedelbo Apr 9, 2021

Choose a reason for hiding this comment

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

Not sure either. Anyway the early out should be removed. We should not have a match on an empty list.

CHECK_EQUAL(tv.size(), 2);
q = source->where().not_equal(col_linklist, Mixed(target_keys[6]));
tv = q.find_all();
CHECK_EQUAL(tv.size(), 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some checks for searching for == and != null, across linklist and link? Just making sure we haven't changed behaviour from before.

Copy link
Contributor Author

@jedelbo jedelbo Apr 9, 2021

Choose a reason for hiding this comment

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

Well - this is new functionality. We could not do this before. LinksToNode would never match on a null link. Added some more test involving null.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, good point. Thanks for adding tests anyhow 😄

@jedelbo jedelbo requested a review from ironage April 9, 2021 07:25
@jedelbo jedelbo force-pushed the je/mixed-links-to branch from 676403e to da86829 Compare April 9, 2021 07:40
Copy link
Contributor

@ironage ironage left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jedelbo jedelbo merged commit 19f3314 into v11 Apr 9, 2021
@jedelbo jedelbo deleted the je/mixed-links-to branch April 9, 2021 16:24
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants