/** * Return a view macro that may or may not be defined in a certain schema. If it's not defined, returns null. * * @param schemaPlus schema * @param functionName function name * * @return view, or null */ @Nullable private static TableMacro getView(final SchemaPlus schemaPlus, final String functionName) { // Look for a zero-arg function that is also a TableMacro. The returned value // is never null so we don't need to check for that. final Collection<org.apache.calcite.schema.Function> functions = schemaPlus.getFunctions(functionName); for (org.apache.calcite.schema.Function function : functions) { if (function.getParameters().isEmpty() && function instanceof TableMacro) { return (TableMacro) function; } } return null; }
/** * Return a view macro that may or may not be defined in a certain schema. If it's not defined, returns null. * * @param schemaPlus schema * @param functionName function name * * @return view, or null */ @Nullable private static TableMacro getView(final SchemaPlus schemaPlus, final String functionName) { // Look for a zero-arg function that is also a TableMacro. The returned value // is never null so we don't need to check for that. final Collection<org.apache.calcite.schema.Function> functions = schemaPlus.getFunctions(functionName); for (org.apache.calcite.schema.Function function : functions) { if (function.getParameters().isEmpty() && function instanceof TableMacro) { return (TableMacro) function; } } return null; }