Skip to content

Conversation

@jnmugerwa
Copy link
Member

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.

@jnmugerwa jnmugerwa requested a review from kaikalur April 1, 2021 23:08

public class TestRewriteDriver
{
private static final String[] STATEMENT_THAT_DOESNT_NEED_REWRITE = new String[] {
Copy link

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);
Copy link

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.

Copy link
Member Author

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();
Copy link

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.

Copy link
Member Author

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
Copy link

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to RewriteResult.

Done.

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.

2 participants