mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-11 19:23:02 +00:00
Fix duplicate fields if having multiple comments (#884)
This commit is contained in:
parent
233e9090b3
commit
bd5f95e964
@ -39,14 +39,17 @@ public class DatasetViewDao extends BaseViewDao {
|
||||
}
|
||||
|
||||
private static final String GET_DATASET_COLUMNS_BY_DATASET_ID =
|
||||
"select dfd.field_id, dfd.sort_id, dfd.parent_sort_id, dfd.parent_path, dfd.field_name, dfd.data_type, "
|
||||
"SELECT dfd.field_id, dfd.sort_id, dfd.parent_sort_id, dfd.parent_path, dfd.field_name, dfd.data_type, "
|
||||
+ "dfd.is_nullable as nullable, dfd.is_indexed as indexed, dfd.is_partitioned as partitioned, "
|
||||
+ "dfd.is_distributed as distributed, c.comment, "
|
||||
+ "( SELECT count(*) FROM dict_dataset_field_comment ddfc "
|
||||
+ "WHERE ddfc.dataset_id = dfd.dataset_id AND ddfc.field_id = dfd.field_id ) as comment_count "
|
||||
+ "FROM dict_field_detail dfd LEFT JOIN dict_dataset_field_comment ddfc ON "
|
||||
+ "(ddfc.field_id = dfd.field_id AND ddfc.is_default = true) LEFT JOIN field_comments c ON "
|
||||
+ "c.id = ddfc.comment_id WHERE dfd.dataset_id = :datasetId ORDER BY dfd.sort_id";
|
||||
+ "FROM dict_field_detail dfd "
|
||||
+ "LEFT JOIN dict_dataset_field_comment ddfc ON ddfc.field_id = dfd.field_id "
|
||||
+ " AND ddfc.comment_id = (select max(comment_id) from dict_dataset_field_comment "
|
||||
+ " where field_id = dfd.field_id and is_default = true) "
|
||||
+ "LEFT JOIN field_comments c ON c.id = ddfc.comment_id "
|
||||
+ "WHERE dfd.dataset_id = :datasetId ORDER BY dfd.sort_id";
|
||||
|
||||
private static final String GET_DATASET_COLUMN_BY_DATASETID_AND_COLUMNID =
|
||||
"SELECT dfd.field_id, dfd.sort_id, dfd.parent_sort_id, dfd.parent_path, dfd.field_name, dfd.data_type, "
|
||||
|
Loading…
x
Reference in New Issue
Block a user