High level comments on initial patch:
Can you move the reader to a new SystemStoragePlugin? You can then expose the options as a table in that storage plugin. (Register this plugin automatically rather than having the user configure it, similar to information schema. The table columns would probably be something like: [NAME, CATEGORY, DEFAULT, SESSION] where DEFAULT is the setting that a new session would get (a.k.a global) and the SESSION is the current value of the option. In the case that you haven't set any options, the two values would be the same.
For the options access interface, we should have the following things supported:
For getOption(), we should first consult the set of SESSION options. If we don't have a value there, we should use the DEFAULT option.
We should maintain the set of global options in the distributed cache across the cluster. For session options, these will be maintained on the node that owns the session. All session level options that are focused on query execution will be included in logical and physical plans.
We should probably have a category criteria for options that describes to what they correspond. For example, we could have category criteria of:
an example might be:
SET OPTIMIZATION PRFER_HASH_JOIN ON
SET GLOBAL OPTIMIZATION PRFER_HASH_JOIN ON
syntax is made up here to describe concepts.