ahmedabu98 commented on code in PR #38206:
URL: https://github.com/apache/beam/pull/38206#discussion_r3119411623


##########
sdks/python/apache_beam/transforms/sql_test.py:
##########
@@ -149,6 +162,34 @@ def test_row(self):
           | SqlTransform("SELECT a*a as s, LENGTH(b) AS c FROM PCOLLECTION"))
       assert_that(out, equal_to([(1, 1), (4, 1), (100, 2)]))
 
+  @staticmethod
+  def recover_to_python_type(input):
+    fields = []
+    for field in input:
+      print(field)
+      if hasattr(field, 'type_byte') and hasattr(field, 'payload'):
+        obj = coders.FastPrimitivesCoder().decode(
+            field.type_byte.to_bytes() + field.payload)
+        fields.append(obj)
+      else:
+        fields.append(field)
+    return tuple(fields)
+
+  def test_row_user_type(self):
+    with TestPipeline() as p:
+      out = (
+          p | beam.Create([
+              UserTypeRow(1, Aribitrary(1.0), 1 + 2.5j),
+              UserTypeRow(1, Aribitrary("abc"), -1j),
+          ])
+          | SqlTransform("SELECT arb, complex FROM PCOLLECTION")
+          # TODO: recover to user type. Currently pipeline can run,

Review Comment:
   Should we remove it then?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to