That's not how SQL works.
H2 is correctly instantiating one instance for each group of rows.

TH wrote:
> Good Day,
>
> I have defined a custom aggregate function class GroupConcatIntegers
> implementing the org.h2.api.AggregateFunction interface and registered
> it in my H2 database as follows
>
> CREATE AGGREGATE IF NOT EXISTS GROUP_CONCAT_INTEGERS FOR
> "data.sql.h2.GroupConcatIntegers"
>
> I then executed the following query:
>
> SELECT "DATA_ACCOUNT",
>              "DATA_GROUP",
>              GROUP_CONCAT_INTEGERS("DATA_ID"),
>              COUNT("DATA_ID"),
>              GROUP_CONCAT_INTEGERS("DATA_VIRT_START_ID",
> "DATA_VIRT_END_ID"),
>              SUM("DATA_QTY")
> FROM "DATA"
> WHERE  "DATA_ACCOUNT" IS NOT NULL
> GROUP BY "DATA_ACCOUNT", "DATA_GROUP"
> HAVING SUM("DATA_QTY") > 1
>
> Based on the documentation of AggregateFunction interface, H2 should
> create 2 instances of the GroupConcatIntegers class, then execute the
> init method once on each instance and then execute the add method on
> each instance for each row in the result set.
>
> However, based on the logging statements I placed in the constructor
> and init methods of the GroupConcatIntegers class, H2 is instantiating
> 2 new instances of the GroupConcatIntegers class for each row in the
> result set, which is resulting in a out of memory error for large
> "DATA" tables. I am using version 1.3.161.
>
> Can anyone tell me what I am doing wrong?
>
> Regards,
>
> TH
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to