Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Adding simple In support #1114

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

FreCap
Copy link
Contributor

@FreCap FreCap commented May 22, 2021

This works for field IN (list...)

The support to subqueries in the IN clause is yet to come.

FreCap added 2 commits May 22, 2021 02:31
…is returning float, and some tests for the new engine were disabled for that
@dai-chen dai-chen requested review from penghuo, dai-chen and chloe-zh May 25, 2021 15:18
*/
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to remove this file if the code base has no dependency on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

} else if (o instanceof ExprValue) {
// since there is no primitive in Java for differentiating TIMESTAMP DATETIME and DATE
// we can allow passing a ExprValue that already contains this information
return (ExprValue) o;
Copy link
Member

Choose a reason for hiding this comment

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

Any insights here? @penghuo

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'll wait for a few more comment/suggestions before making changes to the rest.
Thank you @chloe-zh for the comments!

Comment on lines +218 to +228
// disabling test because in case of expr collections, we could pass ExprValues
// @Test
// public void unSupportedObject() {
// Exception exception = assertThrows(ExpressionEvaluationException.class,
// () -> ExprValueUtils.fromObjectValue(integerValue(1)));
// assertEquals(
// "unsupported object "
// + "class com.amazon.opendistroforelasticsearch.sql.data.model.ExprIntegerValue",
// exception.getMessage());
// }

Copy link
Member

Choose a reason for hiding this comment

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

Remove these lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

JSONObject results = executeQuery(sql);
Assert.assertThat(getTotalHits(results), equalTo(1));
}

Copy link
Member

Choose a reason for hiding this comment

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

Could you add some NOT IN integration test cases here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

@chloe-zh
Copy link
Member

Hi @FreCap thanks for your contributions! Left some comments, the rest looks good to me.

I wonder shall we also add the IN (as well as BETWEEN ... AND ...) in PPL where command (or condition clause in search command), that would be helpful for PPL as well @penghuo

@@ -370,3 +371,11 @@ functionArg
: expression
;

arrayArgs
Copy link
Contributor

@penghuo penghuo May 27, 2021

Choose a reason for hiding this comment

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

I think it should be collection of expression instead of array. Here are the reference from bigquery.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it a naming change or a structural change?
Would renaming arrayArgs to expressionCollection be the only thing to change?

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 the current limitation with the Function/Operator definition and resolver which doesn't support VAR paramaters. Most of the implementation is pretty good, my only concern is it is not ARRAY data type. Looking for the solution to support VAR paramaters 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.

Could you please add some details on next steps?

From my understanding you suggest to discard this PR away and add implementation for VARs.

  1. Is this correct?
  2. is there any plan/timeline on your side?

Thank you,
Francesco

Copy link
Contributor

Choose a reason for hiding this comment

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

The ARRAY is also make sense, but the defintion of IN operator should be IN(BOOL, ARRAY(BOOL)). which required more change in Type (support ARRAY(E)), FunctionSignature.
Add my thoughts in here. Does it make sense to you?

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.

3 participants