Dawid Wysakowicz created FLINK-14782:
----------------------------------------
Summary: CoreModule#getFunctionDefinition throws exception when function does not exist
Key: FLINK-14782
URL:
https://issues.apache.org/jira/browse/FLINK-14782 Project: Flink
Issue Type: Bug
Components: Table SQL / Planner
Affects Versions: 1.10.0
Reporter: Dawid Wysakowicz
Fix For: 1.10.0
As in the subject CoreModule#getFunctionDefinition throws exception when function does not exist, while it should just return an Optional.
{code}
@Test
public void testGetFunction() {
Optional<FunctionDefinition> optional = CoreModule.INSTANCE.getFunctionDefinition("AAA");
}
{code}
An easy fix would be to change the {{CoreModule#getFunctionDefinition}} to
{code}
@Override
public Optional<FunctionDefinition> getFunctionDefinition(String name) {
return BuiltInFunctionDefinitions.getDefinitions().stream()
.filter(f -> f.getName().equalsIgnoreCase(name))
.findFirst()
.map(Function.identity());
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)