Query-algebra spec: restriction by an expression with no common attributes, and restricting dj.U() aggregates
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 55/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Jupyter Notebook
- 星标
- 7
- 派生
- 12
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 20
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
datajoint/datajoint-docs 的其他 Issue
-
documentation
难度 3/5 1-2 天 新手友好度 45/100
datajoint/datajoint-docs#301 ·
维护者通常 3 天内回复
-
难度 3/5 半天 新手友好度 52/100
datajoint/datajoint-docs#299 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 3/5 1-2 天 新手友好度 55/100
datajoint/datajoint-docs#298 ·
维护者通常 3 天内回复
-
documentation
难度 3/5 1-2 天 新手友好度 45/100
datajoint/datajoint-docs#292 ·
维护者通常 3 天内回复
查看 datajoint/datajoint-docs 的全部 Issue
相似的 Issue
-
draft
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
DefaultRedisList.get(int) does not reject an index equal to the list size可能已有人在做 @ryujungkyun 今天认领。 未关闭status: waiting-for-triage
难度 1/5 1 小时以内 新手友好度 68/100
spring-projects/spring-data-redis#3471 ·
维护者通常 5 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
mozilla/experimenter#17757 ·
维护者通常 1 天内回复
-
Database backend cleanup can delete task results before result_expires with non-UTC timezones可能已有人在做 @Namraa310806 今天认领。 未关闭Component: SQLAlchemy Database Results Backend Issue Type: Bug Report
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
C-bug O-community X-blathers-untriaged
难度 2/5 1-3 小时 新手友好度 72/100
cockroachdb/cockroach#176136 · 1 条评论 ·
维护者通常 12 天内回复