facebook/presto — pull request #1301 by miniway (2014-05-14 18:44:36+00:00)
Title: Session carries arbitrary optional key value pairs

After Presto-0.66, ConnectorSession is under the api project and transparent between a client and plugin. This was exciting improvement so that a plugin can act differently based on ConnectorSession, it means based on User.

Base on that, we might also want to pass arbitrary optional values to a plugin for various purpose. For example, we might want to pass additional user properties, price plan, a secure token or a metadata information etc, more than the user identity. Sure a plugin might fetch additional information from the user identity, but there would be a security issue and it would not easy to shared these information between the coordinator and the workers.

As 'x-amz-meta-*' http header does in Amazon S3 access, if Presto can send optional values as a form of HTTP header with 'X-Presto-Option-*' and store onto the ConnectorSession, a plugin should have more fine grained control with addition values.

At the presto-cli, we could specify them with new command line option,
./presto-cli -catalog=tpch -schema=tpch -user=userid -options=name1:value1,name2:value2"

One minor thing we should keep in mind is HTTP header name must be case insensitive. So name1 and NAME1 will be treated same and stored as lower case at the ConnectorSession.