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

Enhance OS value parsing #3002

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bugmakerrrrrr
Copy link
Contributor

Description

#3001

Related Issues

Resolves #3001

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: panguixin <[email protected]>
Copy link
Collaborator

@penghuo penghuo left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution.

One questions, does the change in OpenSearchExprValueFactory.java related to the issue?

Comment on lines +347 to +348
} else if (((OpenSearchDataType) type).getExprType().equals(ARRAY) == false
&& supportArrays == false) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the change? could you elaborate more?

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 think the type must be OpenSearchDataType after my change, please correct me if I'm wrong

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is not required, the change improvment the json parse behaviour to support read int value from [int, string] value.

@@ -46,7 +46,7 @@ public void typeof_opensearch_types() {
String.format(
"SELECT typeof(double_number),typeof(long_number), typeof(integer_number),"
+ " typeof(byte_number), typeof(short_number),typeof(float_number),"
+ " typeof(half_float_number), typeof(scaled_float_number) from %s;",
+ " typeof(half_float_number), typeof(scaled_float_number) from %s limit 1;",
Copy link
Collaborator

Choose a reason for hiding this comment

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

why add limit 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

@@ -61,7 +61,7 @@ public void typeof_opensearch_types() {
// TODO activate this test once `ARRAY` type supported, see
// ExpressionAnalyzer::isTypeNotSupported
// + ", typeof(nested_value)"
+ " from %s;",
+ " from %s limit 1;",
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

@@ -401,7 +401,7 @@ public void testCompare() throws IOException {
var result =
executeQuery(
String.format(
"source=%s | eval `%s` = %s | fields `%s`",
"source=%s | head 1 | eval `%s` = %s | fields `%s`",
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is current result if remove head 1? is it breaking change?

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 add more rows in TEST_INDEX_DATATYPE_NONNUMERIC index, head 1 to avoid change the test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the return result order is not guaranteed, why not add another test dataset?

@bugmakerrrrrr
Copy link
Contributor Author

One questions, does the change in OpenSearchExprValueFactory.java related to the issue?

Yes, we need to parse the value in array according to the type of field, not the type of content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Enhance OS value parsing
2 participants