You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/02 14:40:15 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #31010: [SPARK-33976][SQL] Spark script TRANSFORM related change doc

AngersZhuuuu commented on a change in pull request #31010:
URL: https://github.com/apache/spark/pull/31010#discussion_r606266958



##########
File path: docs/sql-ref-syntax-qry-select-transform.md
##########
@@ -0,0 +1,297 @@
+---
+layout: global
+title: TRANSFORM
+displayTitle: TRANSFORM
+license: |
+  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.
+---
+
+### Description
+
+The `TRANSFORM` clause is used to specifies a hive-style transform (SELECT TRANSFORM/MAP/REDUCE)
+query specification to transform the input by forking and running the specified script. Users can
+plug in their own custom mappers and reducers in the data stream by using features natively supported
+in the Spark/Hive language. e.g. in order to run a custom mapper script - map_script - and a custom
+reducer script - reduce_script - the user can issue the following command which uses the TRANSFORM
+clause to embed the mapper and the reducer scripts.
+
+Currently, Spark's script transform support two mode:
+
+    1. Without Hive: It means we run Spark SQL without hive support, in this mode, we can use default format 
+       by treating data as STRING and use Spark's own SerDe.
+    2. WIth Hive: It means we run Spark SQL with Hive support, in this mode, when we use default format, 
+       it will be treated as Hive default fomat. And we can use Hive supported SerDe to process data.
+
+In both mode with default format, columns will be transformed to STRING and delimited by TAB before feeding
+to the user script, Similarly, all NULL values will be converted to the literal string \N in order to

Review comment:
       > Quote \N - what ASCII value is it, for reference? 0?
   
   Just '\N' a string




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org