The IPC stream reader accepts a second Schema message: a dictionary column reads as its indices [0, 1, 0], with no error
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 77/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- data
Hướng nghiên cứu
Bắt đầu với RecordBatchStreamReaderImpl.next() trong src/ipc/reader.ts, nơi issue cho biết mỗi thông điệp Schema đều gọi reset(). Theo dõi cách reader xử lý các thông điệp trong luồng và tìm các bài kiểm thử IPC reader hiện có bao quát thông điệp Schema và Dictionary. Công việc hoàn tất khi một thông điệp Schema xuất hiện sau khi luồng bắt đầu gây ra lỗi, trong khi luồng hợp lệ vẫn đọc được các giá trị Dictionary.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug, including details regarding any error messages, version, and platform.
An Arrow IPC stream has one Schema message, at its start. When a stream has a second Schema message, tableFromIPC accepts it. The reader drops the dictionaries, and it reads the next RecordBatch with the new schema. The repro puts a Schema with an Int32 column d between the DictionaryBatch and the RecordBatch of a valid stream of a dictionary column ["a", "b", "a"]. The result is 3 rows of [0, 1, 0]: the indices of the dictionary, with no error.
Version and platform: apache-arrow 21.2.0, Node.js 24.22.3 on Linux (GitHub Actions), and Node.js 24.21.0 on Windows.
Repro. Save as repro.ts and run node repro.ts (Node.js 24 strips the types). It exits 1 while the fault is present.
// F0252: apache-arrow 21.2.0. An Arrow IPC stream has one Schema message, at its start. The stream reader accepts a
// second Schema message: RecordBatchStreamReaderImpl.next() calls reset() with the new schema, and it drops the
// dictionaries. The next RecordBatch reads with the new schema, and the values of the column change with no error.
import * as A from "apache-arrow";
const type = new A.Dictionary(new A.Utf8(), new A.Int32(), 0);
const stream = A.tableToIPC(new A.Table({ d: A.vectorFromArray(["a", "b", "a"], type) }), "stream");
// A second schema: the column d is Int32, with no dictionary.
const otherStream = A.tableToIPC(A.tableFromArrays({ d: Int32Array.of(0) }), "stream");
// This function gives the bytes and the header type of each message, from the prefix and the bodyLength.
function messages(bytes: Uint8Array): { bytes: Uint8Array; header: A.MessageHeader }[] {
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
const found = [];
let position = 0;
while (position + 8 <= bytes.length) {
const metadataLength = view.getInt32(position + 4, true);
if (metadataLength === 0) break;
const message = A.Message.decode(bytes.subarray(position + 8, position + 8 + metadataLength));
const end = position + 8 + metadataLength + message.bodyLength;
found.push({ bytes: bytes.subarray(position, end), header: message.headerType });
position = end;
}
return found;
}
const list = messages(stream);
console.log(`messages: ${list.map((m) => A.MessageHeader[m.header]).join(", ")}`);
const [schema, dictionary, batch] = list;
const otherSchema = messages(otherStream).find((m) => m.header === A.MessageHeader.Schema);
if (!schema || !dictionary || !batch || !otherSchema) throw new Error("the streams do not have the expected messages");
// The same stream with the second Schema message after the DictionaryBatch, and the end-of-stream marker.
const end = Uint8Array.of(0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0);
const twoSchemas = new Uint8Array([...schema.bytes, ...dictionary.bytes, ...otherSchema.bytes, ...batch.bytes, ...end]);
const read = (bytes: Uint8Array): string => {
try {
const table = A.tableFromIPC(bytes);
return `${table.numRows} rows, d = ${JSON.stringify(Array.from(table.getChild("d") ?? []))}`;
} catch (error) {
return `throws: ${(error as Error).message}`;
}
};
console.log(`full stream: ${read(stream)}`);
const result = read(twoSchemas);
console.log(`stream with a second Schema message: ${result}`);
if (!result.startsWith("throws")) {
console.log("BUG PRESENT: the stream reader accepts a second Schema message, and the values of the column change.");
process.exit(1);
}
console.log("OK: the stream reader refuses a second Schema message.");
Output (CI run):
node: v24.22.3, os: Linux 7.0.0-1020-azure
messages: Schema, DictionaryBatch, RecordBatch
full stream: 3 rows, d = ["a","b","a"]
stream with a second Schema message: 3 rows, d = [0,1,0]
BUG PRESENT: the stream reader accepts a second Schema message, and the values of the column change.
run.sh exit code: 1
Expected: An error for a Schema message after the start of the stream. The format gives one schema for all the record batches of a stream.
Cause: RecordBatchStreamReaderImpl.next() in src/ipc/reader.ts calls this.reset(message.header()) for each Schema message. So a Schema in the middle of a stream replaces the schema and drops the dictionaries, with no end-of-stream marker before it.
An AI coding assistant (Claude Code) found this fault with a probe of the class "a message that needs earlier stream state", wrote the repro and wrote this text.
- Ngôn ngữ chính
- TypeScript
- Star
- 114
- Fork
- 35
- Merge trung bình
- 13 giờ 35 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/arrow-js
-
The IPC reader accepts a column that is shorter than its RecordBatch, and fills the missing rows with nullsCó thể đã có người làm @Sealdot đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The IPC reader ignores Schema.endianness: a big-endian stream reads 1, 2, 3 as 16777216, 33554432, 50331648Có thể đã có người làm @aniket-r2Dev2 đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
tableFromIPC loops with no end on a file whose RecordBatch block points at a DictionaryBatchCó thể đã có người làm @aniket-r2Dev2 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
apache/arrow-js#547 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The stream reader drops a message of an unexpected type but not its body, and parses the body as the next messagesCó thể đã có người làm @Umer-Butt07 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The file reader accepts two non-delta DictionaryBatches for one id, and the column values change with no errorCó thể đã có người làm @Sealdot đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/arrow-js
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
juspay/odu#193 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Alfa DramasĐang mởcheck:passed streams:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maduki-tech/bautackt#4 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
moq-dev/moq#10463 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày