-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add RewriteDriver #19
base: main
Are you sure you want to change the base?
Conversation
|
||
public class TestRewriteDriver | ||
{ | ||
private static final String[] STATEMENT_THAT_DOESNT_NEED_REWRITE = new String[] { |
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.
See if we can just reuse the test we have for the rewrites without copying them.
public class RewriteDriver | ||
{ | ||
private static final Logger LOG = Logger.get(RewriteDriver.class); | ||
private static final Set<Class<? extends Rewriter>> KNOWN_REWRITERS = ImmutableSet.of(OrderByRewriter.class); |
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.
Hmm, I thought the whole idea of the config is so people can just drop in a rewriter and use it? So I'm not sure if we need this.
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.
Agreed -- removing.
|
||
public class RewriteDriverConfig | ||
{ | ||
private Set<Class<? extends Rewriter>> userEnabledRewriters = emptySet(); |
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.
So we would like users to be able to add a rewriter and pass in the name to be able to use it. It's not just about enabling a rewriter.
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.
Renamed to enabled_rewriters.
Done.
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
public class RewriteDriverResult |
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.
WE need to find better name for this class.
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.
Renamed to RewriteResult.
Done.
Added a RewriteDriver and supporting classes (config, result, module).
This driver is the link between Presto-Parser and Presto-Coresql's rewriters, allowing us to apply 0 or more of Presto-Coresql's rewrites to a SQL statement passed to Presto-Parser.