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

> HDFS에 있는 파일에서 테이블을 생성합니다. 이 테이블 함수는 url 및 file 테이블 함수와 유사합니다.

# hdfs 테이블 함수

export const CloudNotSupportedBadge = () => {
  return <div className="cloudNotSupportedBadge">
            <div className="cloudNotSupportedIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.5" d="M6.33366 12.6666L12.3739 12.6667C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00003 12.3739 8.00003C12.3739 8.00003 12.3337 7.66659 12.0003 7.33325M10.667 5.33322C8.00033 2.33325 4.45395 4.78537 4.14195 6.68203C2.55728 6.7627 1.29395 8.06203 1.29395 9.6667C1.29395 11.3234 2.66699 12.6666 4.00033 12.6666" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.5" d="M2.66699 14L12.0003 4.66663" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>

        </div>
            Not supported in ClickHouse Cloud
        </div>;
};

export const ExperimentalBadge = () => {
  return <div className="experimentalBadge">
            <div className="experimentalIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.25" d="M5.5 2H10.5" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.25" d="M9.50015 2V6.19625L13.4283 12.7425C13.4738 12.8183 13.4985 12.9049 13.4996 12.9934C13.5008 13.0818 13.4785 13.169 13.435 13.246C13.3914 13.323 13.3283 13.3871 13.2519 13.4317C13.1755 13.4764 13.0886 13.4999 13.0002 13.5H3.00015C2.91164 13.5 2.8247 13.4766 2.74822 13.432C2.67174 13.3874 2.60847 13.3233 2.56487 13.2463C2.52126 13.1693 2.49889 13.082 2.50004 12.9935C2.50119 12.905 2.52582 12.8184 2.5714 12.7425L6.50015 6.19625V2" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.25" d="M4.47656 9.56754C5.30344 9.41254 6.47656 9.47942 7.99969 10.25C10.0153 11.2707 11.4216 11.0569 12.2184 10.7282" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>
        </div>
            Experimental feature. <u><a href="/docs/beta-and-experimental-features#experimental-features">Learn more.</a></u>
        </div>;
};

HDFS에 있는 파일에서 테이블을 생성합니다. 이 테이블 함수는 [url](/ko/reference/functions/table-functions/url) 및 [file](/ko/reference/functions/table-functions/file) 테이블 함수와 유사합니다.

<div id="syntax">
  ## 구문
</div>

```sql theme={null}
hdfs(URI, format, structure)
```

<div id="arguments">
  ## 인수
</div>

| 인수          | 설명                                                                                                                                          |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `URI`       | HDFS에 있는 파일의 상대 URI입니다. 파일 경로에서는 읽기 전용 모드에서 다음 글롭 패턴을 지원합니다: `*`, `?`, `{abc,def}` 및 `{N..M}`. 여기서 `N`, `M`은 숫자이고 `'abc'`, `'def'`는 문자열입니다. |
| `format`    | 파일의 [포맷](/ko/reference/formats)입니다.                                                                                                         |
| `structure` | 테이블 구조입니다. 포맷은 `'column1_name column1_type, column2_name column2_type, ...'`입니다.                                                            |

<div id="returned_value">
  ## 반환 값
</div>

지정된 파일에서 데이터를 읽거나 쓰는 데 사용하는, 지정된 구조의 테이블입니다.

**예시**

`hdfs://hdfs1:9000/test`의 테이블과 여기서 처음 두 행을 선택하는 예시입니다:

```sql theme={null}
SELECT *
FROM hdfs('hdfs://hdfs1:9000/test', 'TSV', 'column1 UInt32, column2 UInt32, column3 UInt32')
LIMIT 2
```

```text theme={null}
┌─column1─┬─column2─┬─column3─┐
│       1 │       2 │       3 │
│       3 │       2 │       1 │
└─────────┴─────────┴─────────┘
```

<div id="globs_in_path">
  ## 경로의 글롭 패턴
</div>

경로에는 글롭 패턴을 사용할 수 있습니다. 파일은 접미사나 접두사만이 아니라 전체 경로 패턴과 일치해야 합니다.

* `*` — 빈 문자열을 포함하되 `/`를 제외한 임의 개수의 문자를 나타냅니다.
* `**` — 폴더 내부의 모든 파일을 하위 디렉터리까지 포함해 재귀적으로 나타냅니다.
* `?` — 임의의 단일 문자를 나타냅니다.
* `{some_string,another_string,yet_another_one}` — 문자열 `'some_string'`, `'another_string'`, `'yet_another_one'` 중 하나로 치환합니다. 문자열에는 `/` 기호가 포함될 수 있습니다.
* `{N..M}` — `>= N` 이고 `<= M` 인 임의의 숫자를 나타냅니다.

`{}`를 사용하는 구문은 [remote](/ko/reference/functions/table-functions/remote) 및 [file](/ko/reference/functions/table-functions/file) 테이블 함수와 비슷합니다.

**예시**

1. HDFS에 다음 URI를 가진 여러 파일이 있다고 가정합니다.

* 'hdfs\://hdfs1:9000/some\_dir/some\_file\_1'
* 'hdfs\://hdfs1:9000/some\_dir/some\_file\_2'
* 'hdfs\://hdfs1:9000/some\_dir/some\_file\_3'
* 'hdfs\://hdfs1:9000/another\_dir/some\_file\_1'
* 'hdfs\://hdfs1:9000/another\_dir/some\_file\_2'
* 'hdfs\://hdfs1:9000/another\_dir/some\_file\_3'

2. 이 파일들의 행 수를 조회합니다.

```sql theme={null}
SELECT count(*)
FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/some_file_{1..3}', 'TSV', 'name String, value UInt32')
```

3. 이 두 디렉터리 내 모든 파일의 행 수를 쿼리합니다:

```sql theme={null}
SELECT count(*)
FROM hdfs('hdfs://hdfs1:9000/{some,another}_dir/*', 'TSV', 'name String, value UInt32')
```

<Note>
  파일 목록에 앞자리가 0인 숫자 범위가 포함되어 있으면 각 자릿수별로 중괄호를 사용하는 구문을 사용하거나 `?`를 사용하십시오.
</Note>

**예시**

`file000`, `file001`, ... , `file999`와 같은 이름의 파일에서 데이터를 쿼리합니다:

```sql theme={null}
SELECT count(*)
FROM hdfs('hdfs://hdfs1:9000/big_dir/file{0..9}{0..9}{0..9}', 'CSV', 'name String, value UInt32')
```

<div id="virtual-columns">
  ## 가상 컬럼
</div>

* `_path` — 파일의 경로입니다. 유형: `LowCardinality(String)`.
* `_file` — 파일 이름입니다. 유형: `LowCardinality(String)`.
* `_size` — 파일 크기(바이트)입니다. 유형: `Nullable(UInt64)`. 크기를 알 수 없으면 값은 `NULL`입니다.
* `_time` — 파일의 마지막 수정 시각입니다. 유형: `Nullable(DateTime)`. 시간을 알 수 없으면 값은 `NULL`입니다.

<div id="hive-style-partitioning">
  ## `use_hive_partitioning` 설정
</div>

`use_hive_partitioning` 설정을 1로 지정하면 ClickHouse가 경로(`/name=value/`)에서 Hive 스타일 파티셔닝을 감지하고, 쿼리에서 파티션 컬럼을 가상 컬럼으로 사용할 수 있습니다. 이러한 가상 컬럼은 파티셔닝된 경로의 이름과 동일한 이름을 가집니다.

**예시**

Hive 스타일 파티셔닝으로 생성된 가상 컬럼 사용

```sql theme={null}
SELECT * FROM HDFS('hdfs://hdfs1:9000/data/path/date=*/country=*/code=*/*.parquet') WHERE date > '2020-01-01' AND country = 'Netherlands' AND code = 42;
```

<div id="storage-settings">
  ## 스토리지 설정
</div>

* [hdfs\_truncate\_on\_insert](/ko/reference/settings/session-settings#hdfs_truncate_on_insert) - 파일에 데이터를 삽입하기 전에 해당 파일을 비울 수 있도록 합니다. 기본적으로 비활성화되어 있습니다.
* [hdfs\_create\_new\_file\_on\_insert](/ko/reference/settings/session-settings#hdfs_create_new_file_on_insert) - 포맷에 접미사가 있는 경우, 삽입할 때마다 새 파일을 생성할 수 있도록 합니다. 기본적으로 비활성화되어 있습니다.
* [hdfs\_skip\_empty\_files](/ko/reference/settings/session-settings#hdfs_skip_empty_files) - 읽는 중에 빈 파일을 건너뛸 수 있도록 합니다. 기본적으로 비활성화되어 있습니다.

<div id="related">
  ## 관련
</div>

* [가상 컬럼](/ko/reference/engines/table-engines#table_engines-virtual_columns)
