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

adding reflections as a dependency #1559

Merged
merged 1 commit into from
May 9, 2023

Conversation

dhrubo-os
Copy link
Contributor

Description

adding reflections as a dependency.

POST _plugins/_ppl
{
  "query": "source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans centroids=3"
}

This command was breaking and the debug log is:

Caused by: java.lang.NoClassDefFoundError: org/reflections/Reflections
opensearch-node1         | 	at org.opensearch.ml.common.MLCommonsClassLoader.loadMLAlgoParameterClassMapping(MLCommonsClassLoader.java:66) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.MLCommonsClassLoader.loadClassMapping(MLCommonsClassLoader.java:51) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.MLCommonsClassLoader.lambda$static$0(MLCommonsClassLoader.java:39) ~[?:?]
opensearch-node1         | 	at java.security.AccessController.doPrivileged(AccessController.java:569) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.MLCommonsClassLoader.<clinit>(MLCommonsClassLoader.java:38) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.output.MLOutput.fromStream(MLOutput.java:35) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.transport.MLTaskResponse.<init>(MLTaskResponse.java:38) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.common.transport.MLTaskResponse.fromActionResponse(MLTaskResponse.java:55) ~[?:?]
opensearch-node1         | 	at org.opensearch.ml.client.MachineLearningNodeClient.lambda$getMlPredictionTaskResponseActionListener$8(MachineLearningNodeClient.java:191) 

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

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.

@Yury-Fridlyand
Copy link
Collaborator

Could you please add integration tests?

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2023

Codecov Report

Merging #1559 (b6f6788) into main (59ef998) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff            @@
##               main    #1559   +/-   ##
=========================================
  Coverage     97.18%   97.18%           
  Complexity     4106     4106           
=========================================
  Files           371      371           
  Lines         10462    10462           
  Branches        706      706           
=========================================
  Hits          10168    10168           
  Misses          287      287           
  Partials          7        7           
Flag Coverage Δ
sql-engine 97.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@dhrubo-os
Copy link
Contributor Author

Could you please add integration tests?

I'm brand new in this plugin. Can you please show me how to write a integration test for this?

@vamsi-amazon
Copy link
Member

Could you please add integration tests?

I'm brand new in this plugin. Can you please show me how to write a integration test for this?
@dhrubo-os

https://github.com/opensearch-project/sql/blob/main/integ-test/src/test/java/org/opensearch/sql/ppl/WhereCommandIT.java
This is an example Integration test file for where commands.

Similarly you could create a separate file for MLCommands or you can subdivide into more files based on different types of ML commands. Most of the useful functions are already present in parent class.

Sample command to run integTests.
./gradlew :integ-test:integTest --tests "org.opensearch.sql.ppl.WhereCommandIT"

@vamsi-amazon vamsi-amazon added bug Something isn't working backport 2.x labels Apr 19, 2023
@dai-chen
Copy link
Collaborator

This is a required runtime dependency for ML client, right? If so, could you explain why this is not configured from ML side?

@ylwu-amzn
Copy link
Contributor

This is a required runtime dependency for ML client, right? If so, could you explain why this is not configured from ML side?

hi, @dai-chen The background is @Yury-Fridlyand found we have a fat ml-commons client jar opensearch-project/ml-commons#778, later, we removed the common-utils and refection to avoid generating fat jar opensearch-project/ml-commons#796.

And neural search did code change by adding the runtime dependency https://github.com/opensearch-project/neural-search/blob/main/build.gradle#L151

@dai-chen
Copy link
Collaborator

@ylwu-amzn Thanks for the context! I thought this can be a runtime dependency in ml-commons and SQL or other plugin introduces the dependency transitively. Will take a look at the link you shared to confirm.

@ylwu-amzn
Copy link
Contributor

ylwu-amzn commented Apr 19, 2023

@ylwu-amzn Thanks for the context! I thought this can be a runtime dependency in ml-commons and SQL or other plugin introduces the dependency transitively. Will take a look at the link you shared to confirm.

Yes, actually team is working on that part now. We have not found a good way to add this to ml-commons (opensearch-project/ml-commons#808, we tried this in PR opensearch-project/ml-commons#811, not working actually), then other plugins like SQL can download the transitive dependencies automatically. How about let's add this runtime dependency for now to unblock 2.7 release. We can enhance this part later

@dai-chen
Copy link
Collaborator

dai-chen commented Apr 19, 2023

@ylwu-amzn I see. I thought ml-commons is already in Maven repo with its own dependencies defined. We can improve this later in case there're more dependencies required. Thanks!

Btw, could you or @dhrubo-os think about how to add integration test in SQL or elsewhere? I think it's missing in SQL. Not sure if you have it from your side.

@dai-chen
Copy link
Collaborator

@dhrubo-os @ylwu-amzn Should I backport this to 2.7 branch? Is code freeze now?

@dai-chen
Copy link
Collaborator

Just realized BWC failed. I reran it. Please have a look if it fails still.

@dhrubo-os
Copy link
Contributor Author

@dai-chen

for build (ubuntu-latest, 17)

  2> REPRODUCE WITH: ./gradlew ':integ-test:integTest' --tests "org.opensearch.sql.ppl.StandaloneIT.testSourceFieldQuery" -Dtests.seed=E70277A01E44958E -Dtests.security.manager=false -Dtests.locale=tr-TR -Dtests.timezone=Africa/Lusaka -Druntime.java=17
  2> org.junit.ComparisonFailure: expected:<...,
          "type": "str[i]ng"
        }
      ],
      "da...> but was:<...,
          "type": "str[ı]ng"
        }
      ],
      "da...>
        at __randomizedtesting.SeedInfo.seed([E70277A01E44958E:7D80FF271D471980]:0)
        at org.junit.Assert.assertEquals(Assert.java:117)
  1> [2023-04-19T21:54:17,800][INFO ][o.o.s.p.StandaloneIT     ] [testSourceFieldQuery] initializing REST clients against [http://[::1]:33605, http://127.0.0.1:45711]
  1> [2023-04-19T21:54:18,501][INFO ][o.o.s.p.PPLService       ] [testSourceFieldQuery{request_id=66b4593b-34c7-46c7-bf2c-b60c8bceb62c}] [66b4593b-34c7-46c7-bf2c-

and for build (ubuntu-latest, 11)

Task :integ-test:sqlBwcCluster#mixedClusterTask FAILED

Should we restart the test again? Is there anything I can do?

I talked with @zelinh , we need to do that soon, we are getting close to generating the RC.

@dai-chen
Copy link
Collaborator

Rerunning the failed workflow

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.

Please add the issue to follow up after 2.7 release.

@dhrubo-os
Copy link
Contributor Author

Please add the issue to follow up after 2.7 release.

@penghuo can you please approve this PR: #1561

@Yury-Fridlyand
Copy link
Collaborator

BWC still fails.

@Yury-Fridlyand Yury-Fridlyand merged commit 4bbd12a into opensearch-project:main May 9, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 9, 2023
Signed-off-by: Dhrubo Saha <[email protected]>
(cherry picked from commit 4bbd12a)
Yury-Fridlyand pushed a commit that referenced this pull request May 11, 2023
Signed-off-by: Dhrubo Saha <[email protected]>
(cherry picked from commit 4bbd12a)

Co-authored-by: Dhrubo Saha <[email protected]>
MitchellGale pushed a commit to Bit-Quill/opensearch-project-sql that referenced this pull request Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants