Yash Sharma 2013-09-21, 15:43
Julian Hyde 2013-09-23, 16:42
Ted Dunning 2013-09-24, 03:04
-Re: [jira] [Commented] (DRILL-247) New Math Functions: log, sqrt, cbrt, rand, round, exp, e, pi, pow
On Sep 23, 2013, at 8:04 PM, Ted Dunning <[EMAIL PROTECTED]> wrote:
> Is e any worse than any function? Really?
1. "e" is short, so greater chance of overlap with user identifiers, which also tend to be short.
2. In standard SQL, functions with no parameters do not take arguments. So their namespaces overlap with the column and table namespaces. (MySQL and Postgres do not adhere to the standard in this regard. If we want to depart from the standard, let's do it with our eyes open.)
Careful what functions we put into Drill. Once they are in, we'll never be able to take them out. (Ask the MySQL and Hive folks what pain they went through to clean up their function set once they decided to become SQL compliant.)
I recommend that we just put in functions that are in the standard or are in at least 2 major databases. And provide a facility for user-defined functions so that people can do what they need without cluttering up the namespace for perpetuity.
"e" doesn't pass this test. It is not in the standard, is not in Oracle, DB2, MySQL, or Postgres. And there is an easy workaround: exp(1).
By the way, the standard has "ln" and "log10" but no "log". I suggest we follow suit. (Oracle has "log(n, base)", which is different. MySQL has "ln" and "log", and they both do the same thing. Hmm - I wonder how that happened?)
Similar comments regarding "pow". The standard has "power". MySQL has both "pow" and "power". LucidDB (upon which Optiq is based) had "pow" and "power", and we bit the bullet and removed "pow".
> Couldn't exp be just as bad (EXPense)? Or even something like cos (Cost Of
There's always a chance of overlap. But you minimize it by sticking to the same set of built-ins, keywords and reserved words as the other databases.
Yash Sharma 2013-09-23, 17:21