JackRabbit - 删除重复行

发布于 2024-10-20 11:20:45 字数 242 浏览 4 评论 0原文

我在 Jackrabbit 用户列表上问过这个问题,但没有得到答案。

JCR-SQL2 不提供 SELECT DISTINCT (或类似的,据我所知)。 JCR 1.0 中的 SQL 或 XPATH 也不...人们如何解决这个问题?删除重复行的最佳方法是什么?

我读到有人正在迭代结果并将它们放入集合中。就我而言,由于可能存在大量结果,这种方法最终可能成本太高。

这里有人有建议吗?

I have asked this question on jackrabbit-users list but I didn't get an answer.

JCR-SQL2 doesn't provide a SELECT DISTINCT (or similar, AFAIK). Neither do SQL or XPATH in JCR 1.0... How are people getting around this?. What's the best way of removing duplicate rows?

I read that someone was iterating over the results and putting them in a Set. In my case, because of the possible huge number of results, that approach may end up being too costly.

Does anyone here have a suggestion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千年*琉璃梦 2024-10-27 11:20:45

JCR 1.0(例如,JSR-170)或JCR 2.0(例如,JSR-283)中定义的查询语言都没有SELECT DISTINCT 的概念。

执行此操作的唯一方法是手动处理结果并丢弃您已经看到的任何行(或节点)。使用一组路径或 Node 对象就可以了。这并不是太困难,但不幸的是它比应有的更难,并且正如您所提到的,如果有很多行和/或重复项,则可能会很昂贵。

这就是为什么 ModeShape 提供对 JCR-SQL2 查询的全面支持,但也允许使用 SELECT DISTINCT。事实上,ModeShape 支持许多其他功能,例如

  • WHERE 子句中的非相关子查询
  • LIMIT nOFFSET m
  • UNIONINTERSECTEXCEPT
  • FULL OUTER JOINCROSS JOIN
  • BETWEEN criteria
  • 设置条件,使用 INNOT IN
  • DEPTHPATH 动态操作数

以及其他一些操作数。有关详细信息,请参阅

None of the query languages defined in JCR 1.0 (e.g., JSR-170) or JCR 2.0 (e.g., JSR-283) have a notion of SELECT DISTINCT.

The only way to do this is to process the results manually and throwing out any rows (or nodes) that you've already seen. Using a set of paths or Node objects would work. This isn't too difficult, but it's unfortunately harder than it should be and, as you mention, can be expensive if there are a lot of rows and/or duplicates.

This is why ModeShape provides full support for JCR-SQL2 queries but also allows use of SELECT DISTINCT. In fact, ModeShape supports a number of other features such as

  • non-correlated subqueries in the WHERE clause
  • LIMIT n and OFFSET m
  • UNION, INTERSECT and EXCEPT
  • FULL OUTER JOIN and CROSS JOIN
  • BETWEEN criteria
  • set criteria, using IN and NOT IN
  • DEPTH and PATH dynamic operands

and a few others. For details, see the documentation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文