facebook/presto — pull request #860 by frsyuki (2013-11-18 06:15:08+00:00)
Title: Allow range-based condition pushdown to connectors

Background:
There're some databases supporting range-based query such as DynamoDB, Cassandra, sharded PostgreSQL, etc. I want to connect them to Presto.
But because Presto supports condition pushdown only for "=" operator currently, it can't take advantage of native filters operators of the underlaying databases.

Description:
This patch enables connectors to get range-based conditions from SplitManager if the connector implements `ConnectorSplitManagerWithPushdown` interface.

Implementation:
1. I tried to not break backward compatibility. This patch doesn't change existent SPI interfaces at all.
2. My approach enables Presto to pushdown conditions including functions as long as we can determine upper and/or lower bound of its return value (not implemented yet, though). For example, if Presto gets a query like `WHERE time > IF(paying=true, "2013-01", "2013-10")`, it should be able to pushdown condition `time > "2013-01"` to the underlying database because the result of `IF` function has lower bound "2013-01".
3. Another example is `time > DATE_FORMAT(NOW(), "%Y-%m")`. This query reads data imported this month (actually we have a lot of queries like this). We can't pushdown this kind of conditions using simple inline constant expansion optimization. But my approach enables to do it because DATE_FORMAT has the lower bound.

I'm excited to read Presto source code. I'm really impressed its design. Thank you for designing Presto!