linkedin / coral

Coral is a translation, analysis, and query rewrite engine for SQL and other relational languages.
BSD 2-Clause "Simplified" License
780 stars 182 forks source link

Translating Expressions through Coral #22

Open phd3 opened 3 years ago

phd3 commented 3 years ago

Can Coral provide stable APIs to translate expressions from hive to Presto through coral?

Usecase (As requested by Praveen Krishna):

Presto allows connectors to provide row-filters in terms of expressions. It's possible that they're defined in hiveql, and presto needs to read and transform them before applying. For this purpose, having the ability to translate expressions directly is useful.

for example, Presto can be configured to say that for queries by user U on on table tpch.tiny.orders , exclude rows for which orderKey is >= 10. This is defined as an expression written as orderKey < 10 in the configuration. Currently, Presto requires this expression to be in a form that Presto can understand. If coral allows hive --> presto translation of such expressions, then they could be expressed as hive expressions and translated at runtime.

wmoustafa commented 3 years ago

@phd3, where would these expressions be stored in the case of the Hive Metastore connector?

phd3 commented 3 years ago

@wmoustafa it's upto the plugin implementation. it can be stored in a file for example.