ADQL-2.0 Erratum 2 - MOD function description

IVOA DAL mailing list thread on July 2016 highlighted a possible issue with the description of the MOD function.

Erratum Content

Table 1 on page 8 of the ADQL-2.0 recommendation reports

Name Argument data type Return data type Description
mod(x, y) double double Returns the remainder of y/x.
This seems to conflict with SQL (92, 2003) definitions and, as well, the behaviour of the existing TAP services, suggesting that x and y should be swapped in the function description.

Rationale

Considering what current TAP services using ADQL and the mathematical description of the modulo operator where

M % N = R

with

  • R having the same sign as M
  • |R| is less than |N|
  • M = K * N + R for a given integer K

The definition of mod(x, y) in ADQL-2.0 should be amended to "Returns the remainder of x/y". It should also be made clear, maybe in a future revision, to follow the above rules for the remainder and its sign.

Impact Assesment

The change proposed by this erratum should impact no existing IVOA resource. Checks against the major TAP services shows they already act following the behaviour here above described. Checks against a choice of RDBMS-es (PostgreSQL, MySQL, MariaDB, Apache Derby, HyperSQL and Oracle) shows the same bahaviour too. See the mail thread referenced in the introduction of this page for details.

Edit | Attach | Watch | Print version | History: r10 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2016-07-07 - MarcoMolinaro
 
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback