[ 
https://issues.apache.org/jira/browse/BEAM-7021?focusedWorklogId=249755&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249755
 ]

ASF GitHub Bot logged work on BEAM-7021:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/May/19 01:08
            Start Date: 29/May/19 01:08
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on pull request #8698: [BEAM-7021] 
Added ToString transform on Python SDK
URL: https://github.com/apache/beam/pull/8698#discussion_r288351781
 
 

 ##########
 File path: sdks/python/apache_beam/transforms/combiners_test.py
 ##########
 @@ -393,6 +393,43 @@ def test_global_fanout(self):
           | beam.CombineGlobally(combine.MeanCombineFn()).with_fanout(11))
       assert_that(result, equal_to([49.5]))
 
+  def test_tostring_elements(self):
+    with TestPipeline() as p:
+      result = (
+        p
+        | Create([1, 1, 2, 3])
+        | combine.ToString.Element()
+      )
+      assert_that(result, equal_to(["1", "1", "2", "3"]))
+
+  def test_tostring_iterables(self):
+    with TestPipeline() as p:
+      result = (
+        p
+        | Create([("one", "two", "three"), ("four", "five", "six")])
+        | combine.ToString.Iterables()
+      )
+      assert_that(result, equal_to(["one,two,three", "four,five,six"]))
+
+  def test_tostring_iterables_with_delimeter(self):
+    with TestPipeline() as p:
+      result = (
+        p
+        | Create([("one", "two", "three"), ("four", "five", "six")])
+        | combine.ToString.Iterables("\t")
+      )
+      assert_that(result, equal_to(["one\ttwo\tthree", "four\tfive\tsix"]))
+
+  def test_tostring_kvs(self):
+    with TestPipeline() as p:
+      result = (p | Create([("one", 1), ("tow", 2)]) | combine.ToString.Kvs() )
 
 Review comment:
   spelling nit: "tow" -> "two"
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 249755)
    Time Spent: 40m  (was: 0.5h)

> ToString transform for Python SDK
> ---------------------------------
>
>                 Key: BEAM-7021
>                 URL: https://issues.apache.org/jira/browse/BEAM-7021
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Rose Nguyen
>            Assignee: Shehzaad Nakhoda
>            Priority: Minor
>              Labels: starter
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> PTransforms for converting a PCollection or  PCollection
> Iterable to a PCollection String
> It should offer the same API as its Java counterpart: 
> [https://github.com/apache/beam/blob/11a977b8b26eff2274d706541127c19dc93131a2/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/ToString.java]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to