[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-18 Thread Joshua McKenzie (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joshua McKenzie updated CASSANDRA-10840:

Reproduced In: 3.0.1, 2.2.4  (was: 2.2.4, 3.0.1)
 Reviewer: Benjamin Lerer

> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
> Fix For: 2.2.x, 3.0.x, 3.x
>
>
> {code}
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS $$
> Integer sum = 0; 
> for(Object k : state.keySet()) { 
> sum = sum + (Integer) state.get((Integer) k);
> }
> java.util.Map results = new java.util.HashMap Integer>();
> for(Object k : state.keySet()) {
> results.put((Integer) k, ((Integer) state.get((Integer) k))*100 / sum);
> }
> return results;
> $$;
> {code}
> {code}
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> {code}
> 1. View the aggregates
> {{select * from system.schema_aggregates;}}
> 2. Now update
> {code}
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND NULL
> {code}
> 3. View the aggregates
> {{select * from system.schema_aggregates;}}
> Expected result:
> * The update should have made initcond null
> Actual result:
> * The update did not touch INITCOND.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-10 Thread Robert Stupp (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Stupp updated CASSANDRA-10840:
-
Description: 
{code}
use simplex;
  CREATE FUNCTION state_group_and_sum(state map, star_rating int)
  CALLED ON NULL INPUT
  RETURNS map
  LANGUAGE java
  AS 'if (state.get(star_rating) == null) 
state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
state.get(star_rating)) + 1); return state;';
  CREATE FUNCTION percent_stars(state map)
  RETURNS NULL ON NULL INPUT
  RETURNS map
  LANGUAGE java AS $$
Integer sum = 0; 
for(Object k : state.keySet()) { 
sum = sum + (Integer) state.get((Integer) k);
}
java.util.Map results = new java.util.HashMap();
for(Object k : state.keySet()) {
results.put((Integer) k, ((Integer) state.get((Integer) k))*100 / sum);
}
return results;
$$;
{code}

{code}
CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND {}
{code}

1. View the aggregates
{{select * from system.schema_aggregates;}}

2. Now update
{code}
CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND NULL
{code}

3. View the aggregates
{{select * from system.schema_aggregates;}}

Expected result:
* The update should have made initcond null

Actual result:
* The update did not touch INITCOND.

  was:
{code}
use simplex;
  CREATE FUNCTION state_group_and_sum(state map, star_rating int)
  CALLED ON NULL INPUT
  RETURNS map
  LANGUAGE java
  AS 'if (state.get(star_rating) == null) 
state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
state.get(star_rating)) + 1); return state;';
  CREATE FUNCTION percent_stars(state map)
  RETURNS NULL ON NULL INPUT
  RETURNS map
  LANGUAGE java AS 'Integer sum = 0; for(Object k : 
state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
java.util.Map results = new java.util.HashMap(); for(Object k : state.keySet()) { results.put((Integer) k, 
((Integer) state.get((Integer) k))*100 / sum); } return results;';

CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND {}

# View the aggregates
select * from system.schema_aggregates;

# Now update
CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND NULL

# View the aggregates
select * from system.schema_aggregates;
{code}

Expected result:
* The update should have made initcond null

Actual result:
* The update did not touch INITCOND.


> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
> Fix For: 2.2.x, 3.0.x, 3.x
>
>
> {code}
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS $$
> Integer sum = 0; 
> for(Object k : state.keySet()) { 
> sum = sum + (Integer) state.get((Integer) k);
> }
> java.util.Map results = new java.util.HashMap Integer>();
> for(Object k : state.keySet()) {
> results.put((Integer) k, ((Integer) state.get((Integer) k))*100 / sum);
> }
> return results;
> $$;
> {code}
> {code}
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> {code}
> 1. View the aggregates
> {{select * from system.

[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-10 Thread Philip Thompson (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philip Thompson updated CASSANDRA-10840:

Reproduced In: 2.2.4

> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
> Fix For: 2.2.x, 3.0.x, 3.x
>
>
> {code}
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS 'Integer sum = 0; for(Object k : 
> state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
> java.util.Map results = new java.util.HashMap Integer>(); for(Object k : state.keySet()) { results.put((Integer) k, 
> ((Integer) state.get((Integer) k))*100 / sum); } return results;';
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> # View the aggregates
> select * from system.schema_aggregates;
> # Now update
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND NULL
> # View the aggregates
> select * from system.schema_aggregates;
> {code}
> Expected result:
> * The update should have made initcond null
> Actual result:
> * The update did not touch INITCOND.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-10 Thread Philip Thompson (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philip Thompson updated CASSANDRA-10840:

Fix Version/s: 3.x
   3.0.x
   2.2.x

> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
> Fix For: 2.2.x, 3.0.x, 3.x
>
>
> ```
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS 'Integer sum = 0; for(Object k : 
> state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
> java.util.Map results = new java.util.HashMap Integer>(); for(Object k : state.keySet()) { results.put((Integer) k, 
> ((Integer) state.get((Integer) k))*100 / sum); } return results;';
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> # View the aggregates
> select * from system.schema_aggregates;
> # Now update
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND NULL
> # View the aggregates
> select * from system.schema_aggregates;
> ```
> Expected result:
> * The update should have made initcond null
> Actual result:
> * The update did not touch INITCOND.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-10 Thread Philip Thompson (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philip Thompson updated CASSANDRA-10840:

Description: 
{code}
use simplex;
  CREATE FUNCTION state_group_and_sum(state map, star_rating int)
  CALLED ON NULL INPUT
  RETURNS map
  LANGUAGE java
  AS 'if (state.get(star_rating) == null) 
state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
state.get(star_rating)) + 1); return state;';
  CREATE FUNCTION percent_stars(state map)
  RETURNS NULL ON NULL INPUT
  RETURNS map
  LANGUAGE java AS 'Integer sum = 0; for(Object k : 
state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
java.util.Map results = new java.util.HashMap(); for(Object k : state.keySet()) { results.put((Integer) k, 
((Integer) state.get((Integer) k))*100 / sum); } return results;';

CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND {}

# View the aggregates
select * from system.schema_aggregates;

# Now update
CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND NULL

# View the aggregates
select * from system.schema_aggregates;
{code}

Expected result:
* The update should have made initcond null

Actual result:
* The update did not touch INITCOND.

  was:
```
use simplex;
  CREATE FUNCTION state_group_and_sum(state map, star_rating int)
  CALLED ON NULL INPUT
  RETURNS map
  LANGUAGE java
  AS 'if (state.get(star_rating) == null) 
state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
state.get(star_rating)) + 1); return state;';
  CREATE FUNCTION percent_stars(state map)
  RETURNS NULL ON NULL INPUT
  RETURNS map
  LANGUAGE java AS 'Integer sum = 0; for(Object k : 
state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
java.util.Map results = new java.util.HashMap(); for(Object k : state.keySet()) { results.put((Integer) k, 
((Integer) state.get((Integer) k))*100 / sum); } return results;';

CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND {}

# View the aggregates
select * from system.schema_aggregates;

# Now update
CREATE OR REPLACE AGGREGATE group_and_sum(int)
SFUNC state_group_and_sum
STYPE map
FINALFUNC percent_stars
INITCOND NULL

# View the aggregates
select * from system.schema_aggregates;
```

Expected result:
* The update should have made initcond null

Actual result:
* The update did not touch INITCOND.


> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
> Fix For: 2.2.x, 3.0.x, 3.x
>
>
> {code}
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS 'Integer sum = 0; for(Object k : 
> state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
> java.util.Map results = new java.util.HashMap Integer>(); for(Object k : state.keySet()) { results.put((Integer) k, 
> ((Integer) state.get((Integer) k))*100 / sum); } return results;';
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> # View the aggregates
> select * from system.schema_aggregates;
> # Now update
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> 

[jira] [Updated] (CASSANDRA-10840) Replacing an aggregate with a new version doesn't reset INITCOND

2015-12-10 Thread Robert Stupp (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-10840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Stupp updated CASSANDRA-10840:
-
Reviewer:   (was: Robert Stupp)

> Replacing an aggregate with a new version doesn't reset INITCOND
> 
>
> Key: CASSANDRA-10840
> URL: https://issues.apache.org/jira/browse/CASSANDRA-10840
> Project: Cassandra
>  Issue Type: Bug
>  Components: CQL
> Environment: Observed in Cassandra 2.2.4, though it might be an issue 
> in 3.0 as well
>Reporter: Sandeep Tamhankar
>Assignee: Robert Stupp
>
> ```
> use simplex;
>   CREATE FUNCTION state_group_and_sum(state map, star_rating 
> int)
>   CALLED ON NULL INPUT
>   RETURNS map
>   LANGUAGE java
>   AS 'if (state.get(star_rating) == null) 
> state.put(star_rating, 1); else state.put(star_rating, ((Integer) 
> state.get(star_rating)) + 1); return state;';
>   CREATE FUNCTION percent_stars(state map)
>   RETURNS NULL ON NULL INPUT
>   RETURNS map
>   LANGUAGE java AS 'Integer sum = 0; for(Object k : 
> state.keySet()) { sum = sum + (Integer) state.get((Integer) k); } 
> java.util.Map results = new java.util.HashMap Integer>(); for(Object k : state.keySet()) { results.put((Integer) k, 
> ((Integer) state.get((Integer) k))*100 / sum); } return results;';
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND {}
> # View the aggregates
> select * from system.schema_aggregates;
> # Now update
> CREATE OR REPLACE AGGREGATE group_and_sum(int)
> SFUNC state_group_and_sum
> STYPE map
> FINALFUNC percent_stars
> INITCOND NULL
> # View the aggregates
> select * from system.schema_aggregates;
> ```
> Expected result:
> * The update should have made initcond null
> Actual result:
> * The update did not touch INITCOND.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)