JackRabbit - 删除重复行
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JCR 1.0(例如,JSR-170)或JCR 2.0(例如,JSR-283)中定义的查询语言都没有
SELECT DISTINCT
的概念。执行此操作的唯一方法是手动处理结果并丢弃您已经看到的任何行(或节点)。使用一组路径或 Node 对象就可以了。这并不是太困难,但不幸的是它比应有的更难,并且正如您所提到的,如果有很多行和/或重复项,则可能会很昂贵。
这就是为什么 ModeShape 提供对 JCR-SQL2 查询的全面支持,但也允许使用
SELECT DISTINCT
。事实上,ModeShape 支持许多其他功能,例如WHERE
子句中的非相关子查询LIMIT n
和OFFSET m
UNION
、INTERSECT
和EXCEPT
FULL OUTER JOIN
和CROSS JOIN
BETWEEN
criteriaIN
和NOT IN
DEPTH
和PATH
动态操作数以及其他一些操作数。有关详细信息,请参阅
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 asWHERE
clauseLIMIT n
andOFFSET m
UNION
,INTERSECT
andEXCEPT
FULL OUTER JOIN
andCROSS JOIN
BETWEEN
criteriaIN
andNOT IN
DEPTH
andPATH
dynamic operandsand a few others. For details, see the documentation.