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: Fix query translation for scripted queries #35408

Merged
merged 3 commits into from Nov 12, 2018

Conversation

matriv
Copy link
Contributor

@matriv matriv commented Nov 9, 2018

IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: #35232

IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: elastic#35232
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@@ -21,7 +20,7 @@
/**
* Negation function (@{code -x}).
*/
public class Neg extends UnaryScalarFunction implements ScriptWeaver {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ScalarFunction already implements ScriptWeaver

@@ -845,6 +818,14 @@ public QueryTranslation translate(Expression exp, boolean onAggs) {

protected abstract QueryTranslation asQuery(E e, boolean onAggs);


protected static Query generateQuery(ScalarFunction sf, Expression field, Supplier<Query> query) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe better suggestion for a name here?

Copy link
Member

Choose a reason for hiding this comment

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

wrapQuery/handleQuery/handleScript?

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

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.

LGTM

@@ -845,6 +818,14 @@ public QueryTranslation translate(Expression exp, boolean onAggs) {

protected abstract QueryTranslation asQuery(E e, boolean onAggs);


protected static Query generateQuery(ScalarFunction sf, Expression field, Supplier<Query> query) {
Copy link
Member

Choose a reason for hiding this comment

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

wrapQuery/handleQuery/handleScript?

@matriv matriv merged commit 55ff96b into elastic:master Nov 12, 2018
@matriv matriv deleted the mt/fix-35232 branch November 12, 2018 09:42
matriv pushed a commit that referenced this pull request Nov 12, 2018
IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: #35232
@matriv
Copy link
Contributor Author

matriv commented Nov 12, 2018

Backported to 6.x with ed9a855

matriv pushed a commit that referenced this pull request Nov 12, 2018
IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: #35232
@matriv
Copy link
Contributor Author

matriv commented Nov 12, 2018

Backported to 6.5 with cab2fa1

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Nov 12, 2018
* master:
  Add docs for CCR stats API (elastic#35439)
  Fix the names of CCR stats endpoints in usage API (elastic#35438)
  Switch to default to no build qualifier (elastic#35415)
  Clarify S3 repository storage class parameter (elastic#35400)
  SQL: Fix query translation for scripted queries (elastic#35408)
  [TEST] Instead of ignoring the ccr downgrade to basic license qa test avoid the assertions that check the log files, because that does not work on Windows. The rest of the test is still useful and should work on Windows CI.
  Upgrade to Joda 2.10.1 (elastic#35410)
  HLRest: model role and privileges (elastic#35128)
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Nov 12, 2018
* master:
  Add docs for CCR stats API (elastic#35439)
  Fix the names of CCR stats endpoints in usage API (elastic#35438)
  Switch to default to no build qualifier (elastic#35415)
  Clarify S3 repository storage class parameter (elastic#35400)
  SQL: Fix query translation for scripted queries (elastic#35408)
  [TEST] Instead of ignoring the ccr downgrade to basic license qa test avoid the assertions that check the log files, because that does not work on Windows. The rest of the test is still useful and should work on Windows CI.
  Upgrade to Joda 2.10.1 (elastic#35410)
  HLRest: model role and privileges (elastic#35128)
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Nov 12, 2018
* master:
  Address handling of OS pretty name on some OS (elastic#35451)
  HLRC support for getTask (elastic#35166)
  upgrade to lucene-8.0.0-snapshot-6d9c714052 (elastic#35428)
  Add docs for CCR stats API (elastic#35439)
  Fix the names of CCR stats endpoints in usage API (elastic#35438)
  Switch to default to no build qualifier (elastic#35415)
  Clarify S3 repository storage class parameter (elastic#35400)
  SQL: Fix query translation for scripted queries (elastic#35408)
  [TEST] Instead of ignoring the ccr downgrade to basic license qa test avoid the assertions that check the log files, because that does not work on Windows. The rest of the test is still useful and should work on Windows CI.
  Upgrade to Joda 2.10.1 (elastic#35410)
  HLRest: model role and privileges (elastic#35128)
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Nov 13, 2018
* master: (22 commits)
  Introduce CCR getting started guide (elastic#35434)
  Correct typo in BuildPlugin exception message (elastic#35458)
  Correct implemented interface of ParsedReverseNested (elastic#35455)
  [ML] Fix find_file_structure NPE with should_trim_fields (elastic#35465)
  Handle OS pretty name on old OS without OS release (elastic#35453)
  Register remote cluster compress setting (elastic#35464)
  [DOCS] Clarify results_index_name description (elastic#35463)
  [TEST] add missing doc tests for HLRC GetRollupIndexCaps API
  [HLRC] Add GetRollupIndexCaps API (elastic#35102)
  Geo: enables coerce support in WKT polygon parser (elastic#35414)
  [ILM] fix retry so it picks up latest policy and executes async action (elastic#35406)
  Address handling of OS pretty name on some OS (elastic#35451)
  HLRC support for getTask (elastic#35166)
  upgrade to lucene-8.0.0-snapshot-6d9c714052 (elastic#35428)
  Add docs for CCR stats API (elastic#35439)
  Fix the names of CCR stats endpoints in usage API (elastic#35438)
  Switch to default to no build qualifier (elastic#35415)
  Clarify S3 repository storage class parameter (elastic#35400)
  SQL: Fix query translation for scripted queries (elastic#35408)
  [TEST] Instead of ignoring the ccr downgrade to basic license qa test avoid the assertions that check the log files, because that does not work on Windows. The rest of the test is still useful and should work on Windows CI.
  ...
pgomulka pushed a commit to pgomulka/elasticsearch that referenced this pull request Nov 21, 2018
IsNull, IsNotNull and Not where generating wrong queries
as the check to generate ScriptQuery was missing.

Fixes: elastic#35232
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.

None yet

5 participants