Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill, mail # dev - RE:  [jira] [Commented] (DRILL-247) New Math Functions: log, sqrt, cbrt, rand, round, exp, e, pi, pow


Copy link to this message
-
Re: [jira] [Commented] (DRILL-247) New Math Functions: log, sqrt, cbrt, rand, round, exp, e, pi, pow
Julian Hyde 2013-09-24, 04:28
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
> String)?
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.

Julian