메인 콘텐츠로 건너뛰기

설명

Parquet 파일 메타데이터(https://parquet.apache.org/docs/file-format/metadata/)를 읽기 위한 특수 포맷입니다. 항상 다음 구조/내용을 가진 1개의 행을 출력합니다.
  • num_columns - 컬럼 수
  • “num_rows` - 전체 행 수
  • num_row_groups - 전체 row group 수
  • format_version - Parquet 포맷 버전으로, 항상 1.0 또는 2.6입니다
  • total_uncompressed_size - 데이터의 전체 비압축 바이트 크기이며, 모든 row group의 total_byte_size 합계로 계산됩니다
  • total_compressed_size - 데이터의 전체 압축 바이트 크기이며, 모든 row group의 total_compressed_size 합계로 계산됩니다
  • columns - 다음 구조를 가진 컬럼 메타데이터 목록:
    • name - 컬럼 이름
    • path - 컬럼 경로(중첩 컬럼에서는 name과 다름)
    • max_definition_level - 최대 정의 레벨
    • max_repetition_level - 최대 반복 레벨
    • physical_type - 컬럼의 물리적 유형
    • logical_type - 컬럼의 논리적 유형
    • compression - 이 컬럼에 사용된 압축 방식
    • total_uncompressed_size - 컬럼의 전체 비압축 바이트 크기이며, 모든 row group에서 해당 컬럼의 total_uncompressed_size 합계로 계산됩니다
    • total_compressed_size - 컬럼의 전체 압축 바이트 크기이며, 모든 row group에서 해당 컬럼의 total_compressed_size 합계로 계산됩니다
    • space_saved - 압축으로 절약된 공간의 백분율이며, (1 - total_compressed_size/total_uncompressed_size)로 계산됩니다
    • encodings - 이 컬럼에 사용된 인코딩 목록
  • row_groups - 다음 구조를 가진 row group 메타데이터 목록:
    • num_columns - row group의 컬럼 수
    • num_rows - row group의 행 수
    • total_uncompressed_size - row group의 전체 비압축 바이트 크기
    • total_compressed_size - row group의 전체 압축 바이트 크기
    • columns - 다음 구조를 가진 컬럼 청크 메타데이터 목록:
      • name - 컬럼 이름
      • path - 컬럼 경로
      • total_compressed_size - 컬럼의 전체 압축 바이트 크기
      • total_uncompressed_size - row group의 전체 비압축 바이트 크기
      • have_statistics - 컬럼 청크 메타데이터에 컬럼 통계(column statistics)가 포함되어 있는지 나타내는 불리언 플래그
      • statistics - 컬럼 청크 통계(have_statistics = false이면 모든 필드는 NULL)이며, 다음 구조를 가집니다:
        • num_values - 컬럼 청크의 non-null 값 수
        • null_count - 컬럼 청크의 NULL 값 수
        • distinct_count - 컬럼 청크의 고유값 수
        • min - 컬럼 청크의 최솟값
        • max - 컬럼 청크의 최댓값

사용 예시

예시:
SELECT * 
FROM file(data.parquet, ParquetMetadata) 
FORMAT PrettyJSONEachRow
{
    "num_columns": "2",
    "num_rows": "100000",
    "num_row_groups": "2",
    "format_version": "2.6",
    "metadata_size": "577",
    "total_uncompressed_size": "282436",
    "total_compressed_size": "26633",
    "columns": [
        {
            "name": "number",
            "path": "number",
            "max_definition_level": "0",
            "max_repetition_level": "0",
            "physical_type": "INT32",
            "logical_type": "Int(bitWidth=16, isSigned=false)",
            "compression": "LZ4",
            "total_uncompressed_size": "133321",
            "total_compressed_size": "13293",
            "space_saved": "90.03%",
            "encodings": [
                "RLE_DICTIONARY",
                "PLAIN",
                "RLE"
            ]
        },
        {
            "name": "concat('Hello', toString(modulo(number, 1000)))",
            "path": "concat('Hello', toString(modulo(number, 1000)))",
            "max_definition_level": "0",
            "max_repetition_level": "0",
            "physical_type": "BYTE_ARRAY",
            "logical_type": "None",
            "compression": "LZ4",
            "total_uncompressed_size": "149115",
            "total_compressed_size": "13340",
            "space_saved": "91.05%",
            "encodings": [
                "RLE_DICTIONARY",
                "PLAIN",
                "RLE"
            ]
        }
    ],
    "row_groups": [
        {
            "num_columns": "2",
            "num_rows": "65409",
            "total_uncompressed_size": "179809",
            "total_compressed_size": "14163",
            "columns": [
                {
                    "name": "number",
                    "path": "number",
                    "total_compressed_size": "7070",
                    "total_uncompressed_size": "85956",
                    "have_statistics": true,
                    "statistics": {
                        "num_values": "65409",
                        "null_count": "0",
                        "distinct_count": null,
                        "min": "0",
                        "max": "999"
                    }
                },
                {
                    "name": "concat('Hello', toString(modulo(number, 1000)))",
                    "path": "concat('Hello', toString(modulo(number, 1000)))",
                    "total_compressed_size": "7093",
                    "total_uncompressed_size": "93853",
                    "have_statistics": true,
                    "statistics": {
                        "num_values": "65409",
                        "null_count": "0",
                        "distinct_count": null,
                        "min": "Hello0",
                        "max": "Hello999"
                    }
                }
            ]
        },
        ...
    ]
}
마지막 수정일 2026년 6월 10일