@PublicEvolving public class FunctionContext extends Object
FunctionContext
allows to obtain global runtime information about the context in which
the user-defined function is executed.
The information includes the metric group, distributed cache files, and global job parameters.
Note: Depending on the call location of a function, not all information might be available. For example, during constant expression reduction the function is executed locally with minimal information.
Constructor and Description |
---|
FunctionContext(RuntimeContext context) |
FunctionContext(RuntimeContext context,
ClassLoader userClassLoader,
Configuration jobParameters) |
Modifier and Type | Method and Description |
---|---|
File |
getCachedFile(String name)
Gets the local temporary file copy of a distributed cache files.
|
Set<ExternalResourceInfo> |
getExternalResourceInfos(String resourceName)
Get the external resource information.
|
String |
getJobParameter(String key,
String defaultValue)
Gets the global job parameter value associated with the given key as a string.
|
MetricGroup |
getMetricGroup()
Returns the metric group for this parallel subtask.
|
ClassLoader |
getUserCodeClassLoader()
Gets the
ClassLoader to load classes that are not in system's classpath, but are part
of the JAR file of a user job. |
public FunctionContext(@Nullable RuntimeContext context, @Nullable ClassLoader userClassLoader, @Nullable Configuration jobParameters)
public FunctionContext(RuntimeContext context)
public MetricGroup getMetricGroup()
public File getCachedFile(String name)
name
- distributed cache file namepublic String getJobParameter(String key, String defaultValue)
key
- key pointing to the associated valuedefaultValue
- default value which is returned in case global job parameter is null or
there is no value associated with the given keypublic Set<ExternalResourceInfo> getExternalResourceInfos(String resourceName)
public ClassLoader getUserCodeClassLoader()
ClassLoader
to load classes that are not in system's classpath, but are part
of the JAR file of a user job.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.