[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-06 Thread Bryan Pendleton (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16811632#comment-16811632
 ] 

Bryan Pendleton commented on DERBY-7041:


Thanks Manuel for reporting this bug and for the clear reproduction case.

And thanks Rick for fixing it.

An interesting bug, and it had been in the code for a while, so I'm glad we 
have resolved it.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Assignee: Rick Hillegas
>Priority: Major
> Fix For: 10.15.1.4
>
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-05 Thread Manuel Rossetti (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16811218#comment-16811218
 ] 

Manuel Rossetti commented on DERBY-7041:


I understand. I will wait and get it when I upgrade to 10.15.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-02 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16808221#comment-16808221
 ] 

Rick Hillegas commented on DERBY-7041:
--

I can port the patch to the 10.14 branch if that helps you. But you are 
correct, I have no plans to manage a 10.14.2 release at this time.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-02 Thread Manuel Rossetti (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807939#comment-16807939
 ] 

Manuel Rossetti commented on DERBY-7041:


It looks like your plan is to put this patch in 10.15 and not patch 10.14.2. Is 
that correct?

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-02 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16807756#comment-16807756
 ] 

ASF subversion and git services commented on DERBY-7041:


Commit 1856824 from Richard N. Hillegas in branch 'code/branches/10.15'
[ https://svn.apache.org/r1856824 ]

DERBY-7041: Port 1856730 from trunk to the 10.15 branch.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-01 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16806748#comment-16806748
 ] 

ASF subversion and git services commented on DERBY-7041:


Commit 1856730 from Richard N. Hillegas in branch 'code/trunk'
[ https://svn.apache.org/r1856730 ]

DERBY-7041: Do not create persistent dependencies between views and the 
system-supplied statistical aggregates; commit 
derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-04-01 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16806745#comment-16806745
 ] 

Rick Hillegas commented on DERBY-7041:
--

Tests passed cleanly for me on 
derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, modulo the usual 
diffs I see in NetworkServerControlClientCommandTest and 
InvalidLDAPServerAuthenticationTest.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-31 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16806302#comment-16806302
 ] 

Rick Hillegas commented on DERBY-7041:
--

Attaching derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff. This 
patch makes view creation skip dependency registration between views and 
system-supplied aggregates.

I will run the full test suite.

Touches the following files:

{noformat}
---

M   
java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/AggregateNode.java

Don't create a persistent dependency from a view to a user-defined
aggregate which is really a system-supplied aggregate implemented via
the user-defined aggregate machinery.

---

M   
java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/lang/AggBuiltinTest.java

Add a test case verifying that the NPE has disappeared.
{noformat}


> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041-01-aa-omitDependencyOnSystemSuppliedAggregate.diff, derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-31 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16806301#comment-16806301
 ] 

Rick Hillegas commented on DERBY-7041:
--

No NPE occurs when I substitute a user-defined aggregate for the STDDEV_SAMP. 
So the object ID is disappearing only for the statistical aggregates as far as 
I can see.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-31 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16806178#comment-16806178
 ] 

Rick Hillegas commented on DERBY-7041:
--

The stack trace shows that the CREATE VIEW statement incurs an NPE while trying 
to record a persistent dependency of the view on the STDDEV_SAMP aggregate:

{noformat}
java.lang.NullPointerException
at java.base/java.util.Hashtable.put(Hashtable.java:479)
at 
org.apache.derby.iapi.sql.depend.ProviderList.addProvider(ProviderList.java:42)
at 
org.apache.derby.impl.sql.compile.CompilerContextImpl.addProviderToAuxiliaryList(CompilerContextImpl.java:319)
at 
org.apache.derby.impl.sql.compile.CompilerContextImpl.createDependency(CompilerContextImpl.java:290)
at 
org.apache.derby.impl.sql.compile.AggregateNode.bindExpression(AggregateNode.java:404)
at 
org.apache.derby.impl.sql.compile.JavaToSQLValueNode.bindExpression(JavaToSQLValueNode.java:237)
at 
org.apache.derby.impl.sql.compile.ResultColumn.bindExpression(ResultColumn.java:759)
at 
org.apache.derby.impl.sql.compile.ResultColumnList.bindExpressions(ResultColumnList.java:839)
at 
org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:575)
at 
org.apache.derby.impl.sql.compile.CreateViewNode.bindViewDefinition(CreateViewNode.java:255)
at 
org.apache.derby.impl.sql.compile.CreateViewNode.bindStatement(CreateViewNode.java:175)
at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:401)
at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:99)
at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1114)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:689)
at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:637)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:372)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:534)
at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:375)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:251)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
at org.apache.derby.tools.ij.main(ij.java:59)
{noformat}

This happens because we implemented the statistical aggregates as user defined 
aggregates and because the aggregate descriptor has a NULL object ID.

Two things look odd here and could serve as the basis for a fix:

* There should be no need to declare a persistent dependency between a 
user-defined view and a system-supplied aggregate.
* The aggregate descriptor, nonetheless, should have a real object ID.


> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN 

[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-30 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16805881#comment-16805881
 ] 

Rick Hillegas commented on DERBY-7041:
--

Attaching derby-7041.sql, a simpler script for the problem.

> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb.sql, JSLDb_DriveThroughPharmacy.zip, 
> derby-7041.sql
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-29 Thread Manuel Rossetti (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16805027#comment-16805027
 ] 

Manuel Rossetti commented on DERBY-7041:


Okay. I see your note about the schema name. I didn't qualify the name with
the schema in my commented code.  My bad. Do you want me to attach the
script here or to the JIRO?



On Fri, Mar 29, 2019 at 9:14 AM Manuel Rossetti 



> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb_DriveThroughPharmacy.zip
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-29 Thread Manuel Rossetti (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16805013#comment-16805013
 ] 

Manuel Rossetti commented on DERBY-7041:


I just ran the script using ij. It worked.  So, I am not sure how to help
you.

$ ij

ij version 10.14

ij> connect 'jdbc:derby:db;create=true';

ij> run 'JSLDb.sql';

On Fri, Mar 29, 2019 at 9:04 AM Manuel Rossetti 



> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb_DriveThroughPharmacy.zip
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-29 Thread Manuel Rossetti (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16805008#comment-16805008
 ] 

Manuel Rossetti commented on DERBY-7041:


The script works.  I simply establish a connection in some tool like
IntelliJ or DBeaver and execute the script.  I haven't run the ij command
prompt in ages and I don't know why a script that works perfectly well for
other tools would not work within the ij prompt.

On Thu, Mar 28, 2019 at 6:21 PM Rick Hillegas (JIRA) 



> null pointer exception when creating view based on other views
> --
>
> Key: DERBY-7041
> URL: https://issues.apache.org/jira/browse/DERBY-7041
> Project: Derby
>  Issue Type: Bug
>  Components: SQL
>Affects Versions: 10.14.2.0
> Environment: max os x , intellij
>Reporter: Manuel Rossetti
>Priority: Major
> Attachments: JSLDb.sql, JSLDb_DriveThroughPharmacy.zip
>
>
> I can execute a SELECT query that works but when I try to create a view on 
> that select query, I simply get a java null pointer exception with no 
> details.  I have tested the same statements on a postgres database and they 
> worked without error.
> Below, the PW_DIFF_WITHIN_REP_VIEW create does work, but the 
> PW_DIFF_AR_REP_VIEW does not.  Again, the SELECT clause of 
> PW_DIFF_AR_REP_VIEW will work, but when used within the create clause the 
> error occurs.
> I have attached the entire database creation script and an embedded instance 
> that can be used for testing. It has data.
>  
> -- WITHIN_REP_VIEW combines the WITHIN_REP_COUNTER_VIEW and 
> WITHIN_REP_RESPONSE_VIEW into one table from which across
> -- replication or other statistical summaries by replication can be produced
> CREATE VIEW JSL_DB.WITHIN_REP_VIEW (SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, VALUE) AS
>  (SELECT JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, AVERAGE AS VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_STAT.ELEMENT_ID_FK
> UNION
> SELECT JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK, EXP_NAME, ELEMENT_NAME, 
> STAT_NAME, REP_NUM, LAST_VALUE as VALUE
> FROM (JSL_DB.SIMULATION_RUN JOIN JSL_DB.WITHIN_REP_COUNTER_STAT on 
> JSL_DB.SIMULATION_RUN.ID = JSL_DB.WITHIN_REP_COUNTER_STAT.SIM_RUN_ID_FK)
>  JOIN JSL_DB.MODEL_ELEMENT ON ELEMENT_ID = 
> JSL_DB.WITHIN_REP_COUNTER_STAT.ELEMENT_ID_FK); 
>  
> -- PW_DIFF_WITHIN_REP_VIEW computes the pairwise differences across 
> difference simulation experiments
> -- doesn't work for derby, 3-28-2019, works for postgres
> -- 
> -- create view JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- as (select SIMULATION_RUN.SIM_NAME, A.SIM_RUN_ID_FK AS A_SIM_NUM, 
> A.STAT_NAME, A.EXP_NAME as A_EXP_NAME, A.REP_NUM, A.VALUE as A_VALUE,
> -- B.SIM_RUN_ID_FK as B_SIM_NUM, B.EXP_NAME as B_EXP_NAME, B.VALUE as B_VALUE,
> -- '(' || A.EXP_NAME || ' - ' || B.EXP_NAME || ')' as DIFF_NAME, (A.VALUE - 
> B.VALUE) as A_MINUS_B
> -- from JSL_DB.WITHIN_REP_VIEW as A, JSL_DB.WITHIN_REP_VIEW as B, 
> JSL_DB.SIMULATION_RUN
> -- where A.SIM_RUN_ID_FK = JSL_DB.SIMULATION_RUN.ID
> -- and A.STAT_NAME = B.STAT_NAME
> -- and A.REP_NUM = B.REP_NUM
> -- and A.SIM_RUN_ID_FK > B.SIM_RUN_ID_FK
> -- and A.ELEMENT_NAME = B.ELEMENT_NAME);
> --
> -- create view JSL_DB.PW_DIFF_AR_REP_VIEW (SIM_NAME, STAT_NAME, A_EXP_NAME, 
> B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A,
> -- AVG_B, STD_DEV_B, AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
> -- as (select SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, 
> AVG(A_VALUE) as AVG_A, STDDEV_SAMP(A_VALUE) as STD_DEV_A,
> -- AVG(B_VALUE) as AVG_B, STDDEV_SAMP(B_VALUE) as STD_DEV_B,
> -- AVG(A_MINUS_B) as AVG_DIFF_A_MINUS_B, STDDEV_SAMP(A_MINUS_B) as 
> STD_DEV_DIFF_A_MINUS_B,
> -- COUNT(A_MINUS_B) as STAT_COUNT
> -- from JSL_DB.PW_DIFF_WITHIN_REP_VIEW
> -- group by SIM_NAME, STAT_NAME, A_EXP_NAME, B_EXP_NAME, DIFF_NAME);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DERBY-7041) null pointer exception when creating view based on other views

