{"id":454453,"date":"2025-04-02T03:02:29","date_gmt":"2025-04-02T03:02:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=454453"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=454453","title":{"rendered":"<span>\u041a\u0430\u043a Apache Spark \u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u044b: \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/171\/c26\/059\/171c260596fd4f13c2aeec581df6856f.png\" width=\"1183\" height=\"646\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/171\/c26\/059\/171c260596fd4f13c2aeec581df6856f.png\"\/><\/figure>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439 \u041a\u0443\u0447\u0435\u0440\u043e\u0432, \u0438 \u044f Lead Data Engineer. \u0427\u0430\u0441\u0442\u044c \u043c\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u042f \u043b\u044e\u0431\u043b\u044e \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u043b\u043e\u0447\u0435\u0439 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 &#8212; \u0447\u0430\u0441\u0442\u043e \u043a\u0430\u0436\u0443\u0449\u0438\u0435\u0441\u044f \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0434\u0438\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0445 Spark-\u0434\u0436\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.  <\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0432 Apache Spark?<\/h3>\n<p>Apache Spark \u2014 \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e,\u00a0<strong>\u043a\u0430\u043a<\/strong>\u00a0\u0438\u00a0<strong>\u0432 \u043a\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/strong>\u00a0\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438\u043b\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a:<\/p>\n<ul>\n<li>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0440\u0430\u0441\u0445\u043e\u0434\u0443 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430\u043c \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a Spark \u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u044b, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 Hive Metastore.<\/p>\n<h3>\u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 Apache Spark<\/h3>\n<ol>\n<li>\n<p><strong>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>Spark \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0430\u043c (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f FS, HDFS, S3).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0431\u043e\u0440 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Parquet\/ORC: \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f CSV\/JSON: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u0441\u0445\u0435\u043c\u044b \u0447\u0435\u0440\u0435\u0437\u00a0inferSchema\u00a0\u0438\u043b\u0438 \u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043b\u0430\u043d: \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d, \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043b\u0430\u043d: \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f\u043c\u0438 (executors).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 DataFrame.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/th>\n<th data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u043e\u043a\u0430\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u041d\u0438\u0437\u043a\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0440\u0435\u0434\u043d\u044f\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u0445\u0435\u043c\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0413\u0438\u0431\u043a\u0430\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u0436\u0430\u0442\u0438\u0435<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u043b\u043e\u0447\u043d\u043e\u0435<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u0424\u0430\u0439\u043b\u043e\u0432\u043e\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0430\u0439\u043b\u043e\u0432\u043e\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0448\u0434\u0430\u0443\u043d, \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h3>\n<h4>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432&#187;<\/h4>\n<ul>\n<li>\n<p><strong>1 \u0444\u0430\u0439\u043b = 1 \u0437\u0430\u0434\u0430\u0447\u0430<\/strong>: \u0414\u043b\u044f CSV\/JSON \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u044b\u0441\u044f\u0447\u0430\u043c \u043c\u0435\u043b\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0447\u0435\u0440\u0435\u0437\u00a0coalesce():<\/p>\n<pre><code class=\"python\">df = spark.read.parquet(\"data\/\").coalesce(10)  <\/code><\/pre>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">spark.conf.set(\"spark.sql.files.maxPartitionBytes\", \"256000000\")  # 256 \u041c\u0411  <\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>1 \u0444\u0430\u0439\u043b = ? \u0437\u0430\u0434\u0430\u0447<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043f\u043e \u0431\u043b\u043e\u043a\u0430\u043c)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0parquet.block.size<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">1 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0436\u0430\u0442)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0443\u0447\u043d\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">1 (\u0431\u0435\u0437 \u0434\u043e\u043f. \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0412\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445<\/h3>\n<p>\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u2014 \u044d\u0442\u043e\u00a0<strong>\u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c\u00a0<strong>10-100x \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong>\u00a0\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e:  <\/p>\n<h3>1. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Spark \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0446\u0435\u043b\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0438\u0445 min\/max-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440.<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u043f\u0440\u043e\u0441\u00a0WHERE date = &#8216;2023-01-01&#8217;\u00a0\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u0430\u00a0<strong>90% \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0441\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0430\u0442\u044b).<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<strong>20-40%<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u043e\u0434\u0438\u043d \u043c\u0435\u0441\u044f\u0446) \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0440\u044f\u0434\u043e\u043c.<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 JOIN-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u00a0<strong>30-50%<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>2. \u041a\u0430\u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e<\/h3>\n<pre><code class=\"python\"># \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c df.sort(\"date\", \"user_id\").write.parquet(\"sorted_data\/\")  # \u0414\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 df.sortWithinPartitions(\"user_id\").write.partitionBy(\"date\").parquet(\"partitioned_data\/\")<\/code><\/pre>\n<p><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u00a0WHERE\u00a0(\u0434\u0430\u0442\u044b, \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438).<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0434\u043b\u044f JOIN (user_id, order_id).<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th data-colwidth=\"234\" width=\"234\">\n<p align=\"left\"><strong>\u0420\u0430\u0437\u043c\u0435\u0440 Parquet-\u0444\u0430\u0439\u043b\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1 \u0413\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043b\u0430\u0431\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e \u0434\u0430\u0442\u0435<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">600 \u041c\u0411 (\u201340%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0443\u0447\u0448\u0435\u0435 \u0441\u0436\u0430\u0442\u0438\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 + Zstd<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">450 \u041c\u0411 (\u201355%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u0436\u0430\u0442\u0438\u044f.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>4. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/strong>:<br \/>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e shuffle:<\/p>\n<pre><code class=\"python\">df.sortWithinPartitions(\"timestamp\").write.partitionBy(\"date\").parquet(\"data\/\")<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0414\u043b\u044f \u0447\u0430\u0441\u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/strong>:<br \/>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u00a0ZORDER BY\u00a0\u0432 Delta Lake \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">OPTIMIZE delta.`\/path\/table` ZORDER BY (date, user_id);<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0422\u043e\u0440\u0433\u043e\u0432\u043b\u044f write vs read<\/strong>:<br \/>\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u00a0<strong>15-30%<\/strong>, \u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0432\u00a0<strong>10-100 \u0440\u0430\u0437<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<h3>5. \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p><strong>\u0414\u0430\u043d\u043d\u044b\u0435<\/strong>: 1 \u0422\u0411 \u043b\u043e\u0433\u043e\u0432, \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u00a0date.<br \/><strong>\u0417\u0430\u043f\u0440\u043e\u0441<\/strong>:\u00a0SELECT * FROM logs WHERE date = &#8216;2023-01-01&#8217; AND user_id = 12345.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">120 \u0441\u0435\u043a.<\/p>\n<\/td>\n<td>\n<p align=\"left\">50 \u0413\u0411<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u00a0user_id<\/p>\n<\/td>\n<td>\n<p align=\"left\">3 \u0441\u0435\u043a. (\u201397.5%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">500 \u041c\u0411 (\u201399%)<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 Hive \u0438 Parquet<\/h3>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e?<\/strong><\/p>\n<ul>\n<li>\n<p>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0445\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0442\u043e\u0447\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0441\u0445\u0435\u043c\u044b \u0432 \u0444\u0430\u0439\u043b\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/strong>:<\/p>\n<pre><code class=\"python\">spark.conf.set(\"spark.sql.hive.verifyPartitionPath\", \"false\")  # \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439   spark.conf.set(\"spark.sql.sources.ignoreDataLocality\", \"true\") # \u041f\u0440\u043e\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432  <\/code><\/pre>\n<p><strong>\u0420\u0438\u0441\u043a\u0438<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u00a0NULL.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Spark \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/h3>\n<h3>1. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0444\u0430\u0439\u043b\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u043e\u0447\u0435\u043c\u0443<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">128\u2013512 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u043e\u043c \u0438 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u043c\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>ORC<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">256\u20131024 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u0440\u0443\u043f\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u0436\u0430\u0442\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">10\u2013100 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0435\u043b\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u044e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u2014 \u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">64\u2013256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041a\u0430\u043a \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>Parquet\/ORC<\/strong>\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"python\"># \u0414\u043b\u044f Parquet df.write.option(\"parquet.block.size\", 256 * 1024 * 1024).parquet(\"output\/\")  # \u0414\u043b\u044f ORC df.write.option(\"orc.stripe.size\", 256 * 1024 * 1024).orc(\"output\/\")<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>CSV\/Avro<\/strong>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u00a0repartition()\u00a0\u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e:<\/p>\n<pre><code class=\"python\">df.repartition(100).write.csv(\"output\/\")  # \u0421\u043e\u0437\u0434\u0430\u0441\u0442 ~100 \u0444\u0430\u0439\u043b\u043e\u0432<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>2. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Spark \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0414\u043b\u044f \u0447\u0435\u0433\u043e<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.files.maxPartitionBytes<\/p>\n<\/td>\n<td>\n<p align=\"left\">256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 (\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e HDFS-\u0431\u043b\u043e\u043a\u0430\u043c).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.parquet.enableVectorizedReader<\/p>\n<\/td>\n<td>\n<p align=\"left\">true<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 Parquet \u0432 2\u20135 \u0440\u0430\u0437.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.sources.parallelPartitionDiscovery.parallelism<\/p>\n<\/td>\n<td>\n<p align=\"left\">100<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0441 \u0442\u044b\u0441\u044f\u0447\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.hadoop.mapreduce.input.fileinputformat.split.minsize<\/p>\n<\/td>\n<td>\n<p align=\"left\">256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043f\u043b\u0438\u0442\u0430 \u0434\u043b\u044f Hadoop (\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u00a0maxPartitionBytes).<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/strong><\/p>\n<pre><code class=\"python\">spark = SparkSession.builder \\     .config(\"spark.sql.files.maxPartitionBytes\", \"268435456\") \\  # 256 \u041c\u0411     .config(\"spark.sql.parquet.enableVectorizedReader\", \"true\") \\     .getOrCreate()<\/code><\/pre>\n<h3>3. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0435\u043b\u043a\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/h3>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/strong>:<br \/>\u0422\u044b\u0441\u044f\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 &lt; 10 \u041c\u0411 \u2192 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437\u00a0coalesce()<\/strong>:<\/p>\n<pre><code class=\"python\">df = spark.read.parquet(\"input\/\").coalesce(100)  # \u0421\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e 100<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Delta Lake\/Iceberg<\/strong>:<\/p>\n<pre><code class=\"python\"># \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u043b\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 spark.sql(\"OPTIMIZE delta.`\/path\/to\/table`\")<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Hadoop-\u0443\u0442\u0438\u043b\u0438\u0442\u044b<\/strong>:<\/p>\n<pre><code class=\"python\">hadoop archive -archiveName data.har -p \/input \/output  # \u0421\u043e\u0437\u0434\u0430\u0435\u0442 HAR-\u0430\u0440\u0445\u0438\u0432<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>4. \u0421\u0436\u0430\u0442\u0438\u0435: \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c?<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041b\u0443\u0447\u0448\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Snappy<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0430\u043b\u0430\u043d\u0441 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0441\u0436\u0430\u0442\u0438\u044f (\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">Zstandard<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0443\u0447\u0448\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u0436\u0430\u0442\u0438\u044f (+10\u201320% \u043a Snappy).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>ORC<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Zlib<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u043f\u0442\u0438\u043c\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Deflate<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435 (\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 Snappy).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">LZO<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0415\u0441\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d splittable-\u0444\u043e\u0440\u043c\u0430\u0442.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/strong><\/p>\n<pre><code class=\"python\">df.write.option(\"compression\", \"zstd\").parquet(\"output\/\")  # Parquet + Zstandard<\/code><\/pre>\n<h3>5. Hive-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b<\/h3>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439<\/strong>:<br \/>\u041d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0441 &lt; 1 \u0413\u0411 \u0434\u0430\u043d\u043d\u044b\u0445(\u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438) \u2014 \u044d\u0442\u043e \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">-- \u041f\u043b\u043e\u0445\u043e: \u0442\u044b\u0441\u044f\u0447\u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u043f\u043e 10 \u041c\u0411 CREATE TABLE sales (id INT) PARTITIONED BY (day STRING);  -- \u041b\u0443\u0447\u0448\u0435: \u0443\u043a\u0440\u0443\u043f\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 CREATE TABLE sales (id INT) PARTITIONED BY (month STRING);<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430<\/strong>:<br \/>\u0412\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f Hive-\u0442\u0430\u0431\u043b\u0438\u0446(Spark \u0435\u0435 \u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c):<\/p>\n<pre><code class=\"python\">ANALYZE TABLE sales COMPUTE STATISTICS FOR COLUMNS;<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>Apache Spark \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0438\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442:<\/p>\n<ol>\n<li>\n<p><strong>\u0412\u044b\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430<\/strong>: Parquet \u0438 ORC \u2014 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, Avro \u2014 \u0434\u043b\u044f \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, CSV \u2014 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/strong>: \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 Hive<\/strong>: \u0421\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0421\u043e\u0432\u0435\u0442<\/strong>: \u0412\u0441\u0435\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/896492\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0410 \u0442\u044b \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0448\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">66.67% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u044e, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0434\u0437\u0435\u043d \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e.<\/span><span class=\"tm-article-poll__answer-votes\">2<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 66.67%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0422\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0438\u043a \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0435\u0447\u043e. \u0418\u043d\u0430\u0447\u0435 \u2014 coalesce(1) \u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d!<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">33.33% <\/span><span class=\"tm-article-poll__answer-label\">\u041d\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u2014 \u044d\u0442\u043e 3 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u043a\u043e\u043b\u043b\u0435\u0433 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041c\u044b \u0438 \u0442\u0430\u043a \u0433\u0435\u0440\u043e\u0438.<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 33.33%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 3 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.    \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 3 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/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\/articles\/896492\/\"> https:\/\/habr.com\/ru\/articles\/896492\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439 \u041a\u0443\u0447\u0435\u0440\u043e\u0432, \u0438 \u044f Lead Data Engineer. \u0427\u0430\u0441\u0442\u044c \u043c\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u042f \u043b\u044e\u0431\u043b\u044e \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u043b\u043e\u0447\u0435\u0439 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442 &#8212; \u0447\u0430\u0441\u0442\u043e \u043a\u0430\u0436\u0443\u0449\u0438\u0435\u0441\u044f \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u044e\u0442 \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0447\u0442\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c \u0443\u0434\u0438\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0445 Spark-\u0434\u0436\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.  <\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0432 Apache Spark?<\/h3>\n<p>Apache Spark \u2014 \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e,\u00a0<strong>\u043a\u0430\u043a<\/strong>\u00a0\u0438\u00a0<strong>\u0432 \u043a\u0430\u043a\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435<\/strong>\u00a0\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0438\u043b\u0438 \u043d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a:<\/p>\n<ul>\n<li>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0440\u0430\u0441\u0445\u043e\u0434\u0443 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430\u043c \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a Spark \u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0430\u0439\u043b\u044b, \u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432, \u0438 \u043a\u0430\u043a \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 Hive Metastore.<\/p>\n<h3>\u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 Apache Spark<\/h3>\n<ol>\n<li>\n<p><strong>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>Spark \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0430\u043c (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f FS, HDFS, S3).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u0431\u043e\u0440 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f Parquet\/ORC: \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f CSV\/JSON: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u0441\u0445\u0435\u043c\u044b \u0447\u0435\u0440\u0435\u0437\u00a0inferSchema\u00a0\u0438\u043b\u0438 \u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043b\u0430\u043d: \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d, \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u043b\u0430\u043d: \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447 \u043c\u0435\u0436\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f\u043c\u0438 (executors).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 DataFrame.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/th>\n<th data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u043e\u043a\u0430\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u041d\u0438\u0437\u043a\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0440\u0435\u0434\u043d\u044f\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u0445\u0435\u043c\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0413\u0438\u0431\u043a\u0430\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u0421\u0436\u0430\u0442\u0438\u0435<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u043b\u043e\u0447\u043d\u043e\u0435<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u0424\u0430\u0439\u043b\u043e\u0432\u043e\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0430\u0439\u043b\u043e\u0432\u043e\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\"><strong>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0448\u0434\u0430\u0443\u043d, \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f<\/p>\n<\/td>\n<td data-colwidth=\"175\" width=\"175\">\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h3>\n<h4>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#171;\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432&#187;<\/h4>\n<ul>\n<li>\n<p><strong>1 \u0444\u0430\u0439\u043b = 1 \u0437\u0430\u0434\u0430\u0447\u0430<\/strong>: \u0414\u043b\u044f CSV\/JSON \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u044b\u0441\u044f\u0447\u0430\u043c \u043c\u0435\u043b\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0447\u0435\u0440\u0435\u0437\u00a0coalesce():<\/p>\n<pre><code class=\"python\">df = spark.read.parquet(\"data\/\").coalesce(10)  <\/code><\/pre>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439:<\/p>\n<pre><code class=\"python\">spark.conf.set(\"spark.sql.files.maxPartitionBytes\", \"256000000\")  # 256 \u041c\u0411  <\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u0420\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u0435 \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>1 \u0444\u0430\u0439\u043b = ? \u0437\u0430\u0434\u0430\u0447<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u0430\u043a \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043f\u043e \u0431\u043b\u043e\u043a\u0430\u043c)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u00a0parquet.block.size<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">1 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0436\u0430\u0442)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0443\u0447\u043d\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">1 (\u0431\u0435\u0437 \u0434\u043e\u043f. \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u0412\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445<\/h3>\n<p>\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u2014 \u044d\u0442\u043e\u00a0<strong>\u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/strong>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c\u00a0<strong>10-100x \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435<\/strong>\u00a0\u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e:  <\/p>\n<h3>1. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Spark \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0446\u0435\u043b\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0435\u0441\u043b\u0438 \u0438\u0445 min\/max-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0444\u0438\u043b\u044c\u0442\u0440.<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u043f\u0440\u043e\u0441\u00a0WHERE date = &#8216;2023-01-01&#8217;\u00a0\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u0430\u00a0<strong>90% \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u042d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 \u0441\u0436\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043b\u0443\u0447\u0448\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0434\u0430\u0442\u044b).<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<strong>20-40%<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u043e\u0434\u0438\u043d \u043c\u0435\u0441\u044f\u0446) \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0440\u044f\u0434\u043e\u043c.<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 JOIN-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u00a0<strong>30-50%<\/strong>.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>2. \u041a\u0430\u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e<\/h3>\n<pre><code class=\"python\"># \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c df.sort(\"date\", \"user_id\").write.parquet(\"sorted_data\/\")  # \u0414\u043b\u044f \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 df.sortWithinPartitions(\"user_id\").write.partitionBy(\"date\").parquet(\"partitioned_data\/\")<\/code><\/pre>\n<p><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0434\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0427\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432\u00a0WHERE\u00a0(\u0434\u0430\u0442\u044b, \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438).<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0434\u043b\u044f JOIN (user_id, order_id).<\/p>\n<\/li>\n<\/ul>\n<h3>3. \u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th data-colwidth=\"234\" width=\"234\">\n<p align=\"left\"><strong>\u0420\u0430\u0437\u043c\u0435\u0440 Parquet-\u0444\u0430\u0439\u043b\u0430<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">1 \u0413\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043b\u0430\u0431\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e \u0434\u0430\u0442\u0435<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">600 \u041c\u0411 (\u201340%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0443\u0447\u0448\u0435\u0435 \u0441\u0436\u0430\u0442\u0438\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 + Zstd<\/p>\n<\/td>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"left\">450 \u041c\u0411 (\u201355%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u0436\u0430\u0442\u0438\u044f.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>4. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438<\/h3>\n<ul>\n<li>\n<p><strong>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446<\/strong>:<br \/>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e shuffle:<\/p>\n<pre><code class=\"python\">df.sortWithinPartitions(\"timestamp\").write.partitionBy(\"date\").parquet(\"data\/\")<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0414\u043b\u044f \u0447\u0430\u0441\u0442\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/strong>:<br \/>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u00a0ZORDER BY\u00a0\u0432 Delta Lake \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">OPTIMIZE delta.`\/path\/table` ZORDER BY (date, user_id);<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0422\u043e\u0440\u0433\u043e\u0432\u043b\u044f write vs read<\/strong>:<br \/>\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u00a0<strong>15-30%<\/strong>, \u043d\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0432\u00a0<strong>10-100 \u0440\u0430\u0437<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<h3>5. \u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n<p><strong>\u0414\u0430\u043d\u043d\u044b\u0435<\/strong>: 1 \u0422\u0411 \u043b\u043e\u0433\u043e\u0432, \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u00a0date.<br \/><strong>\u0417\u0430\u043f\u0440\u043e\u0441<\/strong>:\u00a0SELECT * FROM logs WHERE date = &#8216;2023-01-01&#8217; AND user_id = 12345.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0411\u0435\u0437 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">120 \u0441\u0435\u043a.<\/p>\n<\/td>\n<td>\n<p align=\"left\">50 \u0413\u0411<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u00a0user_id<\/p>\n<\/td>\n<td>\n<p align=\"left\">3 \u0441\u0435\u043a. (\u201397.5%)<\/p>\n<\/td>\n<td>\n<p align=\"left\">500 \u041c\u0411 (\u201399%)<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\u041e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 Hive \u0438 Parquet<\/h3>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e?<\/strong><\/p>\n<ul>\n<li>\n<p>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0445\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u0442\u043e\u0447\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u0441\u0445\u0435\u043c\u044b \u0432 \u0444\u0430\u0439\u043b\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/strong>:<\/p>\n<pre><code class=\"python\">spark.conf.set(\"spark.sql.hive.verifyPartitionPath\", \"false\")  # \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439   spark.conf.set(\"spark.sql.sources.ignoreDataLocality\", \"true\") # \u041f\u0440\u043e\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432  <\/code><\/pre>\n<p><strong>\u0420\u0438\u0441\u043a\u0438<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a\u00a0NULL.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043f\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Spark \u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/h3>\n<h3>1. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0444\u0430\u0439\u043b\u043e\u0432<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041f\u043e\u0447\u0435\u043c\u0443<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">128\u2013512 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u043e\u043c \u0438 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u0430\u043c\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>ORC<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">256\u20131024 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u0440\u0443\u043f\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0441\u0436\u0430\u0442\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043d\u044b\u0439 \u043f\u0443\u0448\u0434\u0430\u0443\u043d.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">10\u2013100 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0435\u043b\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u044e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443, \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u2014 \u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">64\u2013256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u0436\u0430\u0442\u0438\u0435\u043c \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041a\u0430\u043a \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>Parquet\/ORC<\/strong>\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u043b\u043e\u043a\u0430:<\/p>\n<pre><code class=\"python\"># \u0414\u043b\u044f Parquet df.write.option(\"parquet.block.size\", 256 * 1024 * 1024).parquet(\"output\/\")  # \u0414\u043b\u044f ORC df.write.option(\"orc.stripe.size\", 256 * 1024 * 1024).orc(\"output\/\")<\/code><\/pre>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0<strong>CSV\/Avro<\/strong>\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u00a0repartition()\u00a0\u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e:<\/p>\n<pre><code class=\"python\">df.repartition(100).write.csv(\"output\/\")  # \u0421\u043e\u0437\u0434\u0430\u0441\u0442 ~100 \u0444\u0430\u0439\u043b\u043e\u0432<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>2. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Spark \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u0414\u043b\u044f \u0447\u0435\u0433\u043e<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.files.maxPartitionBytes<\/p>\n<\/td>\n<td>\n<p align=\"left\">256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 (\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e HDFS-\u0431\u043b\u043e\u043a\u0430\u043c).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.parquet.enableVectorizedReader<\/p>\n<\/td>\n<td>\n<p align=\"left\">true<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 Parquet \u0432 2\u20135 \u0440\u0430\u0437.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.sql.sources.parallelPartitionDiscovery.parallelism<\/p>\n<\/td>\n<td>\n<p align=\"left\">100<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0441 \u0442\u044b\u0441\u044f\u0447\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">spark.hadoop.mapreduce.input.fileinputformat.split.minsize<\/p>\n<\/td>\n<td>\n<p align=\"left\">256 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043f\u043b\u0438\u0442\u0430 \u0434\u043b\u044f Hadoop (\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u00a0maxPartitionBytes).<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/strong><\/p>\n<pre><code class=\"python\">spark = SparkSession.builder \\     .config(\"spark.sql.files.maxPartitionBytes\", \"268435456\") \\  # 256 \u041c\u0411     .config(\"spark.sql.parquet.enableVectorizedReader\", \"true\") \\     .getOrCreate()<\/code><\/pre>\n<h3>3. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0435\u043b\u043a\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/h3>\n<p><strong>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/strong>:<br \/>\u0422\u044b\u0441\u044f\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 &lt; 10 \u041c\u0411 \u2192 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437\u00a0coalesce()<\/strong>:<\/p>\n<pre><code class=\"python\">df = spark.read.parquet(\"input\/\").coalesce(100)  # \u0421\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043e 100<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Delta Lake\/Iceberg<\/strong>:<\/p>\n<pre><code class=\"python\"># \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u043b\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 spark.sql(\"OPTIMIZE delta.`\/path\/to\/table`\")<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Hadoop-\u0443\u0442\u0438\u043b\u0438\u0442\u044b<\/strong>:<\/p>\n<pre><code class=\"python\">hadoop archive -archiveName data.har -p \/input \/output  # \u0421\u043e\u0437\u0434\u0430\u0435\u0442 HAR-\u0430\u0440\u0445\u0438\u0432<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>4. \u0421\u0436\u0430\u0442\u0438\u0435: \u0447\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c?<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\"><strong>\u0424\u043e\u0440\u043c\u0430\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041b\u0443\u0447\u0448\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/strong><\/p>\n<\/th>\n<th>\n<p align=\"left\"><strong>\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Parquet<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Snappy<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0430\u043b\u0430\u043d\u0441 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0441\u0436\u0430\u0442\u0438\u044f (\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">Zstandard<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u0443\u0447\u0448\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u0436\u0430\u0442\u0438\u044f (+10\u201320% \u043a Snappy).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>ORC<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Zlib<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u043f\u0442\u0438\u043c\u0430\u043b\u0435\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>Avro<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">Deflate<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0436\u0430\u0442\u0438\u0435 (\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 Snappy).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>CSV<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">LZO<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0415\u0441\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d splittable-\u0444\u043e\u0440\u043c\u0430\u0442.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/strong><\/p>\n<pre><code class=\"python\">df.write.option(\"compression\", \"zstd\").parquet(\"output\/\")  # Parquet + Zstandard<\/code><\/pre>\n<h3>5. Hive-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b<\/h3>\n<ul>\n<li>\n<p><strong>\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439<\/strong>:<br \/>\u041d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0441 &lt; 1 \u0413\u0411 \u0434\u0430\u043d\u043d\u044b\u0445(\u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438) \u2014 \u044d\u0442\u043e \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">-- \u041f\u043b\u043e\u0445\u043e: \u0442\u044b\u0441\u044f\u0447\u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u043f\u043e 10 \u041c\u0411 CREATE TABLE sales (id INT) PARTITIONED BY (day STRING);  -- \u041b\u0443\u0447\u0448\u0435: \u0443\u043a\u0440\u0443\u043f\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 CREATE TABLE sales (id INT) PARTITIONED BY (month STRING);<\/code><\/pre>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430<\/strong>:<br \/>\u0412\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f Hive-\u0442\u0430\u0431\u043b\u0438\u0446(Spark \u0435\u0435 \u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c):<\/p>\n<pre><code class=\"python\">ANALYZE TABLE sales COMPUTE STATISTICS FOR COLUMNS;<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>Apache Spark \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u0438\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442:<\/p>\n<ol>\n<li>\n<p><strong>\u0412\u044b\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430<\/strong>: Parquet \u0438 ORC \u2014 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, Avro \u2014 \u0434\u043b\u044f \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, CSV \u2014 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/strong>: \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u043b\u043e\u043a\u043e\u0432, \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 Hive<\/strong>: \u0421\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0421\u043e\u0432\u0435\u0442<\/strong>: \u0412\u0441\u0435\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/896492\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0410 \u0442\u044b \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0448\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">66.67% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u044e, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0434\u0438\u0442\u0430\u0446\u0438\u0438. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0434\u0437\u0435\u043d \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e.<\/span><span class=\"tm-article-poll__answer-votes\">2<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 66.67%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0422\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0438\u043a \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0435\u0447\u043e. \u0418\u043d\u0430\u0447\u0435 \u2014 coalesce(1) \u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d!<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">33.33% <\/span><span class=\"tm-article-poll__answer-label\">\u041d\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u2014 \u044d\u0442\u043e 3 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0430 \u043a\u043e\u043b\u043b\u0435\u0433 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041c\u044b \u0438 \u0442\u0430\u043a \u0433\u0435\u0440\u043e\u0438.<\/span><span class=\"tm-article-poll__answer-votes\">1<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 33.33%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 3 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.    \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 3 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/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\/articles\/896492\/\"> https:\/\/habr.com\/ru\/articles\/896492\/<\/a><br \/><\/br><\/br><\/p>\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-454453","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454453","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=454453"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454453\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}