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

Refactor replication SQL API to not allow single quote input for destination #239

Closed

Conversation

chenselena
Copy link
Collaborator

Summary

This PR refactors the replication SQL API to not allow single quote inputs for the destination parameter.
Previously we were allowing the following SQL:

ALTER TABLE db.testTable SET POLICY (REPLICATION=({destination:'clusterA'}))
ALTER TABLE db.testTable SET POLICY (REPLICATION=({destination:'clusterA', interval:'<X>h/H'}))

Updated to allow:

ALTER TABLE db.testTable SET POLICY (REPLICATION=({destination:clusterA}))
ALTER TABLE db.testTable SET POLICY (REPLICATION=({destination:clusterA, interval:'<X>h/H'}))

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests

For all the boxes checked, please include additional details of the changes made in this pull request.

Testing Done

  • Manually Tested on local docker setup. Please include commands ran, and their output.
  • Added new tests for the changes made.
  • Updated existing tests to reflect the changes made.
  • No tests added or updated. Please explain why. If unsure, please feel free to ask for help.
  • Some other form of testing like staging or soak time in production. Please explain.

For all the boxes checked, include a detailed description of the testing done for the changes made in this pull request.

Updated unit testing.

Tested on local docker setup:

scala> spark.sql("ALTER TABLE u_tableowner.test_table2 SET POLICY ( REPLICATION=({destination:a, interval:12H}) )")
res5: org.apache.spark.sql.DataFrame = []
scala> spark.sql("ALTER TABLE u_tableowner.test_table2 SET POLICY ( REPLICATION=({destination:'a', interval:12H}) )")
com.linkedin.openhouse.spark.sql.catalyst.parser.extensions.OpenhouseParseException: mismatched input ''a'' expecting {'ALTER', 'TABLE', 'SET', 'POLICY', 'RETENTION', 'REPLICATION', 'SHARING', 'GRANT', 'REVOKE', 'ON', 'TO', 'SHOW', 'GRANTS', 'PATTERN', 'WHERE', 'COLUMN', IDENTIFIER, BACKQUOTED_IDENTIFIER}; line 1 pos 76
  at com.linkedin.openhouse.spark.sql.catalyst.parser.extensions.OpenhouseParseErrorListener$.syntaxError(OpenhouseSparkSqlExtensionsParser.scala:123)

Additional Information

  • Breaking Changes
  • Deprecations
  • Large PR broken into smaller PRs, and PR plan linked in the description.

For all the boxes checked, include additional details of the changes made in this pull request.

@chenselena chenselena marked this pull request as ready for review October 25, 2024 18:35
@chenselena chenselena closed this Oct 25, 2024
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.

1 participant