Skip to content

Commit

Permalink
HCK-9572: fix duplication of clustering key in forward-engineered scr…
Browse files Browse the repository at this point in the history
…ipt (#251)
  • Loading branch information
Vitalii4as authored Jan 22, 2025
1 parent 628f0b0 commit cb34cdf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions forward_engineering/helpers/keyHelper.js
Original file line number Diff line number Diff line change
@@ -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));
Expand All @@ -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]);
Expand Down

0 comments on commit cb34cdf

Please sign in to comment.