Skip to content

Commit

Permalink
chore: remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
chulanovskyi-bs committed Dec 26, 2024
1 parent 190fcd6 commit aae8bf6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const getWithClause = index => {
: '';

const nodeStatement = joinStatements({
statements: index.withOptions.nodes.map(node => `"${node.nodeName}"`),
statements: index.withOptions?.nodes?.map(node => `"${node.nodeName}"`),
separator: ',',
});
const nodes = get(index, 'withOptions.nodes', []).length ? `"nodes":[${nodeStatement}]` : '';
Expand Down
12 changes: 2 additions & 10 deletions reverse_engineering/helpers/indexHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@ const handleIndex = index => {
return pickBy(indexData, value => !isUndefined(value));
};

const getIndexExpression = ({ index }) => {
if (index.index_key) {
return index.index_key.map(getExpression).join(',');
}
};

const getHackoladeCompatibleIndex = index => {
const indexExpression = getIndexExpression({ index });

if (index.is_primary) {
return {
indxName: index.name,
Expand All @@ -30,14 +22,14 @@ const getHackoladeCompatibleIndex = index => {
indxName: index.name,
indxType: INDEX_TYPE.array,
usingGSI: index.using === 'gsi',
arrayExpr: indexExpression,
arrayExpr: index.index_key.map(getExpression).join(','),
whereClause: getWhereCondition(index),
};
} else if (checkMetaIndex(index)) {
return {
indxName: index.name,
indxType: INDEX_TYPE.metadata,
metadataExpr: indexExpression,
metadataExpr: index.index_key.map(getExpression).join(','),
};
} else {
const partitionByHash = getPartition(index);
Expand Down

0 comments on commit aae8bf6

Please sign in to comment.