> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# hdfs_* 会话设置

> hdfs_* 自动生成分组中的 ClickHouse 会话设置。

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](/docs/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" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "在 HDFS 表引擎中，如果请求的文件不存在，则允许返回 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](/docs/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" />

<VersionHistory rows={[{"id": "row-1","items": [{"label": "24.6"},{"label": "0"},{"label": "允许在 ListObjects 请求无法在 HDFS 引擎中匹配到任何文件时抛出错误，而不是返回空查询结果"}]}]} />

如果根据 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` 查询会用新数据替换文件的现有内容。
