> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# configurações de sessão aggregate_*

> Configurações de sessão do ClickHouse no grupo aggregate_* gerado.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["Versão", "Valor padrão", "Comentário"];
  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
  }}>
        Histórico de versões
      </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"
  }}>Padrão</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          Pode ser alterado sem reiniciar
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

Essas configurações estão disponíveis em [system.settings](/pt-BR/reference/system-tables/settings) e são geradas automaticamente a partir do [código-fonte](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp).

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

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

Formato da entrada de AggregateFunction durante operações de INSERT.

Possíveis valores:

* `state` — String binária com o estado serializado (padrão). Esse é o comportamento padrão, em que os valores de AggregateFunction são esperados como dados binários.
* `value` — O formato espera um único valor do argumento da aggregate function ou, no caso de múltiplos argumentos, uma tupla deles. Eles serão desserializados usando o IDataType ou DataTypeTuple correspondente e depois agregados para formar o estado.
* `array` — O formato espera um Array de valores, conforme descrito na opção `value` acima. Todos os elementos do array serão agregados para formar o estado.

**Exemplos**

Para uma tabela com a estrutura:

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

Com `aggregate_function_input_format = 'value'`:

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

Com `aggregate_function_input_format = 'array'`:

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

Nota: os formatos `value` e `array` são mais lentos do que o formato `state` padrão, pois exigem a criação e agregação de valores durante a inserção.

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

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

Ativa ou desativa a reescrita de todas as funções de agregação em uma consulta, adicionando o sufixo [-OrNull](/pt-BR/reference/functions/aggregate-functions/combinators#-ornull) a elas. Ative esta opção para compatibilidade com o padrão SQL.
Isso é implementado por meio da reescrita da consulta (semelhante à configuração [count\_distinct\_implementation](/pt-BR/reference/settings/session-settings/count-distinct#count_distinct_implementation)) para obter resultados consistentes em consultas distribuídas.

Possíveis valores:

* 0 — Desabilitado.
* 1 — Habilitado.

**Exemplo**

Considere a seguinte consulta com funções de agregação:

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

Com `aggregate_functions_null_for_empty = 0`, o resultado seria:

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

Com `aggregate_functions_null_for_empty = 1`, o resultado seria:

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