ThinkR-open / ThinkR-open/datadiff

[bug] Divergence de verdict local vs lazy sur NA unilatéral pour les colonnes d'égalité (na_equal non homogène)

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
6
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Contexte

Pour les colonnes d'égalité (sans tolérance), un NA unilatéral (valeur d'un seul côté) donne un verdict différent selon le backend, avec na_equal = TRUE (défaut) :

  • Chemin local : col_vals_equal(..., na_pass = na_equal) (R/pointblank_setup.R) et eq_col_bool() (R/fast_path.R : ifelse(is.na(cmp_res), na_equal, cmp_res)) → NA unilatéral PASSE.
  • Chemin lazy : CASE WHEN c IS NULL OR r IS NULL THEN FALSE (R/tolerance.R, add_bool_cols_sql) → NA unilatéral ÉCHOUE toujours.

Cela concerne aussi les lignes du candidat sans correspondance dans la référence (left_join → colonnes référence toutes NA) : elles passent silencieusement en local, échouent en lazy.

À noter : le kernel tolérance est cohérent partout (unilatéral = FAIL, bilatéral = suit na_equal) — c'est la sémantique la plus défendable. Le chemin local égalité est donc sans doute celui à corriger : na_pass = TRUE fait passer tout NA, y compris unilatéral, ce qui va au-delà de ce que documente na_equal (« NA == NA »).

Reprex

library(datadiff)
library(duckdb); library(dplyr)

ref  <- data.frame(id = 1:2, s = c("a", NA))
cand <- data.frame(id = 1:2, s = c("a", "b"))   # ligne 2 : "b" vs NA

res_local <- compare_datasets_from_yaml(ref, cand, key = "id")
res_local$all_passed   # TRUE (NA unilatéral passe)

con <- dbConnect(duckdb())
duckdb_register(con, "ref", ref); duckdb_register(con, "cand", cand)
res_lazy <- compare_datasets_from_yaml(tbl(con, "ref"), tbl(con, "cand"), key = "id")
res_lazy$all_passed    # FALSE (NA unilatéral échoue)

Critères de succès

  • Sémantique cible décidée et documentée (proposition : celle du kernel tolérance — unilatéral = FAIL, bilatéral = na_equal).
  • Les trois implémentations de l'égalité alignées : eq_col_bool(), le CASE WHEN __eq SQL, et le step pointblank local (qui ne peut plus utiliser na_pass = na_equal tel quel).
  • Le reprex donne le même all_passed sur les deux chemins.
  • Test d'équivalence local↔DuckDB couvrant : NA unilatéral, NA bilatéral, ligne non appariée par la clé, avec na_equal TRUE et FALSE.
  • Entrée NEWS documentant le changement de comportement du chemin corrigé.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read R/pointblank_setup.R, R/fast_path.R, and R/tolerance.R to compare the local and lazy equality paths. Verify the existing reprex with DuckDB, then inspect how equality results and NA handling are tested. Done means the three implementations agree for unilateral and bilateral NA cases, unmatched keys, both na_equal values, and the behavior change is recorded in NEWS.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, sql
Domain
data, documentation, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.