Skip to content

SQL: [Tests] Fix replaceChildren of Pivot #49004

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

Closed
wants to merge 1 commit into from

Conversation

matriv
Copy link
Contributor

@matriv matriv commented Nov 12, 2019

For the special case that the qualifier of an attribute is set to
null, when the attribute is still an UnresolvedAttribute there was a
call to dataType() which throws an exception. To avoid that the method
withQualifier() is overriden for UnresolvedAttribute.

Fixes: #48900

For the special case that the `qualifier` of an attribute is set to
null, when the attribute is still an `UnresolvedAttribute` there was a
call to `dataType()` which throws an exception. To avoid that the method
`withQualifier()` is overriden for `UnresolvedAttribute`.

Fixes: elastic#48900
@matriv matriv added >test-failure Triaged test failures from CI :Analytics/SQL SQL querying v8.0.0 v7.5.0 v7.6.0 labels Nov 12, 2019
@matriv matriv requested review from costin and astefan November 12, 2019 19:36
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/SQL)

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM, but I would also add a comment related to why this breaks now (and wasn't breaking since Pivot was introduced).

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

I don't like this approach with propagates the hack of trying to bend equality when things are not really equal.
Modifying an unresolved attribute should throw an exception period. Acting as if nothing happened it's a bug.

A better fix would be to change the nodes test to avoid having unresolved attributes. An even better one would be to simply copy the node without doing any transformation on it (hence why it fails) - if there are any changes then these need to be addressed somewhere else.

Lastly, I've mentioned several times in the past please stop formatting the whole file, only the lines that are actually touched.

}
return e;
}

@Override
protected NodeInfo<Pivot> info() {
Copy link
Member

Choose a reason for hiding this comment

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

I haven't reviewed the previous PR so there's not much to do at this point.
I find the transformation inside info an ugly hack - from a simple copy it became transformer that overrides qualifiers.
What if the relationship has qualifiers in it?

@@ -99,6 +99,11 @@ public String unresolvedMessage() {
return unresolvedMsg;
}

@Override
Copy link
Member

Choose a reason for hiding this comment

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

A simple fix yet incorrect since an unresolved attribute should be first resolved before being manipulated.
It's way none of the with methods are implemented - touching an unresolved attribute is incorrect period.

@matriv
Copy link
Contributor Author

matriv commented Dec 6, 2019

Superseded by #49693 where the refactoring addressed and fixed the issue in a better way.

@matriv matriv closed this Dec 6, 2019
@matriv matriv deleted the fix-48900 branch December 6, 2019 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/SQL SQL querying >test-failure Triaged test failures from CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] NodeSubclassTests#testReplaceChildren fails for Pivot
4 participants