Query-algebra spec: restriction by an expression with no common attributes, and restricting dj.U() aggregates
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- databases, documentation
Línea de trabajo
Start with make_condition in condition.py to confirm the common-attribute matching and the no-shared-attributes rule, then edit reference/specs/query-algebra.md at §2.4 (line 103), §2.5 (line 124) and §8.3 (line 956). Also add the universal-aggregate example to reference/operators.md around line 258. Done means the matching rule is stated on common attributes with a link to §9, the empty-attribute rule has examples, and the universal-aggregate restriction is documented with the .make_subquery() workaround until datajoint-python#1580 is resolved.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
reference/specs/query-algebra.md leaves out two behaviors that the implementation defines, and misstates the matching rule for restriction by a query expression.
1. §2.5 states the matching rule as primary keys
Line 124: "Restrict to rows with matching primary keys in another expression." The implementation (condition.py, make_condition) matches on every namesake attribute the two expressions share, subject to the lineage check of semantic matching, not only on primary-key attributes.
Fix: state the rule as matching on common (homologous) attributes, and link §9 (Semantic Matching).
2. §2.5 omits restriction when the expressions share no attributes
§2.4 documents the dictionary case (line 103: "If NO keys match, condition evaluates to True"). The expression case is undocumented. The implementation treats it the same way (condition.py: "without common attributes, any non-empty set matches everything"):
A & Bwith no common attributes: all ofAifBis non-empty, none ifBis empty.A - Bwith no common attributes: none ofAifBis non-empty, all ifBis empty.
This is what makes a global gate possible, for example Table & (dj.U().aggr(Other, n="count(*)") & "n > 0").
Fix: add the rule to §2.5 with an example, next to the dictionary rule in §2.4.
3. §8.3 does not cover restricting a universal aggregate
§8.3 shows dj.U().aggr(Student, n='count(*)') returning one row, and line 956 says restrictions after aggregation go to HAVING or a subquery, but neither covers restricting an ungrouped aggregate (dj.U().aggr(T, n="count(*)") & "n = 3"). In v2.3.4 that raises an AssertionError (datajoint/datajoint-python#1580), and len() of the subquery workaround raises a SQL syntax error (datajoint/datajoint-python#1581).
Fix: once #1580 is resolved, add a §8.3 example that restricts a universal aggregate and uses it as a restriction (rule 2 above). Until then, note the .make_subquery() workaround. The "Universal Aggregation (Single Row Result)" section of reference/operators.md (line 258) could take the same example.
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 7
- Forks
- 12
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 20
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de datajoint/datajoint-docs
-
documentation
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
datajoint/datajoint-docs#301 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 3/5 Medio día Aptitud para principiantes 52/100
datajoint/datajoint-docs#299 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
datajoint/datajoint-docs#298 ·
Los mantenedores suelen responder en 3 días
-
documentation
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
datajoint/datajoint-docs#292 ·
Los mantenedores suelen responder en 3 días
Todos los issues de datajoint/datajoint-docs
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
datajoint/datajoint-python#1586 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue hacktoberfest
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
libredb/libredb-studio#1755 ·
Los mantenedores suelen responder en 1 día
-
fix(accounts): Balance Sheet and Profit and Loss crash on PostgreSQL due to MySQL force_indexAbierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Bible-Research/bible_research#51 ·
Los mantenedores suelen responder en 6 días