Skip to content

Commit

Permalink
fix redundant checkpoint issue
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Oct 25, 2023
1 parent ed6f821 commit 4177e35
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import {
indexOptionsMock3,
indexOptionsMock4,
indexOptionsMock5,
indexOptionsMock6,
indexOptionsMockResult1,
indexOptionsMockResult2,
indexOptionsMockResult3,
indexOptionsMockResult4,
indexOptionsMockResult5,
indexOptionsMockResult6,
materializedViewBuilderMock1,
materializedViewBuilderMock2,
materializedViewBuilderMockResult1,
Expand Down Expand Up @@ -60,6 +62,11 @@ describe('buildIndexOptions', () => {
expect(indexOptions).toEqual(indexOptionsMockResult5);
});

it('should build index options with manual refresh and checkpoint', () => {
const indexOptions = buildIndexOptions(indexOptionsMock6);
expect(indexOptions).toEqual(indexOptionsMockResult6);
});

describe('skippingIndexQueryBuilder', () => {
it('should build skipping index query as expected with interval refresh', () => {
const result = skippingIndexQueryBuilder(skippingIndexBuilderMock1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const buildIndexOptions = (accelerationformData: CreateAccelerationForm)
);
}

if (checkpointLocation) {
if (refreshType !== 'manual' && checkpointLocation) {
// Add checkpoint location option
indexOptions.push(`checkpoint_location = '${checkpointLocation}'`);
}
Expand Down
13 changes: 13 additions & 0 deletions test/mocks/accelerationMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@ export const skippingIndexBuilderMock1: CreateAccelerationForm = {
checkpointLocation: 's3://test/',
};

export const indexOptionsMock6: CreateAccelerationForm = {
...createAccelerationEmptyDataMock,
primaryShardsCount: 1,
replicaShardsCount: 1,
refreshType: 'manual',
checkpointLocation: 's3://dsfsad/dasda',
};

export const indexOptionsMockResult6 = `WITH (
index_settings = '{"number_of_shards":1,"number_of_replicas":1}',
auto_refresh = false
)`;

export const skippingIndexBuilderMockResult1 = `CREATE SKIPPING INDEX
ON datasource.database.table (
\`field1\` PARTITION,
Expand Down

0 comments on commit 4177e35

Please sign in to comment.