Interface UdfLanguageRuntime


public interface UdfLanguageRuntime
Executes UDFs and stored procedures of one UdfLanguage. Runtimes are discovered as a ServiceLoader SPI (see UdfRuntimes): Java ships in the engine, while the heavyweight languages live in optional modules — frostlake-rt-js (GraalJS JavaScript), frostlake-rt-py (GraalPy Python) and frostlake-rt-scala (in-process scala-compiler) — and light up only when their module is on the classpath, so the core engine carries no GraalVM language or Scala compiler dependencies. Adding a language is "implement this interface and register the provider in META-INF/services/dev.frostlake.executor.udf.UdfLanguageRuntime".
  • Method Details

    • language

      UdfLanguage language()
      The language this runtime executes.
    • configure

      void configure(EngineConfig config)
      Engine-construction hook: receives every new engine's configuration (e.g. python.venv). Called once per DatabaseEngine instance for every discovered runtime — implementations with JVM-wide state must be idempotent; runtimes without configuration make this a no-op.
    • executeFunction

      Object executeFunction(Function function, List<Object> arguments, Catalog catalog, S3PathResolver s3PathResolver)
      Evaluate a scalar UDF call and return its SQL value. The catalog and S3 resolver (either may be null) let runtimes whose handlers can live in a JAR resolve IMPORTS stage references — runtimes that only execute inline bodies ignore them.
    • executeProcedure

      Object executeProcedure(Procedure procedure, List<Object> arguments, DatabaseEngine engine)
      Execute a stored procedure call and return its result value.
    • executeTableFunction

      ResultSet executeTableFunction(Function function, List<Object> arguments)
      Execute a table function (UDTF) call; languages without table functions throw.
    • compileFunction

      default void compileFunction(Function function)
      Compile a FUNCTION's body at CREATE time, throwing if the routine could never run — live-verified, a Python, Java or Scala function whose body will not compile, or whose HANDLER is not in it, is refused by CREATE rather than by the first call.

      The default is a deliberate no-op, and it is what JavaScript wants: live compiles no JavaScript body at all, so AS '' is created happily and only fails when called. It is also the honest answer for a language whose module is absent — an engine that cannot judge a body must accept it, exactly as the SQL-body check fails open on a construct it cannot parse.

    • compileProcedure

      default void compileProcedure(Procedure procedure)
      Compile a PROCEDURE's body at CREATE time, as compileFunction(dev.frostlake.metastore.model.Function) does for a function.

      Not simply the same rule: a PYTHON procedure is NOT compiled at CREATE though a Python function is — measured both ways on the same account — so this defaults to a no-op separately rather than sharing the function's implementation.