ParquetMetadata 형식
ParquetMetadata 형식
ParquetMetadata 형식은 Parquet 파일 메타데이터를 읽기 위한 특수 형식이에요. 항상 하나의 행으로 num_columns, num_rows, num_row_groups, format_version, 그리고 각 컬럼·row group의 메타데이터 목록을 출력합니다.
출처: 문서
본문
설명 (Description)
Parquet 파일 메타데이터를 읽기 위한 특수 형식(https://parquet.apache.org/docs/file-format/metadata/)입니다. 항상 다음 구조/내용을 가진 행 하나를 출력합니다:
num_columns- 컬럼 수num_rows- 총 행 수num_row_groups- 총 row group 수format_version- parquet 형식 버전, 항상 1.0 또는 2.6total_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- 컬럼 청크 메타데이터에 컬럼 통계가 포함되어 있는지 나타내는 불리언 플래그statistics- 컬럼 청크 통계(have_statistics = false이면 모든 필드가 NULL)는 다음 구조를 갖습니다:num_values- 컬럼 청크의 non-null 값 수null_count- 컬럼 청크의 NULL 값 수distinct_count- 컬럼 청크의 고유 값 수min- 컬럼 청크의 최소값max- 컬럼 청크의 최대값
have_size_statistics- 컬럼 청크 메타데이터에 크기 통계가 포함되어 있는지 나타내는 불리언 플래그size_statistics- 컬럼 청크 크기 통계(have_size_statistics = false이면 모든 필드가 NULL 또는 비어 있음)는 다음 구조를 갖습니다:unencoded_byte_array_data_bytes- 푸터에 기록된 비인코딩 바이트 배열 값의 총 크기. 작성자가 기록하지 않았으면 NULLrepetition_level_histogram- 푸터에 기록된 각 반복 수준의 값 수. 작성자가 기록하지 않았으면 비어 있음definition_level_histogram- 푸터에 기록된 각 정의 수준의 값 수. 작성자가 기록하지 않았으면 비어 있음
사용 예시 (Example usage)
예시:
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"
}
}
]
},
...
]
}