That error stack says that the SIN function is not known to Optiq's SQL 
validator. Optiq's validator is driven by a table of functions and operators, 
but Drill doesn't currently have a way to add to that table.

Since SIN is a generally useful function, it should be built-in in Optiq. You 
could do that by modifying SqlStdOperatorTable and adding a field similar to 
the one that defines the SQRT operator:

    public static final SqlFunction sqrtFunc =
        new SqlFunction(
            "SQRT",
            SqlKind.OTHER_FUNCTION,
            SqlTypeStrategies.rtiNullableDouble,
            null,
            SqlTypeStrategies.otcNumeric,
            SqlFunctionCategory.Numeric);

I believe the validation rules are identical for SQRT and SIN.

However we should also add a mechanism to Drill to allow it to add its own 
functions (including user-defined functions) to Optiq's SQL validator on the 
fly.

Julian

Reply via email to