The stream reader reads a RecordBatch whose dictionary was never sent: each value becomes null, with no error
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 78/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, typescript
- Domaine
- backend-api-design, data
Piste de recherche
Commencez par lire src/visitor/vectorloader.ts, en particulier VectorLoader.readDictionary(), et suivez le cheminement de son résultat jusqu’à makeData. Utilisez repro.ts avec Node.js 24 pour confirmer que la suppression du DictionaryBatch produit actuellement des valeurs null sans erreur. Le travail est terminé lorsque le lecteur signale une erreur indiquant l’identifiant du dictionnaire manquant ; relancez le repro pour vérifier le comportement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug, including details regarding any error messages, version, and platform.
The IPC format sends the DictionaryBatch of a dictionary id before any RecordBatch that uses it. When a stream has no DictionaryBatch for the id of a dictionary field, tableFromIPC still reads the RecordBatch, and each value of the column is null. The repro removes the one DictionaryBatch message from a valid stream of ["a", "b", "a"]. The result is 3 rows of [null, null, null], with no error.
Version and platform: apache-arrow 21.2.0, Node.js 24.22.2 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.
// F0146: apache-arrow 21.2.0. A stream with a RecordBatch whose dictionary was never sent reads with no error, and
// each value of the dictionary column becomes null. VectorLoader.readDictionary() does not check that a
// DictionaryBatch with the id of the field came before the RecordBatch.
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");
// This function gives the start, the end and the header type of each message, from the prefix and the bodyLength.
function messages(bytes: Uint8Array): { start: number; end: number; 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({ start: 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 dictionary = list.find((m) => m.header === A.MessageHeader.DictionaryBatch);
if (!dictionary) throw new Error("the stream has no DictionaryBatch");
// The same stream with no DictionaryBatch message. The other bytes do not change.
const withoutDictionary = new Uint8Array([...stream.subarray(0, dictionary.start), ...stream.subarray(dictionary.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(withoutDictionary);
console.log(`stream with no DictionaryBatch: ${result}`);
if (!result.startsWith("throws")) {
console.log("BUG PRESENT: a RecordBatch whose dictionary was never sent reads with no error.");
process.exit(1);
}
console.log("OK: a RecordBatch whose dictionary was never sent gives an error.");
Output (CI run):
node: v24.22.2, os: Linux 7.0.0-1019-azure
messages: Schema, DictionaryBatch, RecordBatch
full stream: 3 rows, d = ["a","b","a"]
stream with no DictionaryBatch: 3 rows, d = [null,null,null]
BUG PRESENT: a RecordBatch whose dictionary was never sent reads with no error.
run.sh exit code: 1
Expected: An error that names the missing dictionary id, because the reader cannot decode the indices of the column.
Cause: VectorLoader.readDictionary() in src/visitor/vectorloader.ts returns this.dictionaries.get(type.id)!. The non-null assertion hides the missing entry, and makeData gets an undefined dictionary.
An AI coding assistant (Claude Code) found this fault, wrote the repro and wrote this text.
- Langage dominant
- TypeScript
- Étoiles
- 114
- Forks
- 35
- Merge moyen
- 13 h 35 min
- PR mergées (30 j)
- 5
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/arrow-js
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Les mainteneurs répondent en général sous 1 jour
-
The IPC reader accepts a column that is shorter than its RecordBatch, and fills the missing rows with nullsPeut-être pris @Sealdot l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
The IPC reader ignores Schema.endianness: a big-endian stream reads 1, 2, 3 as 16777216, 33554432, 50331648Peut-être pris @aniket-r2Dev2 l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
tableFromIPC loops with no end on a file whose RecordBatch block points at a DictionaryBatchPeut-être pris @aniket-r2Dev2 l’a pris il y a 4 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
apache/arrow-js#547 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
The stream reader drops a message of an unexpected type but not its body, and parses the body as the next messagesPeut-être pris @Umer-Butt07 l’a pris il y a 3 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de apache/arrow-js
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
melgarafael/DeskcommCRM#5614 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
documentation
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
slackapi/slack-health-score#253 ·
Les mainteneurs répondent en général sous 1 jour
-
feature needs triage site
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
owid/owid-grapher#8019 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
simstudioai/sim#10710 ·
Les mainteneurs répondent en général sous 1 jour
-
via-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour