Repository: calcite Updated Branches: refs/heads/master 919b31f0e -> 04c5ff9e8
[CALCITE-1189] Get the bytes from a string as UTF-8 When we don't specify a Charset to use when creating bytes from a String, we fall back to the default charset for the JVM. Since Protobuf is requiring UTF-8 bytes for this attribute in the message, we also need to give it bytes which can be parsed into a UTF-8 string. Project: http://git-wip-us.apache.org/repos/asf/calcite/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/04c5ff9e Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/04c5ff9e Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/04c5ff9e Branch: refs/heads/master Commit: 04c5ff9e8ae0627025406c627f8474913ba863a0 Parents: 919b31f Author: Josh Elser <[email protected]> Authored: Tue Apr 5 10:13:24 2016 -0400 Committer: Josh Elser <[email protected]> Committed: Tue Apr 5 10:24:35 2016 -0400 ---------------------------------------------------------------------- .../main/java/org/apache/calcite/avatica/remote/TypedValue.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite/blob/04c5ff9e/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java ---------------------------------------------------------------------- diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java index bbf440c..0a29ca3 100644 --- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java +++ b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java @@ -35,6 +35,8 @@ import java.util.Date; import java.util.List; import java.util.Objects; +import static java.nio.charset.StandardCharsets.UTF_8; + /** Value and type. * * <p>There are 3 representations: @@ -385,7 +387,7 @@ public class TypedValue { builder.setBytesValues(HBaseZeroCopyByteString.wrap(bytes)); return; case STRING: - builder.setStringValueBytes(HBaseZeroCopyByteString.wrap(((String) o).getBytes())); + builder.setStringValueBytes(HBaseZeroCopyByteString.wrap(((String) o).getBytes(UTF_8))); return; case PRIMITIVE_CHAR: case CHARACTER:
