derrickaw commented on code in PR #35435:
URL: https://github.com/apache/beam/pull/35435#discussion_r2211711012


##########
sdks/python/apache_beam/yaml/tests/bigTable.yaml:
##########
@@ -0,0 +1,172 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+fixtures:
+  - name: BT_TABLE
+    type: "apache_beam.yaml.integration_tests.temp_bigtable_table"
+    config:
+      project: "apache-beam-testing"
+  - name: TEMP_DIR
+    # Need distributed filesystem to be able to read and write from a 
container.
+    type: "apache_beam.yaml.integration_tests.gcs_temp_dir"
+    config:
+      bucket: "gs://temp-storage-for-end-to-end-tests/temp-it"
+
+  # Tests for BigTable YAML IO
+
+pipelines:
+  - pipeline:
+      type: chain
+      transforms:
+        - type: Create
+          config:
+            elements:
+              - {key: 'row1',
+                type: 'SetCell',
+                family_name: "cf1",
+                column_qualifier: "cq1",
+                value: "value1",
+                timestamp_micros: -1}
+              - {key: 'row1',
+                  type: 'SetCell',
+                  family_name: "cf2",
+                  column_qualifier: "cq1",
+                  value: "value2",
+                  timestamp_micros: 1000}
+#              # Deletes all cells in a specific column, optionally within a 
time range.
+#              - {key: 'row2',
+#                  type: 'DeleteFromColumn',
+#                  family_name: "cf1",
+#                  column_qualifier: "cq1",
+#                  start_timestamp_micros: 2000,
+#                  end_timestamp_micros: 5000 }
+#
+#              # Deletes all cells in a specific column family.
+#              - {key: 'row3',
+#                  type: 'DeleteFromFamily',
+#                  family_name: "cf2" }
+#
+#              # Deletes all cells in a specific row.
+#              - {key: 'row4',
+#                  type: 'DeleteFromRow' }
+        - type: LogForTesting
+#          commenting for now, will implement after everyone gives feedback on 
PR
+        - type: MapToFields
+          name: ConvertStringsToBytes
+          config:
+            language: python
+            fields:
+              # For 'SetCell' and 'DeleteFromColumn'
+              key:
+                callable: |
+                  def convert_to_bytes(row):
+                    return bytes(row.key, 'utf-8') if "key" in row._fields 
else None
+              family_name:
+                callable: |
+                  def convert_to_bytes(row):
+                    return bytes(row.family_name, 'utf-8') if 'family_name' in 
row._fields else None
+              column_qualifier:
+                callable: |
+                  def convert_to_bytes(row):
+                    return bytes(row.column_qualifier, 'utf-8') if 
'column_qualifier' in row._fields else None
+              value:
+                callable: |
+                  def convert_to_bytes(row):
+                    return bytes(row.value, 'utf-8') if 'value' in row._fields 
else None
+              # The 'type', 'timestamp_micros', 'start_timestamp_micros', 
'end_timestamp_micros'
+              # fields are already of the correct type (String, Long) or are 
optional.
+              # We only need to convert fields that are Strings in YAML but 
need to be Bytes in Java.
+
+
+
+
+        - type: WriteToBigTable
+          config:
+            project: 'apache-beam-testing'
+            instance: 'bt-write-tests'
+            table: 'test-table'
+#      options:
+#        project: "apache-beam-testing"
+#        temp_location: "{TEMP_DIR}"
+#  - pipeline:
+#      type: chain
+#      transforms:
+#        - type: ReadFromBigTable
+#          config:
+#            project: 'apache-beam-testing'
+#            instance: 'bt-write-tests'
+#            table: 'test-table'
+#        - type: MapToFields # Convert bytes back to strings for comparison
+#          name: ConvertBytesToStrings
+#          config:
+#            language: python
+#            fields:
+#              key:
+#                callable: |
+#                  def convert_to_string(row):
+#                    return row.key.decode('utf-8') if row.key is not None 
else None
+#              family_name:
+#                callable: |
+#                  def convert_to_string(row):
+#                    return row.family_name.decode('utf-8') if row.family_name 
is not None else None
+#              column_qualifier:
+#                callable: |
+#                  def convert_to_string(row):
+#                    return row.column_qualifier.decode('utf-8') if 
row.column_qualifier is not None else None
+#              value:
+#                callable: |
+#                  def convert_to_string(row):
+#                    return row.value.decode('utf-8') if row.value is not None 
else None
+#        - type: AssertEqual
+#          config:
+#            elements:

Review Comment:
   can we use ReadFromBigTable?



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to