-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create new anonymizer for new engine #266
Conversation
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
…on of anonymization Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
…osition Signed-off-by: Matthew Wells <[email protected]>
Codecov Report
@@ Coverage Diff @@
## integ-sql-anonymizer #266 +/- ##
=======================================================
Coverage ? 97.17%
Complexity ? 4146
=======================================================
Files ? 372
Lines ? 10409
Branches ? 711
=======================================================
Hits ? 10115
Misses ? 287
Partials ? 7
Flags with carried forward coverage won't be shown. Click here to find out more. 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Matthew Wells <[email protected]>
sql/src/main/java/org/opensearch/sql/sql/antlr/AnonymizerListener.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/opensearch/sql/sql/parser/AstBuilderTestBase.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add IT
legacy/src/main/java/org/opensearch/sql/legacy/plugin/RestSqlAction.java
Show resolved
Hide resolved
Not sure if intended or if it's a big deal but I found a difference between legacy and and V2 anonymization.
Note that |
Could you explain what the |
Because of the way that we are anonymizing there are a few differences between the new and legacy anonymizers, the main and most obvious one is that table is anonymized to identifier rather than to table, I mentioned that other differences in the ticket description. I can look into if there is any possible way of changing this but currently it just looks at what kind of node it is and all identifiers and tables have the same |
The |
I wonder if there's a better way of doing this. A question to ask is why is |
I certainly agree that it is very weird, I can spend some time looking into it |
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
…er, simplified identifier.identifier to identifier, and added IT Signed-off-by: Matthew Wells <[email protected]>
sql/src/main/java/org/opensearch/sql/sql/antlr/AnonymizerListener.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/opensearch/sql/sql/antlr/AnonymizerListener.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/opensearch/sql/sql/antlr/AnonymizerListener.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/opensearch/sql/sql/antlr/SQLSyntaxParser.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/opensearch/sql/sql/parser/AnonymizerListenerTest.java
Show resolved
Hide resolved
sql/src/test/java/org/opensearch/sql/sql/parser/AnonymizerListenerTest.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/opensearch/sql/sql/parser/QueryDataAnonymizerTest.java
Outdated
Show resolved
Hide resolved
… method tests are conducted, added back in dot notation for identifiers Signed-off-by: Matthew Wells <[email protected]>
…mas, added more tests Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
case TIMESTAMP: | ||
case BACKTICK_QUOTE_ID: | ||
if (previousType == FROM) { | ||
anonymizedQueryString += "table"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this will only work for the first table. For example, if we have a join or alias, we will get identifiers.
e.g. FROM table1 as t1, table2 as t2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is fine... we don't need to fix this.
…erage Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
Signed-off-by: Matthew Wells <[email protected]>
* Create new anonymizer for new engine (#266) * Created anonymizer listener for anonymizing SQL queries through the new engine Signed-off-by: Matthew Wells <[email protected]> * Update for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * added missing file header, change public variable to private Signed-off-by: Matthew Wells <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> Signed-off-by: Matthew Wells <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]>
* Create new anonymizer for new engine (#266) * Created anonymizer listener for anonymizing SQL queries through the new engine Signed-off-by: Matthew Wells <[email protected]> * Update for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * added missing file header, change public variable to private Signed-off-by: Matthew Wells <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> Signed-off-by: Matthew Wells <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]>
* Create new anonymizer for new engine (#266) * Created anonymizer listener for anonymizing SQL queries through the new engine Signed-off-by: Matthew Wells <[email protected]> * Update for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * added missing file header, change public variable to private Signed-off-by: Matthew Wells <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> Signed-off-by: Matthew Wells <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]> Signed-off-by: Mitchell Gale <[email protected]>
…earch-project#1677) * Create new anonymizer for new engine (#266) * Created anonymizer listener for anonymizing SQL queries through the new engine Signed-off-by: Matthew Wells <[email protected]> * Update for review comments Signed-off-by: Andrew Carbonetto <[email protected]> * added missing file header, change public variable to private Signed-off-by: Matthew Wells <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> Signed-off-by: Matthew Wells <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]> (cherry picked from commit 62120fd) Co-authored-by: Matthew Wells <[email protected]>
Description
Created a new listener for the SQLSyntaxParser to anonymize all queries going through the new engine, calling the old anonymizer only if the query falls back to the legacy engine.
Through the update of the anonymizer there are a few differences between between the current and old anonymization including:
identifier
instead oftable
identifier.identifier
instead of simplifying as justidentifier
number * - number
insteadnumber * number
Issues Resolved
opensearch-project#821
Check List
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.