You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Nadav Har'El (Jira)" <ji...@apache.org> on 2026/10/20 10:04:00 UTC
[jira] [Created] (CASSANDRA-21786) An aggregate keeps using its old state function after CREATE OR REPLACE FUNCTION
Nadav Har'El created CASSANDRA-21786:
----------------------------------------
Summary: An aggregate keeps using its old state function after CREATE OR REPLACE FUNCTION
Key: CASSANDRA-21786
URL: https://issues.apache.org/jira/browse/CASSANDRA-21786
Project: Apache Cassandra
Issue Type: Bug
Reporter: Nadav Har'El
When CREATE OR REPLACE FUNCTION replaces a function which is the state function (SFUNC) of a user-defined aggregate, the aggregate keeps calling the old version of the function - in unprepared statements, in previously prepared statements, and in newly prepared statements. Only the function itself, called directly, uses the new version.
Reproducer, tested on Cassandra 5.0.9 and 6.0-alpha2:
{code:java}
CREATE TABLE ks.t (p int PRIMARY KEY, v int);
INSERT INTO ks.t (p, v) VALUES (1, 3);
CREATE FUNCTION ks.sf(s int, a int) CALLED ON NULL INPUT RETURNS int LANGUAGE java AS 'return s + 1 * a;';
CREATE AGGREGATE ks.agg(int) SFUNC sf STYPE int INITCOND 0;
SELECT ks.agg(v) FROM ks.t; -- 3, as expected
CREATE OR REPLACE FUNCTION ks.sf(s int, a int) CALLED ON NULL INPUT RETURNS int LANGUAGE java AS 'return s + 2 * a;';
SELECT ks.agg(v) FROM ks.t; -- still 3, expected 6
{code}
The aggregate only picks up the new state function after it is itself re-created (or, maybe (I didn't test), after a restart).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org