This is an automated email from the ASF dual-hosted git repository.

jerrypeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 4a5bd6c  Make sure that output_bytes are of type bytes (#1878)
4a5bd6c is described below

commit 4a5bd6c66fa0f0c018ff824ba83dd83384d13d3c
Author: Sanjeev Kulkarni <sanjee...@gmail.com>
AuthorDate: Thu May 31 16:19:06 2018 -0700

    Make sure that output_bytes are of type bytes (#1878)
    
    * Make sure that output_bytes are of type bytes
    
    * Do the same for publish method in the context as well
---
 pulsar-functions/instance/src/main/python/contextimpl.py     | 2 +-
 pulsar-functions/instance/src/main/python/python_instance.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pulsar-functions/instance/src/main/python/contextimpl.py 
b/pulsar-functions/instance/src/main/python/contextimpl.py
index 3463d7b..dea4ca0 100644
--- a/pulsar-functions/instance/src/main/python/contextimpl.py
+++ b/pulsar-functions/instance/src/main/python/contextimpl.py
@@ -134,7 +134,7 @@ class ContextImpl(pulsar.Context):
       serde_klass = util.import_class(self.user_code_dir, serde_class_name)
       self.publish_serializers[serde_class_name] = serde_klass()
 
-    output_bytes = 
self.publish_serializers[serde_class_name].serialize(message)
+    output_bytes = 
bytes(self.publish_serializers[serde_class_name].serialize(message))
     self.publish_producers[topic_name].send_async(output_bytes, None)
 
   def ack(self, msgid, topic):
diff --git a/pulsar-functions/instance/src/main/python/python_instance.py 
b/pulsar-functions/instance/src/main/python/python_instance.py
index 6a82b0a..7d6dc65 100644
--- a/pulsar-functions/instance/src/main/python/python_instance.py
+++ b/pulsar-functions/instance/src/main/python/python_instance.py
@@ -233,7 +233,7 @@ class PythonInstance(object):
       if self.producer is None:
         self.setup_producer()
       try:
-        output_bytes = self.output_serde.serialize(output)
+        output_bytes = bytes(self.output_serde.serialize(output))
       except:
         self.current_stats.nserialization_exceptions += 1
         self.total_stats.nserialization_exceptions += 1

-- 
To stop receiving notification emails like this one, please contact
jerryp...@apache.org.

Reply via email to