2019-03-28 Thread Rick Hillegas (JIRA)


[ 
https://issues.apache.org/jira/browse/DERBY-7041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16804427#comment-16804427
 ] 

Rick Hillegas commented on DERBY-7041:
--

I'm afraid that the attached script raises other compile-time errors for me and 
it does not fail on an NPE. Here is the output from running the script as 
provided with the problem CREATE statement uncommented:

{noformat}
ij> connect 'jdbc:derby:db;create=true';
WARNING 01J01: Database 'db' not created, connection made to existing database 
instead.
ij> CREATE SCHEMA JSL_DB;
0 rows inserted/updated/deleted
ij> -- SIMULATION_RUN captures the execution of a simulation experiment and its 
related options
CREATE TABLE JSL_DB.SIMULATION_RUN (
ID INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START 
WITH 1 INCREMENT BY 1),
SIM_NAME VARCHAR(510) NOT NULL,
MODEL_NAME VARCHAR(510) NOT NULL,
EXP_NAME VARCHAR(510) NOT NULL,
EXP_START_TIME_STAMP TIMESTAMP,
EXP_END_TIME_STAMP TIMESTAMP,
NUM_REPS INTEGER NOT NULL CHECK (NUM_REPS >=1),
LAST_REP INTEGER, 
LENGTH_OF_REP DOUBLE PRECISION, 
LENGTH_OF_WARM_UP DOUBLE PRECISION,
HAS_MORE_REPS BOOLEAN,
REP_ALLOWED_EXEC_TIME BIGINT,
REP_INIT_OPTION BOOLEAN,
RESET_START_STREAM_OPTION BOOLEAN,
ANTITHETIC_OPTION BOOLEAN,
ADV_NEXT_SUB_STREAM_OPTION BOOLEAN,
NUM_STREAM_ADVANCES INTEGER
);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.SIMULATION_RUN
  ADD CONSTRAINT SR_NAME_EXP_UNIQUE UNIQUE (SIM_NAME, EXP_NAME);
