> ## 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.

# aggregate_* 세션 설정

> aggregate_* 생성 그룹에 속한 ClickHouse 세션 설정입니다.

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["버전", "기본값", "설명"];
  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
  }}>
        버전 이력
      </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
  }}>유형</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>기본값</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          재시작 없이 변경 가능
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

이 설정은 [system.settings](/ko/reference/system-tables/settings)에서 확인할 수 있으며 [소스 코드](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" />

INSERT 작업에서 AggregateFunction 입력에 사용할 포맷입니다.

가능한 값:

* `state` — 직렬화된 상태를 담은 바이너리 문자열입니다(기본값). AggregateFunction 값이 바이너리 데이터로 제공된다고 가정하는 기본 동작입니다.
* `value` — 집계 함수 인수의 단일 값을 받는 포맷이며, 인수가 여러 개인 경우에는 그 인수들로 이루어진 튜플을 받습니다. 이 값들은 해당 IDataType 또는 DataTypeTuple을 사용해 역직렬화된 후 집계되어 상태를 형성합니다.
* `array` — 위의 `value` 옵션에서 설명한 값들의 배열을 받는 포맷입니다. 배열의 모든 원소는 집계되어 상태를 형성합니다.

**예시**

다음과 같은 구조의 테이블이 있다고 가정합니다:

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

`aggregate_function_input_format = 'value'`로 설정한 경우:

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

`aggregate_function_input_format = 'array'`로 설정한 경우:

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

참고: `value` 및 `array` 포맷은 삽입 시 값을 생성하고 집계해야 하므로 기본 `state` 포맷보다 느립니다.

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

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

쿼리의 모든 집계 함수에 [-OrNull](/ko/reference/functions/aggregate-functions/combinators#-ornull) 접미사를 추가하도록 재작성하는 기능을 활성화하거나 비활성화합니다. SQL 표준 호환성을 위해 이 설정을 활성화하세요.
이 기능은 일관된 결과를 얻기 위해 쿼리 재작성([count\_distinct\_implementation](/ko/reference/settings/session-settings/count-distinct#count_distinct_implementation) 설정과 유사함) 방식으로 구현되며, 특히 분산 쿼리에서 유용합니다.

가능한 값:

* 0 — 비활성화됨.
* 1 — 활성화됨.

**예시**

다음 집계 함수가 포함된 쿼리를 살펴보겠습니다:

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

`aggregate_functions_null_for_empty = 0`으로 설정하면 다음과 같은 결과가 나옵니다:

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

`aggregate_functions_null_for_empty = 1`로 설정하면 결과는 다음과 같습니다:

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