A big-endian data variable registers, then every query fails: Byte-swapped arrays not supported

オープン 初心者向け
#288 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
numpy, python
領域
backend, databases

調査の方向性

データブロックの値をArrow列に変換するコードから始めます。issueにはファイル名もテスト名も記載されていないため、その変換箇所を特定し、呼び出し元を読んでください。提供されたビッグエンディアンのDatasetとクエリで再現し、その後、近くにあるArrow変換のテストを確認します。バイトスワップされた値でクエリが成功し、マシンのバイト順になっている値でも引き続き動作すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

A Dataset whose data variable is big-endian, as a NetCDF file written on a big-endian machine, or some FITS or binary files, can be, registers without error, and then every query on it fails.

import numpy as np, xarray as xr, xarray_sql as xql

ds = xr.Dataset({"w": (("a",), np.zeros(3, ">f8"))}, coords={"a": np.arange(3)})
ctx = xql.Context()
ctx.from_dataset("t", ds)
ctx.sql("SELECT * FROM t").to_pandas()

On main:

DataFusion error: FFI error: Execution error: Error reading batch from stream: ArrowNotImplementedError: Byte-swapped arrays not supported

pyarrow can't make an array from a byte-swapped NumPy array. With #275, such a Dataset is read lazily, as on main, so it fails the same way.

Expected: the query works. One fix is to convert the values to the machine's byte order (values.astype(values.dtype.newbyteorder("="))) when making a block's Arrow column. That costs a copy, which an array in the machine's byte order doesn't need.

主要言語
Python
スター
142
フォーク
19
平均マージ
3日 47分
マージ済み PR(30日)
8

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

xqlsystems/xarray-sql のほかの issue

xqlsystems/xarray-sql の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。