You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Richard Wheeldon (JIRA)" <de...@db.apache.org> on 2006/09/02 17:57:22 UTC

[jira] Created: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

[PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
-----------------------------------------------------------------------

                 Key: DERBY-1808
                 URL: http://issues.apache.org/jira/browse/DERBY-1808
             Project: Derby
          Issue Type: Improvement
          Components: SQL
            Reporter: Richard Wheeldon
            Priority: Minor
         Attachments: rsw_functions1.patch


Adds the following functions:

SIGN - 0, 1 or -1 for zero, positive or negative arguments
SQRT - Square root
RAND - Random number
RANDOM - as above
COSH - Hyperbolic Cosine
SINH - Hyperbolic Sine
TANH - Hyperbolic Tangent.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: Bugs in inbuilt functions (was Re: [jira] Commented: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH)

Posted by Daniel John Debrunner <dj...@apache.org>.
richard@rswheeldon.com wrote:

> Daniel John Debrunner (JIRA) writes:
>  > Thanks Richard, I'll review the patch, but as a quick note Derby
>  > already supports SQRTand ABS (also added in your patch).
>  > I think all the others are new to Derby.
> 
> Yes, these are implemented in a different section to the others
> which is why I didn't realise until after I'd submitted the patch.
> More importantly, these are the only ones which actually seem to
> work properly, as can be seen from the following transcript:
> 
> ij version 10.3
> ij> connect 'jdbc:derby:test;create=true';
> ij> create table simple_tab (
> 	x integer
> );
> 
> 0 rows inserted/updated/deleted
> ij> insert into simple_tab values (1);
> 1 row inserted/updated/deleted
> ij> select acos(x) y from simple_tab;
> Y                     
> ----------------------
> 0.0                   
> 
> 1 row selected
> ij> create view simple_acos_view as (
> 	select acos(x) y from simple_tab
> );
> 
> ERROR 42X94: OBJECT '2fb0c07e-010d-6f90-2909-00000012ff18' does not exist.
> ij> 
> quit;
> 
> The attached sql files show that this works across all functions,
> against the current svn head. It's not the changes I've made, because
> I've just rebuilt from the originals. If you can point me in the right
> direction, I'll take a look and try to submit a patch. Otherwise, I'll
> file the appropriate bug report. The current stable version appears to
> be unaffected,

Thas looks like a bug in the new builtin function setup, not sure where
to look, my guess is some code is assuming that these descriptors are
perisistent when they are just in-memory descriptors. Can you add a bug
for this.

Richard, FYI, you may want to keep an eye on DERBY-1802, Susan has
contributed a JUnit test for these new builting functions, it needs some
cleanup before I can commit it, but once it's in the codeline, you may
consider adding additional cases for the functions you have added.

Thanks,
Dan.




Bugs in inbuilt functions (was Re: [jira] Commented: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH)

Posted by ri...@rswheeldon.com.
Daniel John Debrunner (JIRA) writes:
 > Thanks Richard, I'll review the patch, but as a quick note Derby
 > already supports SQRTand ABS (also added in your patch).
 > I think all the others are new to Derby.

Yes, these are implemented in a different section to the others
which is why I didn't realise until after I'd submitted the patch.
More importantly, these are the only ones which actually seem to
work properly, as can be seen from the following transcript:

ij version 10.3
ij> connect 'jdbc:derby:test;create=true';
ij> create table simple_tab (
	x integer
);

0 rows inserted/updated/deleted
ij> insert into simple_tab values (1);
1 row inserted/updated/deleted
ij> select acos(x) y from simple_tab;
Y                     
----------------------
0.0                   

1 row selected
ij> create view simple_acos_view as (
	select acos(x) y from simple_tab
);

ERROR 42X94: OBJECT '2fb0c07e-010d-6f90-2909-00000012ff18' does not exist.
ij> 
quit;

The attached sql files show that this works across all functions,
against the current svn head. It's not the changes I've made, because
I've just rebuilt from the originals. If you can point me in the right
direction, I'll take a look and try to submit a patch. Otherwise, I'll
file the appropriate bug report. The current stable version appears to
be unaffected,

Regards,

Richard



[jira] Closed: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan closed DERBY-1808.
----------------------------------

    Assignee: Richard Wheeldon

Assigned issue to Richard.
Also took the liberty to close the issue.

> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: https://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Assignee: Richard Wheeldon
>            Priority: Minor
>             Fix For: 10.3.1.4
>
>         Attachments: rsw_functions1.patch, rsw_functions2.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1808?page=comments#action_12432293 ] 
            
Daniel John Debrunner commented on DERBY-1808:
----------------------------------------------

Thanks Richard, I'll review the patch, but as a quick note Derby already supports SQRTand ABS (also added in your patch).
I think all the others are new to Derby.

> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: http://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>         Attachments: rsw_functions1.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1808?page=all ]

Daniel John Debrunner updated DERBY-1808:
-----------------------------------------

    Description: 
Adds the following functions:

SIGN - 0, 1 or -1 for zero, positive or negative arguments
SQRT - Square root
RAND - Random number
RANDOM - as above
COSH - Hyperbolic Cosine
SINH - Hyperbolic Sine
TANH - Hyperbolic Tangent.


  was:

Adds the following functions:

SIGN - 0, 1 or -1 for zero, positive or negative arguments
SQRT - Square root
RAND - Random number
RANDOM - as above
COSH - Hyperbolic Cosine
SINH - Hyperbolic Sine
TANH - Hyperbolic Tangent.


     Derby Info:   (was: [Patch Available])

Committed revision 482426 - comitted the patch and modified the metadata and odbc_metadata master files which changed due to this test.

> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: http://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>         Attachments: rsw_functions1.patch, rsw_functions2.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1808?page=comments#action_12438477 ] 
            
Daniel John Debrunner commented on DERBY-1808:
----------------------------------------------

Some changes are needed to the patch:

- remove addition of SQRTand ABS, functions are already supported by Derby

- Only JDBC escape functions that are defined by the JDBC spec are supported by Derby. Derby does (should) not support arbitary functions through the {fn} escape mechanism. This means that only SIGN should be added into the set of escape functions. See the comment
for EmbedDatabaseMetaData.getNumericFunctions()

- Note the signature of the RAND function is good for a built-in function, but does not match the signature of the JDBC escape function that needs a integer parameter.

- I wonder if the SIGN function should return an INTEGER?

I appreciate the url references in the javadoc for the COSH  and other methods.


> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: http://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>         Attachments: rsw_functions1.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-1808?page=comments#action_12445930 ] 
            
Daniel John Debrunner commented on DERBY-1808:
----------------------------------------------

The patch looks good, though the diff to EmbedDatabaseMetaData is messed up but it was easy to fix.
I ran the metadata test which tests the escaped functions and it needed to have its master file updated so i assume no tests were run against this patch.
When I find time I'll run all the tests to see if any other master files need updating, or the contributor could do this.

> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: http://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>         Attachments: rsw_functions1.patch, rsw_functions2.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-1808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren resolved DERBY-1808.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.3.1.4

Marking fixed 10.3 and resolving. (patch went in on Dec 4, 2006 to trunk, which was 10.3 at the time).

Can't assign to Richard who contributed the patch as he's not listed as a developer in JIRA.

> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: https://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>             Fix For: 10.3.1.4
>
>         Attachments: rsw_functions1.patch, rsw_functions2.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-1808) [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH

Posted by "Richard Wheeldon (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-1808?page=all ]

Richard Wheeldon updated DERBY-1808:
------------------------------------

    Attachment: rsw_functions2.patch

Updated patch, fixing aforementioned issues and adding COT.


> [PATCH] Inbuilt functions SIGN, SQRT, RAND, RANDOM, COSH, SINH and TANH
> -----------------------------------------------------------------------
>
>                 Key: DERBY-1808
>                 URL: http://issues.apache.org/jira/browse/DERBY-1808
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Richard Wheeldon
>            Priority: Minor
>         Attachments: rsw_functions1.patch, rsw_functions2.patch
>
>
> Adds the following functions:
> SIGN - 0, 1 or -1 for zero, positive or negative arguments
> SQRT - Square root
> RAND - Random number
> RANDOM - as above
> COSH - Hyperbolic Cosine
> SINH - Hyperbolic Sine
> TANH - Hyperbolic Tangent.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira