maropu commented on a change in pull request #29056:
URL: https://github.com/apache/spark/pull/29056#discussion_r456168024
##########
File path: docs/sql-ref-syntax-ddl-create-table-hiveformat.md
##########
@@ -114,9 +162,44 @@ CREATE TABLE student (id INT, name STRING)
PARTITIONED BY (age INT);
--Use Row Format and file format
-CREATE TABLE student (id INT,name STRING)
+CREATE TABLE student (id INT, name STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
+
+--Use complex datatype
+CREATE EXTERNAL TABLE family(
+ name STRING,
+ friends ARRAY<STRING>,
+ children MAP<STRING, INT>,
+ address STRUCT<street: STRING, city: STRING>
+ )
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' ESCAPED BY '\\'
+ COLLECTION ITEMS TERMINATED BY '_'
+ MAP KEYS TERMINATED BY ':'
+ LINES TERMINATED BY '\n'
+ NULL DEFINED AS 'foonull'
+ STORED AS TEXTFILE
+ LOCATION '/tmp/family/';
+
+--Use native serde
+CREATE TABLE avroExample
+ ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
+ STORED AS INPUTFORMAT
'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
+ OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
+ TBLPROPERTIES ('avro.schema.literal'='{ "namespace": "org.apache.hive",
+ "name": "first_schema",
+ "type": "record",
+ "fields": [
+ { "name":"string1", "type":"string" },
+ { "name":"string2", "type":"string" }
+ ] }');
+
+--Use custom serde(need load the class first)
Review comment:
I feel `(need load the class first)` looks ambiguous for users. If you
want to describe this, I think you need to describe more.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]