From cb34cdf1dd95756e7ef54416194af37c0709b6a3 Mon Sep 17 00:00:00 2001 From: Vitalii Yarmus <71256742+Vitalii4as@users.noreply.github.com> Date: Wed, 22 Jan 2025 10:12:16 +0200 Subject: [PATCH] HCK-9572: fix duplication of clustering key in forward-engineered script (#251) --- forward_engineering/helpers/keyHelper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forward_engineering/helpers/keyHelper.js b/forward_engineering/helpers/keyHelper.js index 1cc4bd6..42e02dc 100644 --- a/forward_engineering/helpers/keyHelper.js +++ b/forward_engineering/helpers/keyHelper.js @@ -1,5 +1,6 @@ 'use strict'; +const { uniq } = require('lodash'); const jsonSchemaHelper = require('./jsonSchemaHelper'); const filterPaths = (keys, paths) => paths.filter(path => keys.find(key => path[path.length - 1] === key.keyId)); @@ -20,8 +21,8 @@ const getKeyNames = (tableData, jsonSchema, definitions) => { const skewedby = tableData.skewedby || []; const sortedByKey = tableData.sortedByKey || []; - const ids = [...compositeClusteringKey, ...compositePartitionKey, ...skewedby, ...sortedByKey].map( - key => key.keyId, + const ids = uniq( + [...compositeClusteringKey, ...compositePartitionKey, ...skewedby, ...sortedByKey].map(key => key.keyId), ); const keysPaths = jsonSchemaHelper.getPathsByIds(ids, [jsonSchema, ...definitions]);