sql icon indicating copy to clipboard operation
sql copied to clipboard

SessionContext from ExecutionEngine

Open MaxKsyunz opened this issue 3 years ago • 1 comments

Implement now function using SessionContext managed by the execution engine. Unlike #937 this implementation decouples the function definition from capturing query start time.

In addition, this declaration of Expression.valueOf allows for passing other metadata to function implementations.

Implementation overview

SessionContext is a class that stores query execution start time.

It is provided to now implementation through an argument to Expression.valueOf.

That is done by ProjectOperator while executing

ExecutionEngine provides an instance of SessionContext to each PhyiscalPlan by calling PhysicalPlan.open.

Remaining work

Ensure that SessionContext is passed in all instances where an expression can contain now() call.

Signed-off-by: MaxKsyunz [email protected]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

MaxKsyunz avatar Oct 25 '22 16:10 MaxKsyunz

@penghuo what do you think of this implementation of query context (I called it SessionContext here). In this case, the value is provided at execution time, not function definition.

MaxKsyunz avatar Oct 25 '22 16:10 MaxKsyunz

Will revisit this later.

MaxKsyunz avatar Oct 29 '22 01:10 MaxKsyunz