trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.35k stars 2.98k forks source link

Clarify lifecycle of Constraint#predicate Predicate #7620

Open findepi opened 3 years ago

findepi commented 3 years ago

Constraint#predicate is an opaque Predicate that internally holds to an evaluator. this is passed to ConnectorMetadata#applyFilter

Question:

Regardless of the answer, since this is a subtle aspect of the SPI, we should document that in the javadoc.

martint commented 3 years ago

No, it's not allowed to hold on to it. It's meant to be used only for the duration of the API call.

findepi commented 3 years ago

That would be my intuition as well, but i didn't know the intentions.

  1. we should document
  2. we can optionally enforce that, by "destroying" the evaluator after the call returns