We can probably have a discussion in hangout today on how to add the mechanism 
to drill itself. That would make future implementations of newer UDF's easy for 
developers, rather than having to modify SqlStdOperatorTable in Optiq every 
time.

Cheers,
Yash




-----Original Message-----
From: Julian Hyde [mailto:[email protected]]
Sent: Tuesday, September 10, 2013 1:00 AM
To: [email protected]
Subject: Re: Exception while implementing drill trigonometric functions (For 
DRILL-219). Need tips.

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


________________________________






NOTE: This message may contain information that is confidential, proprietary, 
privileged or otherwise protected by law. The message is intended solely for 
the named addressee. If received in error, please destroy and notify the 
sender. Any use of this email is prohibited when received in error. Impetus 
does not represent, warrant and/or guarantee, that the integrity of this 
communication has been maintained nor that the communication is free of errors, 
virus, interception or interference.

Reply via email to