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

# hdfs_* 会话设置

> hdfs_* 自动生成分组中的 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](/zh/reference/system-tables/settings) 中查看，并根据 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

<div id="hdfs_create_new_file_on_insert">
  ## hdfs\_create\_new\_file\_on\_insert
</div>

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

启用或禁用在 HDFS 引擎表 中每次 insert 时创建新文件的功能。如果启用，每次 insert 时都会创建一个新的 HDFS 文件，文件名类似以下 pattern：

初始：`data.Parquet.gz` -> `data.1.Parquet.gz` -> `data.2.Parquet.gz`，以此类推。

Possible values：

* 0 — `INSERT` 查询会将新数据追加到文件末尾。
* 1 — `INSERT` 查询会创建一个新文件。

<div id="hdfs_ignore_file_doesnt_exist">
  ## hdfs\_ignore\_file\_doesnt\_exist
</div>

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

读取某些键对应的文件时，如果文件不存在，则忽略其缺失。

Possible values:

* 1 — `SELECT` 返回空结果。
* 0 — `SELECT` 抛出异常。

<div id="hdfs_replication">
  ## hdfs\_replication
</div>

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

实际的副本数量可以在创建 HDFS 文件时指定。

<div id="hdfs_skip_empty_files">
  ## hdfs\_skip\_empty\_files
</div>

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

启用或禁用在 [HDFS](/zh/reference/engines/table-engines/integrations/hdfs) 引擎表中跳过空文件。

可能的值：

* 0 — 如果空文件与所请求的格式不兼容，`SELECT` 会抛出异常。
* 1 — 对于空文件，`SELECT` 返回空结果。

<div id="hdfs_throw_on_zero_files_match">
  ## hdfs\_throw\_on\_zero\_files\_match
</div>

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

如果根据 glob 展开规则未匹配到任何文件，则抛出错误。

可能的值：

* 1 — `SELECT` 抛出异常。
* 0 — `SELECT` 返回空结果。

<div id="hdfs_truncate_on_insert">
  ## hdfs\_truncate\_on\_insert
</div>

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

启用或禁用在 HDFS 引擎表中执行插入前的截断操作。如果禁用，当 HDFS 中的文件已存在时，尝试插入会抛出异常。

可能的值：

* 0 — `INSERT` 查询会将新数据追加到文件末尾。
* 1 — `INSERT` 查询会用新数据替换文件的现有内容。
