{"id":324995,"date":"2021-06-16T15:00:35","date_gmt":"2021-06-16T15:00:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324995"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2021-06-16T15:00:35","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324995","title":{"rendered":"\u0427\u0442\u043e \u043d\u0430\u043c \u0441\u0442\u043e\u0438\u0442\u2026 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c JSON \u0432 Data Platform"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/leroy_merlin\/blog\/561072\/\">\u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u043a\u0430\u043a \u043c\u044b \u0448\u043b\u0438 \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043d\u0430\u0448\u0435\u0439 Data Platform. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u00ab\u0436\u0435\u043b\u0443\u0434\u043e\u043a\u00bb \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0438\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 (\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e \u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435), \u0442\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u00bb \u0441\u0445\u0435\u043c\u044b \u2014 \u0442\u043e\u0439, \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 Apache NiFi.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/500\/871\/5bd\/5008715bd754c4f8224f266d2f1ada0f.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.\" width=\"1431\" height=\"488\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/figcaption><\/figure>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 350 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435 \u043e\u043d\u0438 \u00ab\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u00bb \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e \u0441\u0443\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430\u0445 \u0442\u043e\u0440\u0433\u043e\u0432\u043e\u0439 \u0441\u0435\u0442\u0438, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u00ab\u0437\u043e\u043e\u043f\u0430\u0440\u043a \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f\u00bb \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e Framework\u2019\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0435\u0433\u043e \u0438 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432 Data Platform, \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c.  <\/p>\n<p>\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 framework\u2019\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/531\/1f4\/271\/5311f4271d936464fd88ab239d5e4e74.png\" alt=\"\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum \" title=\"\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum \" width=\"1029\" height=\"440\"><figcaption>\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum <\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 Kafka \u0432 AVRO-\u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Apache NiFi, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 parquet \u043d\u0430 S3. <\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u00ab\u0441\u044b\u0440\u044b\u043c\u0438\u00bb \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark\u2019\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ol>\n<li>\n<p>Compaction \u2013 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0446\u0435\u043b\u044c\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u00ab\u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435\u00bb), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <em>distinct()<\/em> \u0438 \u0437\u0430\u0442\u0435\u043c <em>coalesce(<\/em>). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 S3. \u042d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0437\u0430\u0442\u0435\u043c \u0434\u043b\u044f parsing&#8217;\u0430 , \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u0430\u0440\u0445\u0438\u0432\u043e\u043c \u0441\u044b\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb;<\/p>\n<\/li>\n<li>\n<p>Parsing \u2013 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0444\u0430\u0437\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0443, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u0432 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0436\u0430\u0442\u044b\u0445 (\u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e gzip) CSV-\u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 S3.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u2013 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 CSV-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432 ODS-\u0441\u043b\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430: \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f external table \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 S3 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/docs.greenplum.org\/6-8\/pxf\/read_s3_s3select.html\">PXF S3 connector<\/a>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c pgsql \u043f\u0435\u0440\u0435\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b ODS-\u0441\u043b\u043e\u044f Greenplum<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Airflow.<\/p>\n<\/li>\n<\/ol>\n<p>DAG\u2019\u0438 \u0434\u043b\u044f Airflow \u0443 \u043d\u0430\u0441 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. Parsing \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0442\u0430\u043a \u043a\u0430\u043a, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c:  <\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 ODS-\u0441\u043b\u043e\u0435 \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b-\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Git \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 YAML-\u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a: \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, S3-\u0431\u0430\u043a\u0435\u0442, \u0438\u043c\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438\u043c\u044f \u0438 email \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0442.\u043f.);<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u043b\u043e\u044f ODS (\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u043b\u043e\u0441\u043a\u0438\u0435, \u0442\u0430\u043a \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432 ODS-\u0441\u043b\u043e\u0435 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c). \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0414\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u043b \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0442\u0435\u0442. \u0423 \u043d\u0430\u0441 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 \u0443\u0436\u0435 \u043c\u0430\u044f\u0447\u0438\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434 \u0441\u043e\u0431\u043e\u0439 \u0438\u043c\u0435\u043b MongoDB \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MongoDB Kafka source connector \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Kafka. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e framework\u2019\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438 \u043d\u0430 S3 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON &#8212; \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 &#171;\u043a\u0430\u043a \u0435\u0441\u0442\u044c&#187;, \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 parquet \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Apache NiFi.  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0448\u0430\u0433 Compaction. \u0415\u0433\u043e \u043a\u043e\u0434, \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u044e \u00ab\u043e\u0431\u0432\u044f\u0437\u043a\u0443\u00bb \u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439:<\/p>\n<pre><code class=\"python\">df = spark.read.format(in_format) \\                .options(**in_options) \\                .load(path) \\                .distinct()     new_df = df.coalesce(div) new_df.write.mode(\"overwrite\") \\              .format(out_format) \\             .options(**out_options) \\             .save(path)<\/code><\/pre>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 JSON-\u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u043e \u0432\u043e\u043b\u0435\u0439-\u043d\u0435\u0432\u043e\u043b\u0435\u0439 \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 JSON\u2019\u043e\u0432 Spark \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 mergeSchema, \u0442.\u0435. \u043c\u044b \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043a\u0430\u0437\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u0412\u0435\u0434\u044c \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u2013 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0440\u0443\u043f\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb.   <\/p>\n<p>\u041f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0443\u043a\u0440\u0443\u043f\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 S3. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431:    <\/p>\n<blockquote>\n<p><em>\u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0441 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u0430\u043a DataFrame \u0441 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u043e\u0439, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0432\u0435\u0441\u044c JSON-\u043e\u0431\u044a\u0435\u043a\u0442.<\/em><\/p>\n<\/blockquote>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p><strong>file1:<\/strong><\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 1, \u00abproductName\u00bb: \u00abProductName 1\u00bb, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}} {\u00abproductId\u00bb: 2, \u00abprice\u00bb: 10.01, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}}<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u042d\u0442\u043e \u0444\u0430\u0439\u043b \u0441 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u0433\u0434\u0435 1 \u0441\u0442\u0440\u043e\u043a\u0430 = 1 \u043e\u0431\u044a\u0435\u043a\u0442. \u041e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c, \u043f\u043e \u0441\u0443\u0442\u0438, JSON-\u043e\u043c, \u043e\u043d \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e JSON-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c JSON-\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 S3 (\u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f &#171;\u0433\u0430\u043b\u043e\u0447\u043a\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Apache NiFi).<\/p>\n<p>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"python\"># \u0427\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 df = spark.read \\           .format(\"csv\") \\           .option(\"sep\", \"\\a\") \\           .load(\"file1.json\")  # \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f DataFrame df.printSchema()  root  |-- _c0: string (nullable = true)  # \u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 df.show()  +--------------------+ |                 _c0| +--------------------+ |{\"productId\": 1, ...| |{\"productId\": 2, ...| +--------------------+<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0442\u0443\u0442 \u0447\u0438\u0442\u0430\u0435\u043c JSON \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CSV, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <u>\u043d\u0438\u043a\u043e\u0433\u0434\u0430<\/u> \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bell_character\">Bell character<\/a>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c DataFrame \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c <em>dicstinct()<\/em> \u0438 \u0437\u0430\u0442\u0435\u043c <em>coalesce()<\/em>, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0446\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430:   <\/p>\n<pre><code class=\"python\"># \u0414\u043b\u044f parquet in_format = \"parquet\" in_options = {}  # \u0414\u043b\u044f JSON in_format = \"csv\" in_options = {\"sep\": \"\\a\"}<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 DataFrame \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 S3 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u044f\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438:           <\/p>\n<pre><code class=\"python\">df.write.mode(\"overwrite\") \\            .format(out_format) \\ \t\t\t\t.options(**out_options) \\   \t\t\t\t.save(path)    # \u0434\u043b\u044f JSON      out_format = \"text\"  out_options = {\"compression\": \"gzip\"}    # \u0434\u043b\u044f parquet    out_format = input_format  out_options = {\"compression\": \"snappy\"}<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044b\u043b \u0448\u0430\u0433 Parsing. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u043f\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u0432 \u043e\u0434\u043d\u0443 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u0434\u0435\u0442\u0430\u043b\u044c: JSON -\u0444\u0430\u0439\u043b, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 parquet, \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 JSON-\u0444\u0430\u0439\u043b\u0430 Spark \u0443\u043c\u0435\u0435\u0442 \u0441\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0445\u0435\u043c\u0443, \u0438 \u0434\u0430\u0436\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u043c\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 mergeSchema. \u041d\u043e \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u044b \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0443\u043f\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e. \u0411\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u043f\u043e\u043b\u044f \u00ab<em>field_1<\/em>\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u043e\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u0422\u043e\u0433\u0434\u0430 \u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0441\u044f Spark DataFrame \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0438 \u043d\u0430\u0448 Parsing, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u043e\u0441\u0442\u043e-\u043d\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043f\u0430\u0434\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0435 \u043f\u043e\u043b\u0435.   <\/p>\n<p>\u041f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c,\u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c:<\/p>\n<p><strong>file1<\/strong> (\u0442\u043e\u0442 \u0436\u0435 \u0447\u0442\u043e \u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435):<\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 1, \u00abproductName\u00bb: \u00abProductName 1\u00bb, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}} {\u00abproductId\u00bb: 2, \u00abprice\u00bb: 10.01, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}}<\/code><\/pre>\n<p><strong>file2<\/strong>:<\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 3, \u00abproductName\u00bb: \u00abProductName 3\u00bb, \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5, \u00abpackage\u00bb: [10, 20.5, 30]}}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c Spark\u2019\u043e\u043c \u0438\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f DataFrame:<\/p>\n<pre><code class=\"python\">df = spark.read \\           .format(\"json\") \\           .option(\"multiline\", \"false\") \\           .load(path) df.printSchema() df.show()<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u0439\u043b (\u0441\u0445\u0435\u043c\u0430 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435):<\/p>\n<pre><code>root  |-- dimensions: struct (nullable = true)  |    |-- height: double (nullable = true)  |    |-- length: long (nullable = true)  |    |-- width: long (nullable = true)  |-- price: double (nullable = true)  |-- productId: long (nullable = true)  |-- productName: string (nullable = true)  |-- tags: array (nullable = true)  |    |-- element: string (containsNull = true)  +--------------+-----+---------+-------------+--------------+ |    dimensions|price|productId|  productName|          tags| +--------------+-----+---------+-------------+--------------+ |[12.5, 10, 12]| null|        1|ProductName 1|[tag 1, tag 2]| |[12.5, 10, 12]|10.01|        2|         null|[tag 1, tag 2]| +--------------+-----+---------+-------------+--------------+<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b (\u0441\u0445\u0435\u043c\u0430 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435)<em>:<\/em><\/p>\n<pre><code>root  |-- dimensions: struct (nullable = true)  |    |-- height: double (nullable = true)  |    |-- length: long (nullable = true)  |    |-- package: array (nullable = true)  |    |    |-- element: double (containsNull = true)  |    |-- width: long (nullable = true)  |-- productId: long (nullable = true)  |-- productName: string (nullable = true)  +--------------------+---------+-------------+ |          dimensions|productId|  productName| +--------------------+---------+-------------+ |[12.5, 10, [10.0,...|        3|ProductName 3| +--------------------+---------+-------------+<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, Spark \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u044b\u0441\u0442\u0440\u043e\u0438\u043b \u0441\u0445\u0435\u043c\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0415\u0441\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043f\u043e\u043b\u044f, \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u043e\u0439, \u0442\u043e \u0432 DataFrame \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 null (\u043f\u043e\u043b\u044f price \u0438 productName \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430).  <em> <\/em><\/p>\n<p>\u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043d\u044b\u0435, \u0438 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0431\u0430 \u0444\u0430\u0439\u043b\u0430) \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u043b\u043e\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443,<\/p>\n<pre><code>root  |-- price: double (nullable = true)  |-- productId: long (nullable = true)  |-- productName: string (nullable = true)<\/code><\/pre>\n<p>\u0430 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0430\u0441 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b \u00ab\u0430-\u043b\u044f <em>file2<\/em>\u00bb, \u0433\u0434\u0435 \u043f\u043e\u043b\u044f \u00ab<em>price<\/em>\u00bb \u043d\u0435\u0442 \u043d\u0438 \u0443 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e Spark \u0443\u043f\u0430\u0434\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u043f\u043e\u043b\u044f \u00abprice\u00bb \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e DataFrame. \u0421 parquet-\u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0430\u043c parquet-\u0444\u0430\u0439\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 AVRO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <u>\u043f\u043e\u043b\u043d\u0443\u044e<\/u> \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u0430 <u>\u043f\u043e\u043b\u043d\u0430\u044f<\/u> \u0441\u0445\u0435\u043c\u0430 \u0435\u0441\u0442\u044c \u0438 \u0432 parquet-\u0444\u0430\u0439\u043b\u0435.<\/p>\n<p>\u0415\u0449\u0435 \u043d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043f\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0438 \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u0432\u0448\u0438\u0439 \u0441\u0435\u0431\u044f \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e framework\u2019\u0430, \u0430 \u043d\u0435 \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 JSON\u2019\u043e\u0432 \u2013 \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0447\u0442\u0435\u043d\u0438\u044f JSON-\u0444\u0430\u0439\u043b\u043e\u0432 \u0441 S3.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 JSON-\u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443 JSON-\u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0443\u0436\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u0441\u0445\u0435\u043c\u044b.  \u0422\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 JSON\u2019\u0435 \u043d\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u043e\u043b\u044f, \u0442\u043e \u0432 \u0441\u0430\u043c\u043e\u043c DataFrame \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442, \u043d\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043a\u0430\u043a null:<\/p>\n<pre><code class=\"python\">df = spark.read \\           .format(\"json\") \\           .option(\"multiline\",\"false\") \\           .schema(df_schema) \\           .load(path)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043c\u044b\u0441\u043b\u044c \u0431\u044b\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445  &#8212; \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0432 YAML-\u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0438\u043c\u0435\u044e\u0449\u0435\u043c\u0441\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u041d\u043e \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0447\u0435\u0440\u0435\u0437 Kafka, \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f Kafka Schema Registry, \u0430 \u0441\u0445\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 <a href=\"https:\/\/json-schema.org\/\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0434\u043b\u044f JSON \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/a> (\u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, Kafka Schema Registry \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c). <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c \u0438\u0437 Kafka Schema Registry \u0441\u0445\u0435\u043c\u0443<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0435\u0435 \u0432 pyspark.sql.types.StructType \u2013 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># 1. \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 Kafka Schema Registry REST API \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445  # 2. \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e schema \u0438 \u0434\u0430\u043b\u0435\u0435: df_schema = StructType.fromJson(schema)<\/code><\/pre>\n<ul>\n<li>\n<p>\u041d\u0443 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c JSON-\u0444\u0430\u0439\u043b\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b\u2026 \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 JSON-\u0441\u0445\u0435\u043c\u044b, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 Spark\u2019\u0443. \u041f\u0443\u0441\u0442\u044c \u0438\u043c\u0435\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 JSON \u0438\u0437 <em>file2<\/em> \u0432\u044b\u0448\u0435. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u0441\u0445\u0435\u043c\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON \u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432:<\/p>\n<pre><code class=\"python\">df.schema.json()  <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0441\u0445\u0435\u043c\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"json\">{     \"fields\":     [         {             \"metadata\": {},             \"name\": \"dimensions\",             \"nullable\": true,             \"type\":             {                 \"fields\":                 [                     {\"metadata\":{},\"name\":\"height\",\"nullable\":true,\"type\":\"double\"},                     {\"metadata\":{},\"name\":\"length\",\"nullable\":true,\"type\":\"long\"},                     {\"metadata\":{},\"name\":\"width\",\"nullable\":true,\"type\":\"long\"}                 ],                 \"type\": \"struct\"             }         },         {             \"metadata\": {},             \"name\": \"price\",             \"nullable\": true,             \"type\": \"double\"         },         {             \"metadata\": {},             \"name\": \"productId\",             \"nullable\": true,             \"type\": \"long\"         },         {             \"metadata\": {},             \"name\": \"productName\",             \"nullable\": true,             \"type\": \"string\"         },         {             \"metadata\": {},             \"name\": \"tags\",             \"nullable\": true,             \"type\":             {                 \"containsNull\": true,                 \"elementType\": \"string\",                 \"type\": \"array\"             }         }     ],     \"type\": \"struct\" } <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e <u>\u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 JSON-\u0441\u0445\u0435\u043c\u044b<\/u>. <\/p>\n<p>\u00ab\u041d\u043e \u043c\u044b \u0436\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0435, \u0443 \u043a\u043e\u0433\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e JSON-\u0441\u0445\u0435\u043c\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442, \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 Spark\u2019\u0443<em>\u00bb<\/em> &#8212;<em> <\/em>\u043f\u043e\u0434\u0443\u043c\u0430\u043b\u0438 \u043c\u044b \u0438 \u2026 \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0435 \u043e\u0448\u0438\u0431\u043b\u0438\u0441\u044c, \u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u0443\u043f\u043e\u0440\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u0438\u0437 \u0441\u0435\u0440\u0438\u0438: <\/p>\n<blockquote>\n<p><em>\u043a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0443\u0436\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e DataFrame \u0432 JSON, \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e<\/em><\/p>\n<\/blockquote>\n<p>\u043b\u0438\u0431\u043e \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/zalando-incubator\/spark-json-schema\">https:\/\/github.com\/zalando-incubator\/spark-json-schema<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0431\u044b \u043f\u043e\u0434\u043e\u0448\u0435\u043b, \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 Scala, \u0430 \u043d\u0435 pySpark \u2026 <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 \u043c\u0430\u044f\u0447\u0438\u043b\u0430 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0430 \u043f\u0438\u0441\u0430\u0442\u044c SchemaConverter. \u0421\u043f\u0435\u0440\u0432\u0430 \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043b\u043e\u0439 \u043a\u0440\u043e\u0432\u044c\u044e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u2013 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0431\u044b\u043b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u00ab\u0441\u043a\u043e\u0440\u043c\u0438\u0442\u044c\u00bb \u0435\u043c\u0443 \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0435 \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. <\/p>\n<p>\u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0431\u044b\u043b \u043e\u0434\u0438\u043d \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. \u041a\u0430\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u0430 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 DataPlatform \u0431\u044b\u043b\u0430 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u0430: NiFi \u0447\u0438\u0442\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Kafka, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u043b \u0438\u0445 \u0432 parquet, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u00ab\u043f\u0440\u0438\u0431\u0438\u0442\u0443\u044e \u0433\u0432\u043e\u0437\u0434\u044f\u043c\u0438\u00bb \u0432 NiFi \u0441\u0445\u0435\u043c\u0443 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 AVRO-schema, \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u043d\u0430 S3. \u0421\u0445\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u0441 \u043a\u0443\u0447\u0435\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043f\u043e\u043b\u0435\u0439 &#8212; \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441 \u0432 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0443\u044e \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \ud83d\ude42<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">root  |-- taskId: string (nullable = true)  |-- extOrderId: string (nullable = true)  |-- taskStatus: string (nullable = true)  |-- taskControlStatus: string (nullable = true)  |-- documentVersion: long (nullable = true)  |-- buId: long (nullable = true)  |-- storeId: long (nullable = true)  |-- priority: string (nullable = true)  |-- created: struct (nullable = true)  |    |-- createdBy: string (nullable = true)  |    |-- created: string (nullable = true)  |-- lastUpdateInformation: struct (nullable = true)  |    |-- updatedBy: string (nullable = true)  |    |-- updated: string (nullable = true)  |-- customerId: string (nullable = true)  |-- employeeId: string (nullable = true)  |-- pointOfGiveAway: struct (nullable = true)  |    |-- selected: string (nullable = true)  |    |-- available: array (nullable = true)  |    |    |-- element: string (containsNull = true)  |-- dateOfGiveAway: string (nullable = true)  |-- dateOfGiveAwayEnd: string (nullable = true)  |-- pickingDeadline: string (nullable = true)  |-- storageLocation: string (nullable = true)  |-- currentStorageLocations: array (nullable = true)  |    |-- element: string (containsNull = true)  |-- customerType: string (nullable = true)  |-- comment: string (nullable = true)  |-- totalAmount: double (nullable = true)  |-- currency: string (nullable = true)  |-- stockDecrease: boolean (nullable = true)  |-- offline: boolean (nullable = true)  |-- trackId: string (nullable = true)  |-- transportationType: string (nullable = true)  |-- stockRebook: boolean (nullable = true)  |-- notificationStatus: string (nullable = true)  |-- lines: array (nullable = true)  |    |-- element: struct (containsNull = true)  |    |    |-- lineId: string (nullable = true)  |    |    |-- extOrderLineId: string (nullable = true)  |    |    |-- productId: string (nullable = true)  |    |    |-- lineStatus: string (nullable = true)  |    |    |-- lineControlStatus: string (nullable = true)  |    |    |-- orderedQuantity: double (nullable = true)  |    |    |-- confirmedQuantity: double (nullable = true)  |    |    |-- assignedQuantity: double (nullable = true)  |    |    |-- pickedQuantity: double (nullable = true)  |    |    |-- controlledQuantity: double (nullable = true)  |    |    |-- allowedForGiveAwayQuantity: double (nullable = true)  |    |    |-- givenAwayQuantity: double (nullable = true)  |    |    |-- returnedQuantity: double (nullable = true)  |    |    |-- sellingScheme: string (nullable = true)  |    |    |-- stockSource: string (nullable = true)  |    |    |-- productPrice: double (nullable = true)  |    |    |-- lineAmount: double (nullable = true)  |    |    |-- currency: string (nullable = true)  |    |    |-- markingFlag: string (nullable = true)  |    |    |-- operations: array (nullable = true)  |    |    |    |-- element: struct (containsNull = true)  |    |    |    |    |-- operationId: string (nullable = true)  |    |    |    |    |-- type: string (nullable = true)  |    |    |    |    |-- reason: string (nullable = true)  |    |    |    |    |-- quantity: double (nullable = true)  |    |    |    |    |-- dmCodes: array (nullable = true)  |    |    |    |    |    |-- element: string (containsNull = true)  |    |    |    |    |-- timeStamp: string (nullable = true)  |    |    |    |    |-- updatedBy: string (nullable = true)  |    |    |-- source: array (nullable = true)  |    |    |    |-- element: struct (containsNull = true)  |    |    |    |    |-- type: string (nullable = true)  |    |    |    |    |-- items: array (nullable = true)  |    |    |    |    |    |-- element: struct (containsNull = true)  |    |    |    |    |    |    |-- assignedQuantity: double (nullable = true)  |-- linkedObjects: array (nullable = true)  |    |-- element: struct (containsNull = true)  |    |    |-- objectType: string (nullable = true)  |    |    |-- objectId: string (nullable = true)  |    |    |-- objectStatus: string (nullable = true)  |    |    |-- objectLines: array (nullable = true)  |    |    |    |-- element: struct (containsNull = true)  |    |    |    |    |-- objectLineId: string (nullable = true)  |    |    |    |    |-- taskLineId: string (nullable = true) <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u0435\u0440\u0435\u0431\u0438\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438 \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443, \u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u043d\u043e\u0433\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0438\u0437 Avro-\u0441\u0445\u0435\u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c JSON-\u0441\u0445\u0435\u043c\u0443. \u0418 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u0436\u0434\u0430\u043b \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437: \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u043d\u043e\u044e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0447\u0435\u043c \u00ab\u043f\u043e\u043d\u0438\u043c\u0430\u043b\u0430\u00bb \u043f\u0435\u0440\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u0430. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u044f, \u043d\u0430\u0448\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 (\u0430 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u044b \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445) \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u044b \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c JSON-\u0441\u0445\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Kafka Schema Registry, \u0438\u0437 \u00ab\u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c\u00bb.<em> <\/em><\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0448 SparkJsonSchemaConverter \u0431\u044b\u043b \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u2013 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <em>definitions<\/em>, <em>refs<\/em> (\u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435) \u0438 <em>oneOf<\/em>. \u0421\u0430\u043c \u0436\u0435 \u043f\u0430\u0440\u0441\u0435\u0440 \u0431\u044b\u043b \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d \u0443\u0436\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u00ab\u0441\u043e\u0431\u0438\u0440\u0430\u043b\u00bb \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 JSON-\u0441\u0445\u0435\u043c\u044b \u043e\u0431\u044a\u0435\u043a\u0442 <em>pyspark.sql.types.StructType<\/em>    <\/p>\n<blockquote>\n<p><em>\u0423 \u043d\u0430\u0441 \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u0431\u044b\u043b\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0432 \u041b\u0435\u0440\u0443\u0430 \u041c\u0435\u0440\u043b\u0435\u043d \u0441\u0430\u043c\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u044b Open Source, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u044d\u043d\u0442\u0443\u0437\u0438\u0430\u0441\u0442\u0430\u043c\u0438 \u0441\u043e \u0432\u0441\u0435\u0433\u043e \u043c\u0438\u0440\u0430, \u0438 \u0445\u043e\u0442\u0438\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u0438 \u043a\u043e\u043d\u0442\u0440\u0438\u0431\u044c\u044e\u0442\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044f \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 Open Source \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0440\u0433.\u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0441\u0445\u0435\u043c\u0435 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u0430 \u0432 Open Source \u0438, \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u0442\u043e\u0439 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439!<\/em><\/p>\n<\/blockquote>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 SparkJsonSchemaConverter\u2019\u0443 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0448\u0430\u0433\u0430 Parsing \u0441\u0432\u0435\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u00ab\u0442\u044e\u043d\u0438\u043d\u0433\u0443\u00bb \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 S3: \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445) \u0447\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441 S3 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443:<\/p>\n<pre><code class=\"python\"># \u0414\u043b\u044f JSON df = spark.read.format(in_format)\\             .option(\"multiline\", \"false\")\\             .schema(json_schema) \\             .load(path)  # \u0414\u043b\u044f parquet: df = spark.read.format(in_format)\\             .load(path)<\/code><\/pre>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u0441\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0443 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 DataFrame\u2019\u0430 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u0445 CSV-\u0444\u0430\u0439\u043b\u043e\u0432.  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e framework\u2019\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043d\u0430\u0448\u0443 Data Platform JSON-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0435\u043d:<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0441\u044f\u0446 \u043f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u041f\u0420\u041e\u0414\u0435 \u043f\u0440\u043e\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e 4 \u043d\u043e\u0432\u044b\u0445 JSON-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430!<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u0436\u0435 \u00ab\u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438\u00bb \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 framework\u2019\u0430, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u00ab\u0441\u043b\u043e\u043c\u0430\u043b\u0438\u00bb \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/leroy_merlin\/blog\/563066\/\"> https:\/\/habr.com\/ru\/company\/leroy_merlin\/blog\/563066\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/company\/leroy_merlin\/blog\/561072\/\">\u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438, \u043a\u0430\u043a \u043c\u044b \u0448\u043b\u0438 \u043a \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043d\u0430\u0448\u0435\u0439 Data Platform. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u00ab\u0436\u0435\u043b\u0443\u0434\u043e\u043a\u00bb \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0432 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0438\u0437 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0439 \u0432\u044b\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 (\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e \u0435\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f\u043c \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435), \u0442\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u00ab\u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\u00bb \u0441\u0445\u0435\u043c\u044b \u2014 \u0442\u043e\u0439, \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 Apache NiFi.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/figcaption><\/figure>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 350 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435 \u043e\u043d\u0438 \u00ab\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u00bb \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e \u0441\u0443\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430\u0445 \u0442\u043e\u0440\u0433\u043e\u0432\u043e\u0439 \u0441\u0435\u0442\u0438, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u00ab\u0437\u043e\u043e\u043f\u0430\u0440\u043a \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f\u00bb \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e Framework\u2019\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0435\u0433\u043e \u0438 \u0443\u0441\u043a\u043e\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432 Data Platform, \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c.  <\/p>\n<p>\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 framework\u2019\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0438\u0436\u0435:<\/p>\n<figure class=\"full-width\"><figcaption>\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 ODS-\u0441\u043b\u043e\u0439 Greenplum <\/figcaption><\/figure>\n<ol>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0438\u0441\u0442\u0435\u043c-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 Kafka \u0432 AVRO-\u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Apache NiFi, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 parquet \u043d\u0430 S3. <\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0441 \u00ab\u0441\u044b\u0440\u044b\u043c\u0438\u00bb \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark\u2019\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430:<\/p>\n<ol>\n<li>\n<p>Compaction \u2013 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0446\u0435\u043b\u044c\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u00ab\u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435\u00bb), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <em>distinct()<\/em> \u0438 \u0437\u0430\u0442\u0435\u043c <em>coalesce(<\/em>). \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 S3. \u042d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0437\u0430\u0442\u0435\u043c \u0434\u043b\u044f parsing&#8217;\u0430 , \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u043c \u0430\u0440\u0445\u0438\u0432\u043e\u043c \u0441\u044b\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb;<\/p>\n<\/li>\n<li>\n<p>Parsing \u2013 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0444\u0430\u0437\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0443, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u0432 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u043e\u0441\u043a\u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0436\u0430\u0442\u044b\u0445 (\u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e gzip) CSV-\u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 S3.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0417\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u2013 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 CSV-\u0444\u0430\u0439\u043b\u043e\u0432 \u0432 ODS-\u0441\u043b\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430: \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f external table \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 S3 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/docs.greenplum.org\/6-8\/pxf\/read_s3_s3select.html\">PXF S3 connector<\/a>, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c pgsql \u043f\u0435\u0440\u0435\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b ODS-\u0441\u043b\u043e\u044f Greenplum<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Airflow.<\/p>\n<\/li>\n<\/ol>\n<p>DAG\u2019\u0438 \u0434\u043b\u044f Airflow \u0443 \u043d\u0430\u0441 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. Parsing \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0445 \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0442\u0430\u043a \u043a\u0430\u043a, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c:  <\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432 ODS-\u0441\u043b\u043e\u0435 \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b-\u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Git \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 YAML-\u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 (\u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a: \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, S3-\u0431\u0430\u043a\u0435\u0442, \u0438\u043c\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438\u043c\u044f \u0438 email \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0442.\u043f.);<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u043b\u043e\u044f ODS (\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u043b\u043e\u0441\u043a\u0438\u0435, \u0442\u0430\u043a \u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432 ODS-\u0441\u043b\u043e\u0435 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c). \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u043f\u043b\u043e\u0441\u043a\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0414\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u043b \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0441\u0442\u0435\u0442. \u0423 \u043d\u0430\u0441 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0435 \u0443\u0436\u0435 \u043c\u0430\u044f\u0447\u0438\u043b\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434 \u0441\u043e\u0431\u043e\u0439 \u0438\u043c\u0435\u043b MongoDB \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c MongoDB Kafka source connector \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Kafka. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u0442\u0440\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e framework\u2019\u0430 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438 \u043d\u0430 S3 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON &#8212; \u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 &#171;\u043a\u0430\u043a \u0435\u0441\u0442\u044c&#187;, \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0448\u0430\u0433\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0432 parquet \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Apache NiFi.  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0448\u0430\u0433 Compaction. \u0415\u0433\u043e \u043a\u043e\u0434, \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u044e \u00ab\u043e\u0431\u0432\u044f\u0437\u043a\u0443\u00bb \u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439:<\/p>\n<pre><code class=\"python\">df = spark.read.format(in_format) \\                .options(**in_options) \\                .load(path) \\                .distinct()     new_df = df.coalesce(div) new_df.write.mode(\"overwrite\") \\              .format(out_format) \\             .options(**out_options) \\             .save(path)<\/code><\/pre>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 JSON-\u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u043e \u0432\u043e\u043b\u0435\u0439-\u043d\u0435\u0432\u043e\u043b\u0435\u0439 \u0432\u043d\u0435\u0441\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 JSON\u2019\u043e\u0432 Spark \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442 \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 mergeSchema, \u0442.\u0435. \u043c\u044b \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043a\u0430\u0437\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u0412\u0435\u0434\u044c \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u2013 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0440\u0443\u043f\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0445 \u00ab\u043a\u0430\u043a \u0435\u0441\u0442\u044c\u00bb.   <\/p>\n<p>\u041f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0443\u043a\u0440\u0443\u043f\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 S3. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u044f\u0449\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431:    <\/p>\n<blockquote>\n<p><em>\u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0441 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u043a\u0430\u043a DataFrame \u0441 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u043e\u0439, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0432\u0435\u0441\u044c JSON-\u043e\u0431\u044a\u0435\u043a\u0442.<\/em><\/p>\n<\/blockquote>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p><strong>file1:<\/strong><\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 1, \u00abproductName\u00bb: \u00abProductName 1\u00bb, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}} {\u00abproductId\u00bb: 2, \u00abprice\u00bb: 10.01, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}}<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u042d\u0442\u043e \u0444\u0430\u0439\u043b \u0441 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u0433\u0434\u0435 1 \u0441\u0442\u0440\u043e\u043a\u0430 = 1 \u043e\u0431\u044a\u0435\u043a\u0442. \u041e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c, \u043f\u043e \u0441\u0443\u0442\u0438, JSON-\u043e\u043c, \u043e\u043d \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0443\u044e JSON-\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e. \u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c JSON-\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 S3 (\u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f &#171;\u0433\u0430\u043b\u043e\u0447\u043a\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Apache NiFi).<\/p>\n<p>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"python\"># \u0427\u0438\u0442\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 df = spark.read \\           .format(\"csv\") \\           .option(\"sep\", \"\\a\") \\           .load(\"file1.json\")  # \u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f DataFrame df.printSchema()  root  |-- _c0: string (nullable = true)  # \u0421\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 df.show()  +--------------------+ |                 _c0| +--------------------+ |{\"productId\": 1, ...| |{\"productId\": 2, ...| +--------------------+<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u0442\u0443\u0442 \u0447\u0438\u0442\u0430\u0435\u043c JSON \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CSV, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <u>\u043d\u0438\u043a\u043e\u0433\u0434\u0430<\/u> \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bell_character\">Bell character<\/a>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c DataFrame \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c <em>dicstinct()<\/em> \u0438 \u0437\u0430\u0442\u0435\u043c <em>coalesce()<\/em>, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0446\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430:   <\/p>\n<pre><code class=\"python\"># \u0414\u043b\u044f parquet in_format = \"parquet\" in_options = {}  # \u0414\u043b\u044f JSON in_format = \"csv\" in_options = {\"sep\": \"\\a\"}<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 DataFrame \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 S3 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u044f\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438:           <\/p>\n<pre><code class=\"python\">df.write.mode(\"overwrite\") \\            .format(out_format) \\ \t\t\t\t.options(**out_options) \\   \t\t\t\t.save(path)    # \u0434\u043b\u044f JSON      out_format = \"text\"  out_options = {\"compression\": \"gzip\"}    # \u0434\u043b\u044f parquet    out_format = input_format  out_options = {\"compression\": \"snappy\"}<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044b\u043b \u0448\u0430\u0433 Parsing. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0443\u043f\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u0432 \u043e\u0434\u043d\u0443 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0443\u044e \u0434\u0435\u0442\u0430\u043b\u044c: JSON -\u0444\u0430\u0439\u043b, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 parquet, \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 JSON-\u0444\u0430\u0439\u043b\u0430 Spark \u0443\u043c\u0435\u0435\u0442 \u0441\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0445\u0435\u043c\u0443, \u0438 \u0434\u0430\u0436\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u043c\u0441\u044f \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 mergeSchema. \u041d\u043e \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u044b \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0443\u043f\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e. \u0411\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u0432\u043e \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u043f\u043e\u043b\u044f \u00ab<em>field_1<\/em>\u00bb, \u0442\u0430\u043a \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u043e\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445. \u0422\u043e\u0433\u0434\u0430 \u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0441\u044f Spark DataFrame \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0438 \u043d\u0430\u0448 Parsing, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u043e\u0441\u0442\u043e-\u043d\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043f\u0430\u0434\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0435 \u043f\u043e\u043b\u0435.   <\/p>\n<p>\u041f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c,\u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c:<\/p>\n<p><strong>file1<\/strong> (\u0442\u043e\u0442 \u0436\u0435 \u0447\u0442\u043e \u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435):<\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 1, \u00abproductName\u00bb: \u00abProductName 1\u00bb, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}} {\u00abproductId\u00bb: 2, \u00abprice\u00bb: 10.01, \u00abtags\u00bb: [\u00abtag 1\u00bb, \u00abtag 2\u00bb], \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5}}<\/code><\/pre>\n<p><strong>file2<\/strong>:<\/p>\n<pre><code class=\"json\">{\u00abproductId\u00bb: 3, \u00abproductName\u00bb: \u00abProductName 3\u00bb, \u00abdimensions\u00bb: {\u00ablength\u00bb: 10, \u00abwidth\u00bb: 12, \u00abheight\u00bb: 12.5, \u00abpackage\u00bb: [10, 20.5, 30]}}<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c Spark\u2019\u043e\u043c \u0438\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0441\u0445\u0435\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0445\u0441\u044f DataFrame:<\/p>\n<pre><code class=\"python\">df = spark.read \\           .format(\"json\") \\           .option(\"multiline\", \"false\") \\           .load(path) df.printSchema() df.show()<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u0439\u043b (\u0441\u0445\u0435\u043c\u0430 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435):<\/p>\n<pre><code>root  |-- dimensions: struct (nullable = true)  |    |-- height: double (nullable = true)  |    |-- length: long (nullable = true)  |    |-- width: long (nullable = true)  |-- price: double (nullable = true)  |-- productId: long (nullable = true)  |-- productName: string (nullable = true)  |-- tags: array (nullable = true)  |    |-- element: string (containsNull = true)  +--------------+-----+---------+-------------+--------------+ |    dimensions|price|productId|  productName|          tags| +--------------+-----+---------+-------------+--------------+ |[12.5, 10, 12]| null|        1|ProductName 1|[tag 1, tag 2]| |[12.5, 10, 12]|10.01|        2|         null|[tag 1, tag 2]| +--------------+-----+---------+-------------+--------------+<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b (\u0441\u0445\u0435\u043c\u0430 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435)<em>:<\/em><\/p>\n<pre><code>root  |-- dimensions: struct (nullable = true)  |    |-- height: double (nullable = true)  |    |-- length: long (nullable = true)  |    |-- package: array (nullable = true)  |    |    |-- element: double (containsNull = true)  |    |-- width: long (nullable = true)  |-- productId: long (nullable = true)  |-- productName: string (nullable = true)  +--------------------+---------+-------------+ |          dimensions|productId|  productName|<\/code><\/pre>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324995","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324995"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324995\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}