0 rows inserted/updated/deleted
ij> -- MODEL_ELEMENT represents the model element hierarchy associated with 
various 
-- simulation runs, i.e. the model elements in the model and their parent/child
-- relationship.  LEFT_COUNT and RIGHT_COUNT uses Joe Celko's SQL for Smarties
-- Advanced SQL Programming Chapter 36 to implement the nested set model for
-- the hierarchy. This allows statistics associated with hierarchical 
aggregations
-- and subtrees of the model element hierarchy to be more easily queried.
CREATE TABLE JSL_DB.MODEL_ELEMENT (
SIM_RUN_ID_FK INTEGER NOT NULL,
ELEMENT_ID INTEGER NOT NULL,
ELEMENT_NAME VARCHAR(510) NOT NULL,
CLASS_NAME VARCHAR(510) NOT NULL,
PARENT_ID_FK INTEGER,
PARENT_NAME VARCHAR(510),
LEFT_COUNT INTEGER NOT NULL CHECK (LEFT_COUNT > 0),
RIGHT_COUNT INTEGER NOT NULL CHECK (RIGHT_COUNT > 1),
CONSTRAINT TRAVERSAL_ORDER_OKAY CHECK (LEFT_COUNT < RIGHT_COUNT)
);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.MODEL_ELEMENT
  ADD CONSTRAINT ME_PRIM_KY PRIMARY KEY (SIM_RUN_ID_FK, ELEMENT_ID);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.MODEL_ELEMENT
  ADD CONSTRAINT ME_NAME_UNIQUE UNIQUE (SIM_RUN_ID_FK, ELEMENT_NAME);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.MODEL_ELEMENT
ADD CONSTRAINT ME_SIMRUN_FK FOREIGN KEY (SIM_RUN_ID_FK) REFERENCES 
JSL_DB.SIMULATION_RUN (ID) ON DELETE CASCADE;
0 rows inserted/updated/deleted
ij> CREATE INDEX ME_SIMRUN_FK_INDEX ON JSL_DB.MODEL_ELEMENT(SIM_RUN_ID_FK);
0 rows inserted/updated/deleted
WARNING 01504: 'ME_SIMRUN_FK_INDEX' index not created because it is a duplicate 
of an existing index: 'SQL07-a666c073-0169-c691-93ab-07295718'.
ij> -- WITHIN_REP_STAT represents within replication statistics for each 
replication of
-- each simulation for each response
CREATE TABLE JSL_DB.WITHIN_REP_STAT (
ID INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START 
WITH 1 INCREMENT BY 1),
ELEMENT_ID_FK INTEGER NOT NULL,
SIM_RUN_ID_FK INTEGER NOT NULL,
REP_NUM INTEGER NOT NULL CHECK (REP_NUM >=1),
STAT_NAME VARCHAR(510),
STAT_COUNT DOUBLE PRECISION CHECK (STAT_COUNT >=0),
AVERAGE  DOUBLE PRECISION,
MINIMUM  DOUBLE PRECISION,
MAXIMUM  DOUBLE PRECISION,
WEIGHTED_SUM  DOUBLE PRECISION,
SUM_OF_WEIGHTS  DOUBLE PRECISION,
WEIGHTED_SSQ DOUBLE PRECISION,
LAST_VALUE DOUBLE PRECISION,
LAST_WEIGHT DOUBLE PRECISION
);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.WITHIN_REP_STAT 
ADD CONSTRAINT WRS_SIMRUN_FK FOREIGN KEY (SIM_RUN_ID_FK) REFERENCES 
JSL_DB.SIMULATION_RUN (ID) ON DELETE CASCADE;
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.WITHIN_REP_STAT
  ADD CONSTRAINT WRS_UNIQUE_ELEMENT_SIMRUN_REPNUM UNIQUE (ELEMENT_ID_FK, 
SIM_RUN_ID_FK, REP_NUM);
0 rows inserted/updated/deleted
ij> ALTER TABLE JSL_DB.WITHIN_REP_STAT
  ADD CONSTRAINT WRS_MODEL_ELEMENT_FK FOREIGN KEY (SIM_RUN_ID_FK, ELEMENT_ID_FK)
  REFERENCES JSL_DB.MODEL_ELEMENT (SIM_RUN_ID_FK, ELEMENT_ID) ON DELETE CASCADE;
0 rows inserted/updated/deleted
ij> CREATE INDEX WRS_ME_FK_INDEX ON JSL_DB.WITHIN_REP_STAT(SIM_RUN_ID_FK, 
ELEMENT_ID_FK);
0 rows inserted/updated/deleted
WARNING 01504: 'WRS_ME_FK_INDEX' index not created because