20d68dc2f4
### What changes were proposed in this pull request? Extract common doc about hive format for `sql-ref-syntax-ddl-create-table-hiveformat.md` and `sql-ref-syntax-qry-select-transform.md` to refer. ![image](https://user-images.githubusercontent.com/46485123/115802193-04641800-a411-11eb-827d-d92544881842.png) ### Why are the changes needed? Improve doc ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Not need Closes #32264 from AngersZhuuuu/SPARK-35159. Authored-by: Angerszhuuuu <angers.zhu@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
2.3 KiB
2.3 KiB
layout | title | displayTitle | license |
---|---|---|---|
global | Hive Row Format | Hive Row Format | 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
Spark supports a Hive row format in CREATE TABLE
and TRANSFORM
clause to specify serde or text delimiter.
There are two ways to define a row format in row_format
of CREATE TABLE
and TRANSFORM
clauses.
SERDE
clause to specify a custom SerDe class.DELIMITED
clause to specify a delimiter, an escape character, a null character, and so on for the native SerDe.
Syntax
row_format:
SERDE serde_class [ WITH SERDEPROPERTIES (k1=v1, k2=v2, ... ) ]
| DELIMITED [ FIELDS TERMINATED BY fields_terminated_char [ ESCAPED BY escaped_char ] ]
[ COLLECTION ITEMS TERMINATED BY collection_items_terminated_char ]
[ MAP KEYS TERMINATED BY map_key_terminated_char ]
[ LINES TERMINATED BY row_terminated_char ]
[ NULL DEFINED AS null_char ]
Parameters
-
SERDE serde_class
Specifies a fully-qualified class name of custom SerDe.
-
SERDEPROPERTIES
A list of key-value pairs that is used to tag the SerDe definition.
-
FIELDS TERMINATED BY
Used to define a column separator.
-
COLLECTION ITEMS TERMINATED BY
Used to define a collection item separator.
-
MAP KEYS TERMINATED BY
Used to define a map key separator.
-
LINES TERMINATED BY
Used to define a row separator.
-
NULL DEFINED AS
Used to define the specific value for NULL.
-
ESCAPED BY
Used for escape mechanism.