Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions src/main/java/com/epam/ta/reportportal/dao/LogRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,14 @@ public interface LogRepository extends ReportPortalRepository<Log, Long>, LogRep
List<Log> findLogsByLogTime(Timestamp timestamp);

@Query(value = """
WITH ParentPath AS (
SELECT path
FROM test_item ti2
WHERE ti2.item_id = (
SELECT parent_id
FROM test_item ti3
WHERE ti3.item_id = :itemId
)
),
TargetPath AS (
SELECT concat(pp.path, '.', :itemId) AS path
FROM ParentPath pp
),
FilteredItems AS (
WITH RECURSIVE item_tree AS (
SELECT item_id
FROM test_item
WHERE item_id = :itemId
UNION ALL
SELECT ti.item_id
FROM test_item ti
WHERE ti.path::text = (SELECT path FROM TargetPath)
OR ti.path::text LIKE (SELECT path FROM TargetPath) || '.%'
INNER JOIN item_tree it ON ti.parent_id = it.item_id
)
SELECT
log.id AS logId,
Expand All @@ -63,7 +53,7 @@ FilteredItems AS (
clusters.index_id AS clusterId
FROM log
LEFT JOIN clusters ON log.cluster_id = clusters.id
WHERE log.item_id IN (SELECT item_id FROM FilteredItems)
WHERE log.item_id IN (SELECT item_id FROM item_tree)
AND log.log_level >= :logLevel;
""", nativeQuery = true)
List<IndexLog> findNestedLogsOfRetryItem(@Param("itemId") Long itemId,
Expand Down
Loading