4paradigm / 4paradigm/OpenMLDB

batch: bug in handle key if is null

Ouverte
#1,903 2 commentaires 0 réactions 1 personne assignée Réclamée par @tobegit3hub Voir sur GitHub
batch-engine bug call-for-contributions
Langage dominant
C++
Étoiles
1.7k
Forks
331
Merge moyen
12 j 12 h
PR mergées (30 j)
1

Description

https://github.com/4paradigm/OpenMLDB/blob/908e9edbe05a86dccdbf8d1579bad88454480d59/java/openmldb-batch/src/main/scala/com/_4paradigm/openmldb/batch/nodes/WindowAggPlan.scala#L424-L425

We get key by `extractKey`, and then check it by `isValidOrder`.
After #1408 fixed, `isValidOrder` arg is java Long, it may be null or a long.

But `extractKey` returns scala Long, which can't be null, ref
https://github.com/4paradigm/OpenMLDB/blob/8a20b4849c52dfee7dacd02f04a6adede05673c2/java/openmldb-batch/src/main/scala/com/_4paradigm/openmldb/batch/window/WindowComputer.scala#L225-L227
The function `getLongFromIndex` called by `extractKey`, returns java Long.
https://github.com/4paradigm/OpenMLDB/blob/2e7fb76aca6a41a96c43b46b1be2194281c2166f/java/openmldb-batch/src/main/scala/com/_4paradigm/openmldb/batch/utils/SparkRowUtil.scala#L66

We miss null in `extractKey`.
And after I temporarily make `extractKey` return java Long, some batch tests failed. e.g. https://github.com/4paradigm/OpenMLDB/blob/836b34119249ff9b667130b125c88395ef18ee4f/java/openmldb-batch/src/test/scala/com/_4paradigm/openmldb/batch/nulldata/TestWindowWithNullData.scala#L28

reproduce:
1. make `extractKey` return java Long
2. run TestWindowWithNullData

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

The bug is in WindowAggPlan.scala line 424-425 where extractKey returns a Scala Long (non-nullable) but isValidOrder expects a Java Long (nullable). Examine extractKey in WindowComputer.scala and getLongFromIndex in SparkRowUtil.scala. Run TestWindowWithNullData to reproduce the failure after modifying extractKey to return java.lang.Long. The fix must handle nulls correctly without breaking existing batch tests.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, scala
Domaine
databases, machine-learning
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.