////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: This transform allows you to do aggregations in memory such as sum,max,min,...

= image:transforms/icons/memorygroupby.svg[Memory Group By transform Icon, role="image-doc-icon"] Memory Group By

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Memory Group By transform builds aggregates in a group by fashion.

This transform processes all rows within memory and therefore does not require a sorted input.
However, it **does** require all data to fit into memory.

TIP: When the number of rows is too large to fit into memory, use a combination of xref:pipeline/transforms/sort.adoc[Sort Rows] and xref:pipeline/transforms/groupby.adoc[Group By] transforms.

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:check_mark.svg[Supported, 24]
!Flink! image:check_mark.svg[Supported, 24]
!Dataflow! image:check_mark.svg[Supported, 24]
!===
|===

== Options

[options="header"]
|===
|Option|Description
|Transform name|Name of the transform. This name has to be unique in a single pipeline,
|Always give back a result row|If you enable this option, the Group By transform will always give back a result row, even if there is no input row.

This can be useful if you want to count the number of rows. Without this option you would never get a count of zero (0).
|The fields that make up the group|Specify the fields over which you want to group. Click Get Fields to add all fields from the input stream(s).
|Aggregates|Specify the fields that must be aggregated, the method and the name of the resulting new field. Click Get lookup fields to add all fields from the input stream(s). Here are the available aggregation methods:

- Sum
- Average (Mean)
- Median
- Percentile
- Minimum
- Maximum
- Number of values (N)
- Concatenate strings separated by , (comma)
- First non-null value
- Last non-null value
- First value (including null)
- Last value (including null)
- Standard deviation
- Concatenate strings separated by <Value>: specify the separator in the Value column (This supports hexadecimals)
- Number of distinct values
- Number of rows (without field argument)
- Concatenate distinct values separated by <Value>: specify the separator in the Value column (This supports hexadecimals)

|===
