I'm trying to add the ability to push-down the evaluation of a function to my storage engine (Solr in this case). For instance,
select movie_id, user_id, custom_rating('foo') as rating from movie_ratings where custom_rating('foo') is some function in my storage engine. This seems like a UDF in Calcite terms but I'm not having any luck getting the function node passed to my adapter code. I've tried adding a ScalarFunction to my schema but it gets evaluated early (long before my adapter code gets hit). I've also tried a TableFunction, but always end up with this error (using 1.11) Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 27 to line 1, column 36: No match found for function signature custom_rating(<CHARACTER>) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:796) at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:784) at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4080) at org.apache.calcite.sql.validate.SqlValidatorImpl.handleUnresolvedFunction(SqlValidatorImpl.java:1614) at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:278) at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:223) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:4445) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:4432) at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:137) which when debugging looks like the function isn't registered correctly in the schema but I've overridden protected Multimap<String, Function> getFunctionMultimap() in my schema impl. to include my function. I scanned the docs and the UDF code (e.g. Smalls) but don't see an example of a adapter supplied function. Any guidance you can provide is appreciated. Thanks. Tim