-
-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make JavaCompatiblePartitioner new default
The JavaCompatiblePartitioner is renamed DefaultPartitioner. The old DefaultPartitioner becomes LegacyPartitioner.
- Loading branch information
Showing
16 changed files
with
119 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const murmur2 = require('./murmur2') | ||
const createDefaultPartitioner = require('./partitioner') | ||
const createDefaultPartitioner = require('../legacy/partitioner') | ||
|
||
module.exports = createDefaultPartitioner(murmur2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const DefaultPartitioner = require('./default') | ||
const JavaCompatiblePartitioner = require('./defaultJava') | ||
const LegacyPartitioner = require('./legacy') | ||
|
||
module.exports = { | ||
DefaultPartitioner, | ||
JavaCompatiblePartitioner, | ||
LegacyPartitioner, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const murmur2 = require('./murmur2') | ||
const createLegacyPartitioner = require('./partitioner') | ||
|
||
module.exports = createLegacyPartitioner(murmur2) |
2 changes: 1 addition & 1 deletion
2
...oducer/partitioners/default/index.spec.js → ...roducer/partitioners/legacy/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const murmur2 = require('./murmur2') | ||
|
||
describe('Producer > Partitioner > Default > murmur2', () => { | ||
test('it works', () => { | ||
Object.keys(testData).forEach(key => { | ||
expect(murmur2(key)).toEqual(testData[key]) | ||
}) | ||
}) | ||
|
||
test('it handles numeric input', () => { | ||
expect(murmur2(0)).toEqual(272173970) | ||
}) | ||
|
||
test('it handles buffer input', () => { | ||
expect(murmur2(Buffer.from('1'))).toEqual(1311020360) | ||
}) | ||
}) | ||
|
||
const testData = { | ||
'0': 272173970, | ||
'1': 1311020360, | ||
'128': 2053105854, | ||
'2187': -2081355488, | ||
'16384': 204404061, | ||
'78125': -677491393, | ||
'279936': -622460209, | ||
'823543': 651276451, | ||
'2097152': 944683677, | ||
'4782969': -892695770, | ||
'10000000': -1778616326, | ||
'19487171': -518311627, | ||
'35831808': 556972389, | ||
'62748517': -233806557, | ||
'105413504': -109398538, | ||
'170859375': 102939717, | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters