> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-parallel-read-in-order-multi-part.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ajustes de sesión de aggregate_*

> Ajustes de sesión de ClickHouse en el grupo aggregate_* generado.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["Versión", "Valor predeterminado", "Comentario"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        Historial de versiones
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>Tipo</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>Predeterminado</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Modificable sin reiniciar
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

Estos ajustes están disponibles en [system.settings](/es/reference/system-tables/settings) y se generan automáticamente a partir del [código fuente](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

<h2 id="aggregate_function_input_format">
  aggregate\_function\_input\_format
</h2>

<SettingsInfoBlock type="AggregateFunctionInputFormat" default_value="state" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "25.12"},{"label": "state"},{"label": "Nueva configuración para controlar el formato de entrada de AggregateFunction durante las operaciones INSERT. El valor de la configuración es state de forma predeterminada"}]}]} />

Cómo leen los formatos de entrada las columnas de tipo `AggregateFunction`.

Valores posibles:

* `state` — el estado serializado de la función de agregación, tal como lo escriben los formatos de salida (valor predeterminado).
* `value` — un valor del argumento de la función de agregación, o una tupla de los argumentos si hay varios. El valor se agrega para formar el estado.
* `array` — un array de valores, tal como se describe en la opción `value` anterior. Todos los elementos del array se agregan para formar el estado.

En los modos `value` y `array`, el formato lee la columna como si tuviera el tipo de los valores: `T` para `AggregateFunction(f, T)`, `Tuple(T1, T2)` para `AggregateFunction(f, T1, T2)`, o un `Array` de ese tipo en el modo `array`. Los valores se escriben con la representación que el formato emplea para ese tipo: un número o una cadena en un formato de texto, un array JSON en los formatos JSON, la codificación binaria del tipo en `RowBinary` o `Native`, una columna de ese tipo en `Parquet`, etc. Esto se aplica a todos los formatos de entrada, y también a `AggregateFunction` anidado en `Array`, `Tuple` o `Map`.

**Ejemplos**

Para una tabla con la estructura:

```sql theme={null}
CREATE TABLE example (
    user_id UInt64,
    avg_session_length AggregateFunction(avg, UInt32)
);
```

Con `aggregate_function_input_format = 'value'`:

```sql theme={null}
INSERT INTO example FORMAT CSV
123,456
```

```sql theme={null}
INSERT INTO example FORMAT JSONEachRow
{"user_id": 123, "avg_session_length": 456}
```

Con `aggregate_function_input_format = 'array'`:

```sql theme={null}
INSERT INTO example FORMAT CSV
123,"[456,789,101]"
```

```sql theme={null}
INSERT INTO example FORMAT JSONEachRow
{"user_id": 123, "avg_session_length": [456, 789, 101]}
```

Nota: los formatos `value` y `array` son más lentos que el formato predeterminado `state`, ya que requieren crear y agregar valores durante la inserción.

<h2 id="aggregate_functions_null_for_empty">
  aggregate\_functions\_null\_for\_empty
</h2>

<SettingsInfoBlock type="Bool" default_value="0" />

Activa o desactiva la reescritura de todas las funciones de agregación de una consulta, añadiéndoles el sufijo [-OrNull](/es/reference/functions/aggregate-functions/combinators#-ornull). Actívelo para garantizar la compatibilidad con el estándar SQL.
Se implementa mediante la reescritura de consultas (de forma similar a la configuración [count\_distinct\_implementation](/es/reference/settings/session-settings/count-distinct#count_distinct_implementation)) para obtener resultados coherentes en las consultas distribuidas.

Valores posibles:

* 0 — Deshabilitado.
* 1 — Habilitado.

**Ejemplo**

Considere la siguiente consulta con funciones de agregación:

```sql theme={null}
SELECT SUM(-1), MAX(0) FROM system.one WHERE 0;
```

Con `aggregate_functions_null_for_empty = 0` se obtendría:

```text theme={null}
┌─SUM(-1)─┬─MAX(0)─┐
│       0 │      0 │
└─────────┴────────┘
```

Con `aggregate_functions_null_for_empty = 1`, el resultado sería:

```text theme={null}
┌─SUMOrNull(-1)─┬─MAXOrNull(0)─┐
│          NULL │         NULL │
└───────────────┴──────────────┘
```
