Merge lp://staging/~posulliv/maria/query-rewrite into lp://staging/maria/5.3

Proposed by Padraig O'Sullivan
Status: Needs review
Proposed branch: lp://staging/~posulliv/maria/query-rewrite
Merge into: lp://staging/maria/5.3
Diff against target: 534 lines (+411/-5)
11 files modified
include/mysql/plugin.h (+4/-3)
include/mysql/plugin_query_rewrite.h (+57/-0)
plugin/rewrite_lower/CMakeLists.txt (+17/-0)
plugin/rewrite_lower/Makefile.am (+32/-0)
plugin/rewrite_lower/plug.in (+4/-0)
plugin/rewrite_lower/rewrite_lower.cc (+84/-0)
sql/Makefile.am (+2/-0)
sql/sql_parse.cc (+3/-0)
sql/sql_plugin.cc (+6/-2)
sql/sql_query_rewrite.cc (+166/-0)
sql/sql_query_rewrite.h (+36/-0)
To merge this branch: bzr merge lp://staging/~posulliv/maria/query-rewrite
Reviewer Review Type Date Requested Status
Sergei Golubchik Pending
Review via email: mp+38565@code.staging.launchpad.net

This proposal supersedes a proposal from 2010-10-14.

Description of the change

This branch contains a new plugin point for query rewriting that I'd like to have considered. It allows someone to develop a plugin which can modify the text of a query before it is parsed.

A very simple explanation of my use-case is to transform a query with joins into a query on virtual tables that contains no joins. I need this transformation to be transparent to the user who can submit their original queries as before.

I picked this point for the plugin as its much easier for me to parse the query myself than to work with the parse tree produced by Maria. As Sergei mentioned on the MySQL internals list, a better plugin point may be after the query is parsed. I am open to working on this if someone can provide me with some help? Basically, what is the simplest structure I can pass to a plugin that represents the parse tree? Also, how can I obtain documentation or examples of how to modify the parse tree?

One possibility I was thinking of is to keep the current plugin points I have and also add another method to the rewriting interface which takes the parse tree as a parameter.

Thanks a lot,
Padraig

To post a comment you must log in.
Revision history for this message
Michael Widenius (monty) wrote : Posted in a previous version of this proposal

Hi!

>>>>> "Padraig" == Padraig O'Sullivan <email address hidden> writes:

Padraig> Padraig O'Sullivan has proposed merging lp:~posulliv/maria/query-rewrite into lp:maria.
Padraig> Requested reviews:
Padraig> Maria-captains (maria-captains)

Padraig> This branch contains a new plugin point for query rewriting that I'd like to have considered. It allows someone to develop a plugin which can modify the text of a query before it is parsed.

Padraig> A very simple explanation of my use-case is to transform a query with joins into a query on virtual tables that contains no joins. I need this transformation to be transparent to the user who can submit their original queries as before.

Padraig> I picked this point for the plugin as its much easier for me to parse the query myself than to work with the parse tree produced by Maria. As Sergei mentioned on the MySQL internals list, a better plugin point may be after the query is parsed. I am open to working on this if someone can provide me with some help? Basically, what is the simplest structure I can pass to a plugin that represents the parse tree? Also, how can I obtain documentation or examples of how to modify the parse tree?

Padraig> One possibility I was thinking of is to keep the current plugin points I have and also add another method to the rewriting interface which takes the parse tree as a parameter.

Igor, could you give some directions to Padraig how to solve his
problem in the nicest possible way?

Regards,
Monty

Unmerged revisions

2820. By Padraig O'Sullivan

Added another plugin point for query rewrite which allows the parse tree to be rewritten.

2819. By Padraig O'Sullivan

Simple version of query rewrite hook where query text is passed to rewrite hook. Also added a simple plugin which does nothing interesting except convert the query to lower case.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches