Polber commented on code in PR #30895:
URL: https://github.com/apache/beam/pull/30895#discussion_r1559858954


##########
sdks/python/apache_beam/yaml/tests/maptofields.yaml:
##########
@@ -0,0 +1,62 @@
+#
+# 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#  Row(word='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#  Row(word='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.
+#
+
+pipelines:
+  - pipeline:
+      type: chain
+      transforms:
+        - type: Create
+          config:
+            elements:
+              - {label: "11a", timestamp: 0}
+              - {label: "37a", timestamp: 1}
+              - {label: "389a", timestamp: 2}
+        - type: MapToFields
+          config:
+            language: sql
+            append: true
+            fields:
+              label_copy: label
+        - type: AssertEqual
+          config:
+            elements:
+              - { label: "11a", timestamp: 0, label_copy: "11a" }
+              - { label: "37a", timestamp: 1, label_copy: "37a" }
+              - { label: "389a", timestamp: 2, label_copy: "389a" }
+
+  - pipeline:
+      type: chain
+      transforms:
+        - type: Create
+          config:
+            elements:
+              - { label: "11a", rank: 0 }
+              - { label: "37a", rank: 1 }
+              - { label: "389a", rank: 2 }
+        - type: MapToFields
+          config:
+            language: sql
+            append: true
+            drop: [ rank ]
+            fields:
+              timestamp: "`rank`"

Review Comment:
   Right, if someone has a schema that contains a reserved keyword, we don't 
want to override the function by auto-backticking in case they actually wanted 
to perform that function on a different field (or the same).
   
   As far as documenting, I'm in agreement the more docs, the better, but I'm 
not really sure what would need to be explicitly called out here. The query is 
a **valid** SQL statement (i.e. reserved keywords are escaped when using as 
column names), and this PR doesn't really change that. It just makes it to 
where the YAML tags work as expected



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