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

SQL: Provide null-safe scripts for Not and Neg #34877

Merged
merged 2 commits into from
Oct 26, 2018
Merged

Conversation

costin
Copy link
Member

@costin costin commented Oct 25, 2018

Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close #34848

Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close elastic#34848
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

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

@@ -456,6 +456,13 @@ selectHireDateGroupByHireDate
SELECT hire_date HD, COUNT(*) c FROM test_emp GROUP BY hire_date ORDER BY hire_date DESC;
selectSalaryGroupBySalary
SELECT salary, COUNT(*) c FROM test_emp GROUP BY salary ORDER BY salary DESC;
selectSalaryGroupBySalaryHavingIsNotNull
SELECT salary, COUNT(*) c FROM test_emp GROUP BY salary HAVING MAX(languages) IS NOT NULL ORDER BY salary DESC;
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 a good test atm, but not really testing the behavior as MAX() doesn't seem to return null in any scenario #34896

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch - due the use of primitives, a non-null value is returned all the time.

Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

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

LGTM! left a question

}

if (!(input instanceof Boolean)) {
throw new SqlIllegalArgumentException("A boolean is required; received {}", input);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this already be caught by the pipeline? Is it just a "safety net" ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is yes - we might not need them long term.

@costin costin merged commit 5a7b8c0 into elastic:master Oct 26, 2018
@costin costin deleted the fix-34838 branch October 26, 2018 15:21
costin added a commit that referenced this pull request Oct 26, 2018
Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close #34848

(cherry picked from commit 5a7b8c0)
jasontedor added a commit to martijnvg/elasticsearch that referenced this pull request Oct 26, 2018
* master:
  Introduce cross-cluster replication API docs (elastic#34726)
  Responses can use Writeable.Reader interface (elastic#34655)
  SQL: Provide null-safe scripts for Not and Neg (elastic#34877)
  Fix put/resume follow request parsing (elastic#34913)
  Fix line length for org.elasticsearch.common.* files (elastic#34888)
  [ML] Extract common native process base class (elastic#34856)
  Refactor children aggregator into a generic ParentJoinAggregator (elastic#34845)
  [Style] Fix line lengths in action.admin.indices (elastic#34890)
  HLRC - add support for source exists API (elastic#34519)
@costin costin added the v6.5.1 label Oct 26, 2018
costin added a commit that referenced this pull request Oct 28, 2018
Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close #34848

(cherry picked from commit 5a7b8c0)
kcm pushed a commit that referenced this pull request Oct 30, 2018
Introduce null-safe Painless scripts for Not and Neg
Simplify script generation for Unary functions

Close #34848
@colings86 colings86 added v6.5.0 and removed v6.5.1 labels Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants