I am not 100% sure this is what you are asking about, but Calcite uses a 
DataContext object when evaluating queries.
Perhaps that's the right place to add the information needed.

Mihai

________________________________
From: Akshay <[email protected]>
Sent: Monday, February 19, 2024 10:00 AM
To: [email protected] <[email protected]>
Subject: ** Can we pass constructor while registering UDF's **

Hi

I was wondering if someone could help me with this.

I have a custom Avro Adapter that applies SQL on AVRO records. I register
all the UDFs as a scalar function today where I simply call

ScalarFunctionImpl.create(
    calciteFunction.getClazz(), calciteFunction.getMethodName())));


But now I have some UDFs where I will need to pass some context for the
UDFs where these are parameters outside the UDF parameters.I was thinking
of passing this in a constructor argument, but unfortunately, when the
adapter code pushes down my UDFs for evaluation I don't see the constructor
argument. I need this to be available inside my `eval` function.

using static variables works locally and I can retrieve it. but in a
distributed world (spark) engine I see the value to be null. Is there a way
to pass parameters to scalar functions without having them being part of
the method signature?

I was wondering what would be the easiest way for me to achieve this.

Reply via email to