Hive 行格式

描述

Spark 在 CREATE TABLETRANSFORM 子句中支持 Hive 行格式,以指定 serde 或文本分隔符。在 CREATE TABLETRANSFORM 子句的 row_format 中,有两种方法可以定义行格式。

  1. SERDE 子句用于指定自定义 SerDe 类。
  2. DELIMITED 子句用于为原生 SerDe 指定分隔符、转义字符、空字符等。

语法

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 ]

参数