diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/CollectionDAO.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/CollectionDAO.java index 943a73389e1..1af641b2758 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/CollectionDAO.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/CollectionDAO.java @@ -542,7 +542,7 @@ public interface CollectionDAO { @SqlQuery("SELECT json FROM thread_entity WHERE id = :id") String findById(@Bind("id") String id); - @SqlQuery("SELECT json FROM thread_entity ORDER BY updatedAt DESC") + @SqlQuery("SELECT json FROM thread_entity ORDER BY createdAt DESC") List list(); @SqlQuery( @@ -592,7 +592,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt > :before AND resolved = :resolved " + "AND (:type IS NULL OR type = :type) AND (:status IS NULL OR taskStatus = :status) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listBefore( @Bind("limit") int limit, @@ -640,7 +640,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt > :before " + "AND type = :type AND " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( @@ -648,7 +648,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt > :before " + "AND type = :type AND " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) List listAnnouncementBefore( @@ -680,7 +680,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt < :after " + "AND type = :type AND " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( @@ -688,7 +688,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt < :after " + "AND type = :type AND " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) List listAnnouncementAfter( @@ -702,7 +702,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity " + "WHERE updatedAt < :after AND resolved = :resolved " + "AND (:type IS NULL OR type = :type) AND (:status IS NULL OR taskStatus = :status) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listAfter( @Bind("limit") int limit, @@ -715,14 +715,14 @@ public interface CollectionDAO { value = "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt > :before AND taskStatus = :status AND " + "taskAssignees @> ANY (ARRAY[]::jsonb[]) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) @ConnectionAwareSqlQuery( value = "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt > :before AND taskStatus = :status AND " + "JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) List listTasksAssignedToBefore( @@ -737,7 +737,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt < :after " + "AND (:status IS NULL OR taskStatus = :status) " + "AND taskAssignees @> ANY (ARRAY[]::jsonb[]) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) @ConnectionAwareSqlQuery( @@ -745,7 +745,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt < :after " + "AND (:status IS NULL OR taskStatus = :status) " + "AND JSON_OVERLAPS(taskAssignees, :userTeamJsonMysql) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) List listTasksAssignedToAfter( @@ -776,7 +776,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt > :before " + "AND (:status IS NULL OR taskStatus = :status) " + "AND createdBy = :username " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listTasksAssignedByBefore( @Bind("username") String username, @@ -788,7 +788,7 @@ public interface CollectionDAO { "SELECT json FROM thread_entity WHERE type='Task' AND updatedAt < :after " + "AND (:status IS NULL OR taskStatus = :status) " + "AND createdBy = :username " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listTasksAssignedByAfter( @Bind("username") String username, @@ -807,7 +807,7 @@ public interface CollectionDAO { + "((fromEntity='user' AND fromId= :userId) OR " + "(fromEntity='team' AND fromId IN ())) AND relation=8) OR " + "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2)))) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByOwnerBefore( @Bind("userId") String userId, @@ -823,7 +823,7 @@ public interface CollectionDAO { + "((fromEntity='user' AND fromId= :userId) OR " + "(fromEntity='team' AND fromId IN ())) AND relation=8) OR " + "id in (SELECT toId FROM entity_relationship WHERE (fromEntity='user' AND fromId= :userId AND toEntity='THREAD' AND relation IN (1,2)))) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByOwnerAfter( @Bind("userId") String userId, @@ -878,7 +878,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( @@ -888,7 +888,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) List listAnnouncementsByEntityLinkBefore( @@ -908,7 +908,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByEntityLinkBefore( @Bind("fqnPrefix") String fqnPrefix, @@ -953,7 +953,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = MYSQL) @ConnectionAwareSqlQuery( @@ -963,7 +963,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit", connectionType = POSTGRES) List listAnnouncementsByEntityLinkAfter( @@ -983,7 +983,7 @@ public interface CollectionDAO { + "AND id in (SELECT fromFQN FROM field_relationship WHERE " + "(:fqnPrefix IS NULL OR toFQN LIKE CONCAT(:fqnPrefix, '.%') OR toFQN=:fqnPrefix) AND fromType='THREAD' AND " + "(:toType IS NULL OR toType LIKE CONCAT(:toType, '.%') OR toType=:toType) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByEntityLinkAfter( @Bind("fqnPrefix") String fqnPrefix, @@ -1111,7 +1111,7 @@ public interface CollectionDAO { + "SELECT toId FROM entity_relationship WHERE " + "((fromEntity='user' AND fromId= :userId) OR " + "(fromEntity='team' AND fromId IN ())) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByFollowsBefore( @Bind("userId") String userId, @@ -1128,7 +1128,7 @@ public interface CollectionDAO { + "SELECT toId FROM entity_relationship WHERE " + "((fromEntity='user' AND fromId= :userId) OR " + "(fromEntity='team' AND fromId IN ())) AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByFollowsAfter( @Bind("userId") String userId, @@ -1158,7 +1158,7 @@ public interface CollectionDAO { + "SELECT toFQN FROM field_relationship WHERE " + "((fromType='user' AND fromFQN= :userName) OR " + "(fromType='team' AND fromFQN IN ())) AND toType='THREAD' AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByMentionsBefore( @Bind("userName") String userName, @@ -1175,7 +1175,7 @@ public interface CollectionDAO { + "SELECT toFQN FROM field_relationship WHERE " + "((fromType='user' AND fromFQN= :userName) OR " + "(fromType='team' AND fromFQN IN ())) AND toType='THREAD' AND relation= :relation) " - + "ORDER BY updatedAt DESC " + + "ORDER BY createdAt DESC " + "LIMIT :limit") List listThreadsByMentionsAfter( @Bind("userName") String userName,