Hi,

Interesting question indeed!

The closest I could get would be to use lookupFunctionBuilder(name:
FunctionIdentifier): Option[FunctionBuilder] [1] followed by extracting the
dataType from T in `type FunctionBuilder = Seq[Expression] => T` which can
be Expression (regular functions) or LogicalPlan (table-valued functions).
Expression has got dataType while LogicalPlan has got output
(or outputAttributes).

HTH

Let us know how you're doing.

BTW, Can you describe how you "using Apache Calcite to run some SQL
transformations on Apache sparks SQL statements"?

[1]
https://github.com/apache/spark/blob/e60ce3e85081ca8bb247aeceb2681faf6a59a056/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L91

Pozdrawiam,
Jacek Laskowski
----
"The Internals Of" Online Books <https://books.japila.pl/>
Follow me on https://twitter.com/jaceklaskowski

<https://twitter.com/jaceklaskowski>


On Tue, Mar 28, 2023 at 9:01 PM Guillaume Masse <
masse.guilla...@narrative.io> wrote:

> Hi,
>
> I'm using Apache Calcite to run some SQL transformations on Apache sparks
> SQL statements. I would like to extract the type signature out
> of spark.catalog.listFunctions to be able to register them in Calcite with
> their proper signature.
>
> From the API, I can get the fully qualified class name and the name, but
> unfortunately, the type signature is not present. Would there be a way to
> use reflection to extract? For example:
>
>
> https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala#L424
>
> Ideally, it would be convenient to get the type signature
> from org.apache.spark.sql.catalog.Function itself when available.
>
>
> --
> Guillaume Massé
> [Gee-OHM]
> (马赛卫)
>

Reply via email to