Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Jedis HSTRLEN command request #1404 #1408

Merged
merged 3 commits into from Oct 23, 2016

Conversation

smadasu
Copy link
Contributor

@smadasu smadasu commented Oct 16, 2016

Hi,
Here is the pull request for HSTRLEN command

Copy link
Contributor

@HeartSaVioR HeartSaVioR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work @smadasu , I left review comments for the fix, but most of things are from same issue (naming) so you can easily fix it. Other issue is the place for tests.

@@ -1296,4 +1296,8 @@ public void bitfield(final byte[] key, final byte[]... value) {
System.arraycopy(value, 0, bitfieldArgs, 1, argsLength);
sendCommand(Command.BITFIELD, bitfieldArgs);
}

public void hstrlen(final byte[] hashName, final byte[] keyName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://redis.io/commands/hstrlen

The name for instance is represented via 'key', and the key for hash is represented via 'field'. This is the Redis keyword semantic we need to follow.

@@ -3731,4 +3731,11 @@ public boolean retainAll(Collection<?> c) {
client.bitfield(key, arguments);
return client.getBinaryMultiBulkReply();
}

@Override
public Long hstrlen(byte[] hashName, byte[] keyname) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

@@ -1852,4 +1852,14 @@ public Double execute(Jedis connection) {
}
}.runBinary(key);
}

@Override
public Long hstrlen(final byte[] hashName, final byte[] keyName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

@@ -872,5 +872,11 @@ public Double geodist(byte[] key, byte[] member1, byte[] member2, GeoUnit unit)
Jedis j = getShard(key);
return j.bitfield(key, arguments);
}

@Override
public Long hstrlen(byte[] hashName, byte[] keyName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

@@ -1212,4 +1212,9 @@ public void bitfield(final String key, final String... arguments) {
bitfield(SafeEncoder.encode(key), argumentArray);
}

@Override
public void hstrlen(final String hashName, final String keyName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

* @param keyName
* @return lenth of the value for key
*/
Long hstrlen(final String hashName, final String keyName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

* Used for HSTRLEN Redis command
* @param hashName
* @param keyName
* @return lenth of the value for key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the field

@@ -219,6 +219,8 @@
Response<Long> pfcount(final String key);

Response<List<Long>> bitfield(String key, String... arguments);

Response<Long> hstrlen(String hashName, String keyName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue on variable names.

jedis.auth("foobared");
Jedis jedis = new Jedis("localhost");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is by accident. Could you revert it, or could you explain why this change is necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Thats right. I will fix it Thanks.

@@ -188,4 +188,56 @@ public void testBinaryBitfield() {
}
}

@Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're placing command tests to other places. I guess you referred above tests but above tests (BitField and BinaryBitField) are also wrong, and so it should be moved, too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HashesCommandsTest is the proper place of hash commands.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more, you can just use jedis without initialize yourself. Please refer other test methods in HashesCommandsTest.

@smadasu
Copy link
Contributor Author

smadasu commented Oct 16, 2016

Update parameter names and Test.

@smadasu smadasu closed this Oct 16, 2016
@smadasu smadasu reopened this Oct 16, 2016
@smadasu
Copy link
Contributor Author

smadasu commented Oct 16, 2016

Sorry I closed PR by mistake

@marcosnils
Copy link
Contributor

@smadasu can you please rebase?

@smadasu
Copy link
Contributor Author

smadasu commented Oct 22, 2016

New PR after rebasing

@smadasu
Copy link
Contributor Author

smadasu commented Oct 22, 2016

Why is it failing just for openjdk7, I don't understand

@HeartSaVioR
Copy link
Contributor

Travis CI has some bugs with OpenJDK. Maybe we want to get rid of checking OpenJDK.

@HeartSaVioR
Copy link
Contributor

@smadasu Tests still not moved to proper place. If you want me to move them, please let me know. I'll take care of it.

@smadasu
Copy link
Contributor Author

smadasu commented Oct 23, 2016

Sure @HeartSaVioR . Go ahead and clean them up. Thanks for your help.

@marcosnils
Copy link
Contributor

@HeartSaVioR @smadasu I've re-run the tests for JDK 7 and we're ok now. Sometimes they fail because because of the timeouts.

@HeartSaVioR
Copy link
Contributor

OK then LGTM from me.
@marcosnils Please take a look as well. Thanks!

@marcosnils
Copy link
Contributor

LGTM!

@HeartSaVioR HeartSaVioR merged commit 5c2b585 into redis:master Oct 23, 2016
HeartSaVioR pushed a commit that referenced this pull request Oct 24, 2016
* Adding Jedis HSTRLEN command request #1404
@HeartSaVioR
Copy link
Contributor

Tests polished via 6a933f1 for master, and 128cb2d for 2.10.

@smadasu Thanks for the contribution!

@marcosnils
Copy link
Contributor

@HeartSaVioR LGTM!.

@smadasu smadasu deleted the add_HSTRLEN_command branch October 24, 2016 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants