Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

How to handle snappy files generated by Trino?

Đang mở
#140 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với bản tái hiện được cung cấp và traceback trong snappy/snappy_formats.py, đặc biệt là get_decompress_function và guess_format_by_header. So sánh hành vi giữa các phiên bản 0.7.0 và 0.7.1 bằng tệp do Trino tạo ra. Công việc được hoàn tất khi định dạng tệp được phát hiện và giải nén thành công mà không làm hồi quy đầu ra trước đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hello,

With the new release to 0.7.1 the I can't decompress CSV files generated by Trino, I think the issue is related with the Hadoop_snappy. Does anyone know how it can fixed?

from snappy import snappy_formats

csv_file = 'csv_67dba65a.snappy'

def read_file(file_path):
    return open(file_path, 'rb')

decompress_func, read_chunk  = snappy_formats.get_decompress_function(
    'auto',
    read_file(csv_file)
)
decompressed_stream = io.BytesIO()
# Decompress the data
decompress_func(
    read_file(csv_file),
    decompressed_stream,
    start_chunk=read_chunk
)
decompressed_stream.seek(0)

print(f"Compressed file: {read_file(csv_file).read()}")
print(f"DeCompressed file: {decompressed_stream.read()}")

This code has different outputs based on the version:

  • 0.7.0
    Compressed file: b'\x00\x00\x00\x04\x00\x00\x00\x06\x04\x0c"a"\n'
    DeCompressed file: b'"a"\n"a"\n'

  • 0.7.1

  .venv/lib/python3.12/site-packages/snappy/snappy_formats.py", line 64, in get_decompress_function
      decompress_func, read_chunk = guess_format_by_header(fin)

  .venv/lib/python3.12/site-packages/snappy/snappy_formats.py", line 59, in guess_format_by_header
      raise UncompressError("Can't detect archive format")
  snappy.snappy.UncompressError: Can't detect archive format

Ngôn ngữ chính
Python
Star
490
Fork
104
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của intake/python-snappy

Tất cả issue của intake/python-snappy

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.