{"id":312982,"date":"2020-11-11T21:00:43","date_gmt":"2020-11-11T21:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=312982"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=312982","title":{"rendered":"Python API \u0432 Delta Lake \u2014 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 Upsert \u0438 Delete"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/071\/57c\/ed3\/07157ced3da9bdd81c157fdf7ef7419c\" width=\"780\" height=\"439\"><figcaption><\/figcaption><\/figure>\n<blockquote>\n<p>\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 <a href=\"https:\/\/otus.pw\/mgfj\/\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u0435\u043c\u043e-\u0443\u0440\u043e\u043a, <\/a>\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <strong>\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c Ni-Fi \u0438 \u0440\u043e\u043b\u044c data ingestion \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u043f\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Ni-Fi<\/strong><a href=\"https:\/\/otus.pw\/mgfj\/\">.<\/a> \u0423\u0440\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 OTUS &#8212; \u0415\u0433\u043e\u0440 \u041c\u0430\u0442\u0435\u0448\u0443\u043a.<\/p>\n<p>\u0410 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c.<\/p>\n<\/blockquote>\n<hr>\n<h4>Delta Lake 0.4.0 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 Python API \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435<\/h4>\n<p>\u041c\u044b \u0440\u0430\u0434\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e \u0440\u0435\u043b\u0438\u0437\u0435 <a href=\"http:\/\/delta.io\/\">Delta Lake<\/a> 0.4.0, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d Python API, \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 Delta-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>Python API \u0434\u043b\u044f DML \u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (<a href=\"https:\/\/github.com\/delta-io\/delta\/issues\/89\">#89<\/a>) &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python API \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f(update)\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f(delete)\/\u0441\u043b\u0438\u044f\u043d\u0438\u044f(merge) \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e, vacuum \u0438 history) \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 Delta Lake. \u041e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0432 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#slowly-changing-data-scd-type-2-operation-into-delta-tables\">\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 (SCD &#8212; Slowly Changing Dimension)<\/a>, \u0441\u043b\u0438\u044f\u043d\u0438\u044f <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#write-change-data-into-a-delta-table\">\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/a> <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#write-change-data-into-a-delta-table\">\u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0434\u043b\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#upsert-from-streaming-queries-using-foreachbatch\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 upsert \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a>. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>Convert-to-Delta (<a href=\"https:\/\/github.com\/delta-io\/delta\/issues\/78\">#78<\/a>) &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 Parquet, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 Delta-\u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0442\u0438\u043c &#8212; \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake, \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c) \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#convert-to-delta\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>SQL \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SQL \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 vacuum \u0438 history. \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#enable-sql-commands-within-apache-spark\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Spark \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0434\u043b\u044f Delta Lake \u043a\u043e\u043c\u0430\u043d\u0434 SQL.<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/delta-io\/delta\/releases\/tag\/v0.4.0\">\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u0445 \u043a \u0440\u0435\u043b\u0438\u0437\u0443 Delta Lake 0.4.0<\/a> \u0438 \u0432 <a href=\"https:\/\/docs.delta.io\/0.4.0\/index.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e Delta Lake<\/a> &gt; <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446<\/a>.<\/p>\n<p><iframe id=\"5fabf8bccb79a1e12d666419\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/5fabf8bccb79a1e12d666419\" class=\"embed_video embed__content\"><\/iframe><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python \u0438 \u043d\u043e\u0432\u044b\u0439 Python API \u0432 Delta Lake 0.4.0 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 <em>\u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432<\/em> \u043d\u0430 <a href=\"https:\/\/spark.apache.org\/news\/spark-2-4-3-released.html\">Apache Spark\u2122 2.4.3<\/a>. \u041c\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 upsert \u0438 delete, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (time travel) \u0438 \u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e vacuum.<\/p>\n<h3>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Delta Lake<\/h3>\n<p>\u041f\u0430\u043a\u0435\u0442 Delta Lake \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 <code>--packages<\/code>. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c VACUUM \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c Delta Lake SQL \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 Apache Spark. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>spark.databricks.delta.retentionDurationCheck.enabled=false<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c vacuum \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0440\u043e\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0440\u043e\u043a\u0430 \u0432 7 \u0434\u043d\u0435\u0439. \u042d\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b SQL VACUUM.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension<\/code> \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Delta Lake SQL \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 Apache Spark; \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 Python API \u0438\u043b\u0438 Scala \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 Spark  .\/bin\/pyspark --packages io.delta:delta-core2.11:0.4.0 --conf \"spark.databricks.delta.retentionDurationCheck.enabled=false\" --conf \"spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension\"<\/code><\/pre>\n<h3>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 Delta Lake \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043b\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0432\u044b\u043b\u0435\u0442\u043e\u0432 RITA BTS; \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c &#8212; <a href=\"https:\/\/dennyglee.com\/2014\/06\/06\/2014-flight-departure-performance-via-d3-js-crossfilter\/\">\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0437\u0430 2014 \u0432 d3.js Crossfilter<\/a>, \u0438 \u0437\u0434\u0435\u0441\u044c &#8212; <a href=\"https:\/\/databricks.com\/blog\/2016\/03\/16\/on-time-flight-performance-with-graphframes-for-apache-spark.html\">\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 GraphFrames \u0434\u043b\u044f Apache Spark\u2122<\/a>. \u042d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441 \u044d\u0442\u043e\u0433\u043e <a href=\"https:\/\/github.com\/dennyglee\/databricks\/blob\/master\/misc\/departuredelays.csv.gz\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043d\u0430 github<\/a>. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <code>pyspark<\/code>.<\/p>\n<pre><code class=\"python\"># \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f tripdelaysFilePath = \"\/root\/data\/departuredelays.csv\" pathToEventsTable = \"\/root\/deltalake\/departureDelays.delta\"  # \u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 departureDelays = spark.read \\ .option(\"header\", \"true\") \\ .option(\"inferSchema\", \"true\") \\ .csv(tripdelaysFilePath) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043d\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 <code>departureDelays<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u044d\u0442\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 Delta Lake, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 ACID \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043a\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Delta Lake departureDelays \\ .write \\ .format(\"delta\") \\ .mode(\"overwrite\") \\ .save(\"departureDelays.delta\")<\/code><\/pre>\n<p><em>&nbsp;<\/em><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 Parquet; \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f <code>format(\"parquet\")<\/code> \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 <code>format(\"delta\")<\/code>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u0432 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b Delta Lake <code>departureDelays<\/code>.<\/p>\n<pre><code class=\"python\">\/departureDelays.delta$ ls -l . .. _delta_log part-00000-df6f69ea-e6aa-424b-bc0e-f3674c4f1906-c000.snappy.parquet part-00001-711bcce3-fe9e-466e-a22c-8256f8b54930-c000.snappy.parquet part-00002-778ba97d-89b8-4942-a495-5f6238830b68-c000.snappy.parquet part-00003-1a791c4a-6f11-49a8-8837-8093a3220581-c000.snappy.parquet<\/code><\/pre>\n<blockquote>\n<p><em>\u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e <\/em><code>_delta_log<\/code><em> &#8212; \u043f\u0430\u043f\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u043e\u0433 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 Delta Lake. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <\/em><a href=\"https:\/\/databricks.com\/blog\/2019\/08\/21\/diving-into-delta-lake-unpacking-the-transaction-log.html\"><em>\u041f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 Delta Lake: \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043b\u043e\u0433\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439<\/em><\/a><em>.<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u0448 DataFrame \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f Delta Lake.<\/p>\n<pre><code class=\"python\"># \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Delta Lake delays_delta = spark \\ .read \\ .format(\"delta\") \\ .load(\"departureDelays.delta\")  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 delays_delta.createOrReplaceTempView(\"delays_delta\")   # \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e spark.sql(\"select count(1) from delays_delta where origin = 'SEA' and destination = 'SFO'\").show()<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a3f\/ec8\/3df\/a3fec83df038ca5b1860f411d16fd0c9\" width=\"204\" height=\"140\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e; \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 1698.<\/p>\n<h3>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0432 Delta Lake<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Parquet, \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0430\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0442.\u0435. \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code class=\"python\">from delta.tables import *  # \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 parquet \u043f\u043e \u043f\u0443\u0442\u0438 '\/path\/to\/table' deltaTable = DeltaTable.convertToDelta(spark, \"parquet.`\/path\/to\/table`\")  # \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 parquet \u043f\u043e \u043f\u0443\u0442\u0438 '\/path\/to\/table', \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c 'part' partitionedDeltaTable = DeltaTable.convertToDelta(spark, \"parquet.`\/path\/to\/table`\", \"part int\")<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Scala \u0438 SQL, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#convert-to-delta\">\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Delta Lake<\/a>.<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 Data Lake \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043c\u0435\u043d\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432 Delta Lake \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 DELETE. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0440\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0431\u044b\u043b\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0442.\u0435. <code>delay &lt; 0<\/code>).<\/p>\n<pre><code class=\"python\">from delta.tables import * from pyspark.sql.functions import *  # \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 Delta Lake deltaTable = DeltaTable.forPath(spark, pathToEventsTable ) # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0440\u0435\u0439\u0441\u044b \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f deltaTable.delete(\"delay &lt; 0\")   # \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e spark.sql(\"select count(1) from delays_delta where origin = 'SEA' and destination = 'SFO'\").show()<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/90d\/da3\/c4e\/90dda3c4e78409c1a5e1981789d56799\" width=\"194\" height=\"140\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f<\/em> (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435) \u0432\u0441\u0435\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 837 \u043e\u043f\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b <em>\u0443\u0434\u0430\u043b\u0438\u043b\u0438<\/em> \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<pre><code class=\"python\">\/departureDelays.delta$ ls -l _delta_log part-00000-a2a19ba4-17e9-4931-9bbf-3c9d4997780b-c000.snappy.parquet part-00000-df6f69ea-e6aa-424b-bc0e-f3674c4f1906-c000.snappy.parquet part-00001-711bcce3-fe9e-466e-a22c-8256f8b54930-c000.snappy.parquet part-00001-a0423a18-62eb-46b3-a82f-ca9aac1f1e93-c000.snappy.parquet part-00002-778ba97d-89b8-4942-a495-5f6238830b68-c000.snappy.parquet part-00002-bfaa0a2a-0a31-4abf-aa63-162402f802cc-c000.snappy.parquet part-00003-1a791c4a-6f11-49a8-8837-8093a3220581-c000.snappy.parquet part-00003-b0247e1d-f5ce-4b45-91cd-16413c784a66-c000.snappy.parquet<\/code><\/pre>\n<p>\u0412 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043e\u0437\u0435\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/em> (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <em>delete<\/em>) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u044b. \u0412 Delta Lake \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0442\u043e\u043b\u044c\u043a\u043e<em> \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f<\/em> \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 Delta Lake \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043d\u043e\u0433\u043e\u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430 \u043e\u0434\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u042d\u0442\u0430 \u043c\u043d\u043e\u0433\u043e\u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/databricks.com\/blog\/2019\/02\/04\/introducing-delta-time-travel-for-large-scale-data-lakes.html\">\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/a>) \u0438 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0437\u0436\u0435.&nbsp;<\/p>\n<h3>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>&nbsp;\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Data Lake, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\/\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043c\u0435\u043d\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432 Delta Lake \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 UPDATE. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431\u043e \u0432\u0441\u0435\u0445 \u0440\u0435\u0439\u0441\u0430\u0445 \u0438\u0437 \u0414\u0435\u0442\u0440\u043e\u0439\u0442\u0430, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0414\u0435\u0442\u0440\u043e\u0439\u0442 \u043d\u0430 \u0421\u0438\u044d\u0442\u043b.<\/p>\n<pre><code class=\"python\"># \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0440\u0435\u0439\u0441\u044b \u0438\u0437 \u0414\u0435\u0442\u0440\u043e\u0439\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u0441\u0442\u0430\u043b\u0438 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 deltaTable.update(\"origin = 'DTW'\", { \"origin\": \"'SEA'\" } )   # \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e spark.sql(\"select count(1) from delays_delta where origin = 'SEA' and destination = 'SFO'\").show()<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bea\/ca1\/dd4\/beaca1dd452d046df6bab6df69c2eeec\" width=\"208\" height=\"174\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0439\u0441\u044b \u0438\u0437 \u0414\u0435\u0442\u0440\u043e\u0439\u0442\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a \u0440\u0435\u0439\u0441\u044b \u0421\u0438\u044d\u0442\u043b\u0430, \u0443 \u043d\u0430\u0441 \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f 986 \u0440\u0435\u0439\u0441\u043e\u0432, \u0432\u044b\u043b\u0435\u0442\u0430\u044e\u0449\u0438\u0445 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e. \u0415\u0441\u043b\u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0430\u043f\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b <em>departureDelays<\/em> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>$..\/departureDelays\/ls -l<\/code>), \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043c 11 \u0444\u0430\u0439\u043b\u043e\u0432 (\u0432\u043c\u0435\u0441\u0442\u043e 8 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b).<\/p>\n<h3>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0420\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043e\u0437\u0435\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u044d\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u042d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0431\u044b \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443), \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0438 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c. \u0412 Delta Lake \u0432\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 merge (\u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 SQL MERGE).<\/p>\n<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<pre><code class=\"python\"># \u041a\u0430\u043a\u0438\u0435 \u0440\u0435\u0439\u0441\u044b \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c (SEA) \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e (SFO) \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u0438 \u0434\u0430\u0442\u044b spark.sql(\"select * from delays_delta where origin = 'SEA' and destination = 'SFO' and date like '1010%' limit 10\").show()<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0438\u0436\u0435. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0442\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u044b (\u0441\u0438\u043d\u0438\u0439), \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u044b (\u0436\u0435\u043b\u0442\u044b\u0439) \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b (\u0437\u0435\u043b\u0435\u043d\u044b\u0439).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3b7\/d16\/69a\/3b7d1669acdb8510cefaffb775e9a04a\" width=\"790\" height=\"364\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e <code>merge_table<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"python\">items = [(1010710, 31, 590, 'SEA', 'SFO'), (1010521, 10, 590, 'SEA', 'SFO'), (1010822, 31, 590, 'SEA', 'SFO')] cols = ['date', 'delay', 'distance', 'origin', 'destination'] merge_table = spark.createDataFrame(items, cols) merge_table.toPandas()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/660\/32a\/e22\/66032ae22463f5a9b22bd31f6c40cf23\" width=\"804\" height=\"282\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 (merge_table) \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u0442\u044b:<\/p>\n<ol>\n<li>\n<p>1010521: \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 <em>\u043e\u0431\u043d\u043e\u0432\u0438\u0442<\/em> \u0442\u0430\u0431\u043b\u0438\u0446\u0443 <em>flights<\/em> \u043d\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 (\u0436\u0435\u043b\u0442\u044b\u0439)<\/p>\n<\/li>\n<li>\n<p>1010710: \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>\u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u043c <\/em>(\u0441\u0438\u043d\u0438\u0439)<\/p>\n<\/li>\n<li>\n<p>1010822: \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 <em>\u0432\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 <\/em>(\u0437\u0435\u043b\u0435\u043d\u044b\u0439)<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 Delta Lake \u0432\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>merge,<\/em> \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<pre><code class=\"python\"># \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c merge_table \u0441 flights deltaTable.alias(\"flights\") \\     .merge(merge_table.alias(\"updates\"),\"flights.date = updates.date\") \\     .whenMatchedUpdate(set = { \"delay\" : \"updates.delay\" } ) \\     .whenNotMatchedInsertAll() \\     .execute()  # \u041a\u0430\u043a\u0438\u0435 \u0440\u0435\u0439\u0441\u044b \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c (SEA) \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e (SFO) \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u0438 \u0434\u0430\u0442\u044b spark.sql(\"select * from delays_delta where origin = 'SEA' and destination = 'SFO' and date like '1010%' limit 10\").show()<\/code><\/pre>\n<\/p>\n<p>\u0412\u0441\u0435 \u0442\u0440\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u0431\u044b\u043b\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c13\/0bf\/1e7\/c130bf1e7f6b602f834cdc321555eb33\" width=\"818\" height=\"426\"><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u043e\u0442\u043c\u0435\u0447\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u043d\u0435\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435) \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0444\u0430\u0439\u043b\u043e\u0432. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Delta Lake. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>DeltaTable.history()<\/code>, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"sql\">deltaTable.history().show() +-------+-------------------+------+--------+---------+--------------------+----+--------+---------+-----------+--------------+-------------+ |version|          timestamp|userId|userName|operation| operationParameters| job|notebook|clusterId|readVersion|isolationLevel|isBlindAppend| +-------+-------------------+------+--------+---------+--------------------+----+--------+---------+-----------+--------------+-------------+ |      2|2019-09-29 15:41:22|  null|    null|   UPDATE|[predicate -&gt; (or...|null|    null|     null|          1|          null|        false| |      1|2019-09-29 15:40:45|  null|    null|   DELETE|[predicate -&gt; [\"(...|null|    null|     null|          0|          null|        false| |      0|2019-09-29 15:40:14|  null|    null|    WRITE|[mode -&gt; Overwrit...|null|    null|     null|       null|          null|        false| +-------+-------------------+------+--------+---------+--------------------+----+--------+---------+-----------+--------------+-------------+<\/code><\/pre>\n<p><em>\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL:<\/em><\/p>\n<p><code>spark.sql(\"DESCRIBE HISTORY '\" + pathToEventsTable + \"'\").show()<\/code><\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (\u043d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435):<\/p>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p><strong>version<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>timestamp<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>operation<\/strong><\/p>\n<\/td>\n<td>\n<p><strong>operationParameters<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>2<\/p>\n<\/td>\n<td>\n<p>2019-09-29 15:41:22<\/p>\n<\/td>\n<td>\n<p>UPDATE<\/p>\n<\/td>\n<td>\n<p>[predicate -&gt; (or\u2026<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>1<\/p>\n<\/td>\n<td>\n<p>2019-09-29 15:40:45<\/p>\n<\/td>\n<td>\n<p>DELETE<\/p>\n<\/td>\n<td>\n<p>[predicate -&gt; [\u201c(\u2026<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>0<\/p>\n<\/td>\n<td>\n<p>2019-09-29 15:40:14<\/p>\n<\/td>\n<td>\n<p>WRITE<\/p>\n<\/td>\n<td>\n<p>[mode -&gt; Overwrit\u2026<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3>\u041f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u043b\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0430\u0439\u043c\u0441\u0442\u0435\u043c\u043f\u0430. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e Delta Lake &gt; <a href=\"https:\/\/docs.delta.io\/latest\/quick-start.html#read-older-versions-of-data-using-time-travel\">\u0427\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Time Travel<\/a>. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u043f\u0446\u0438\u044e version \u0438\u043b\u0438 Timestamp; \u0432 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043a\u043e\u0434\u0430 \u043d\u0438\u0436\u0435, \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c version<\/p>\n<pre><code class=\"python\"># \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c DataFrames \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 dfv0 = spark.read.format(\"delta\").option(\"versionAsOf\", 0).load(\"departureDelays.delta\") dfv1 = spark.read.format(\"delta\").option(\"versionAsOf\", 1).load(\"departureDelays.delta\") dfv2 = spark.read.format(\"delta\").option(\"versionAsOf\", 2).load(\"departureDelays.delta\")  # \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0442\u043e\u0432 \u043e\u0442 \u0421\u0438\u044d\u0442\u043b\u0430 (SEA) \u0434\u043e \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e (SFO) \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 cnt0 = dfv0.where(\"origin = 'SEA'\").where(\"destination = 'SFO'\").count() cnt1 = dfv1.where(\"origin = 'SEA'\").where(\"destination = 'SFO'\").count() cnt2 = dfv2.where(\"origin = 'SEA'\").where(\"destination = 'SFO'\").count()  # \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 print(\"SEA -&gt; SFO Counts: Create Table: %s, Delete: %s, Update: %s\" % (cnt0, cnt1, cnt2))  ## \u0412\u044b\u0432\u043e\u0434 SEA -&gt; SFO Counts: Create Table: 1698, Delete: 837, Update: 986 <\/code><\/pre>\n<h3>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Vacuum<\/h3>\n<p>\u041c\u0435\u0442\u043e\u0434 vacuum Delta Lake \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (\u0438 \u0444\u0430\u0439\u043b\u044b) \u0441\u0442\u0430\u0440\u0448\u0435 7 \u0434\u043d\u0435\u0439 (\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441: <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#vacuum\">Delta Lake Vacuum<\/a>). \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u0431\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 11 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">\/departureDelays.delta$ ls -l _delta_log part-00000-5e52736b-0e63-48f3-8d56-50f7cfa0494d-c000.snappy.parquet part-00000-69eb53d5-34b4-408f-a7e4-86e000428c37-c000.snappy.parquet part-00000-f8edaf04-712e-4ac4-8b42-368d0bbdb95b-c000.snappy.parquet part-00001-20893eed-9d4f-4c1f-b619-3e6ea1fdd05f-c000.snappy.parquet part-00001-9b68b9f6-bad3-434f-9498-f92dc4f503e3-c000.snappy.parquet part-00001-d4823d2e-8f9d-42e3-918d-4060969e5844-c000.snappy.parquet part-00002-24da7f4e-7e8d-40d1-b664-95bf93ffeadb-c000.snappy.parquet part-00002-3027786c-20a9-4b19-868d-dc7586c275d4-c000.snappy.parquet part-00002-f2609f27-3478-4bf9-aeb7-2c78a05e6ec1-c000.snappy.parquet part-00003-850436a6-c4dd-4535-a1c0-5dc0f01d3d55-c000.snappy.parquet part-00003-b9292122-99a7-4223-aaa9-8646c281f199-c000.snappy.parquet<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 vacuum (\u0432\u043c\u0435\u0441\u0442\u043e 7 \u0434\u043d\u0435\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e).<\/p>\n<pre><code class=\"sql\">\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e SQL \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430: \u00b8  # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0441\u0442\u0430\u0440\u0448\u0435 0 \u0447\u0430\u0441\u043e\u0432  spark.sql(\u201cVACUUM \u2018\u201d + pathToEventsTable + \u201c\u2018 RETAIN 0 HOURS\u201d)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 vacuum, \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u044b.<\/p>\n<pre><code class=\"sql\">\/departureDelays.delta$ ls -l _delta_log part-00000-f8edaf04-712e-4ac4-8b42-368d0bbdb95b-c000.snappy.parquet part-00001-9b68b9f6-bad3-434f-9498-f92dc4f503e3-c000.snappy.parquet part-00002-24da7f4e-7e8d-40d1-b664-95bf93ffeadb-c000.snappy.parquet part-00003-b9292122-99a7-4223-aaa9-8646c281f199-c000.snappy.parquet<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0430\u0440\u0448\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 vacuum.<\/p>\n<h3>\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 Delta Lake \u0443\u0436\u0435 \u0441\u0435\u0433\u043e\u0434\u043d\u044f, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u0441\u0432\u043e\u0435\u043c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435 Apache Spark 2.4.3 (\u0438\u043b\u0438 \u0432\u044b\u0448\u0435). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Delta Lake, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0437\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u043c\u0438 (\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b \u043d\u043e\u0432\u043e\u0435 \u0438\u043b\u0438 \u043c\u0438\u0433\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043e\u0437\u0435\u0440\u043e \u0434\u0430\u043d\u043d\u044b\u0445). \u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 <a href=\"https:\/\/delta.io\/\">https:\/\/delta.io\/<\/a> \u0438 \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u0435\u0441\u044c \u043a \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 Delta Lake \u0432 <a href=\"https:\/\/delta-users.slack.com\/join\/shared_invite\/enQtNTY1NDg0ODcxOTI1LWE3YjMxOTM4MmM0YWNhNjE2YmI2OGI4N2Y3MTRhOWQ1YzE3MTMyYTM5YzRiZWZlYzMwYzk0M2JiZmJhY2Q4NWI\">Slack<\/a> \u0438 <a href=\"https:\/\/groups.google.com\/forum\/#!forum\/delta-users\">Google Group<\/a>. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0440\u0435\u043b\u0438\u0437\u044b \u0438 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0438\u0447\u0438 \u0432 <a href=\"https:\/\/github.com\/delta-io\/delta\/milestones\">github milestones<\/a>.<\/p>\n<hr>\n<p><a href=\"https:\/\/otus.pw\/mgfj\/\"><strong>\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u0435\u043c\u043e-\u0443\u0440\u043e\u043a.<\/strong><\/a><\/p>\n<hr>\n<h3>\u0427\u0438\u0442\u0430\u0442\u044c \u0435\u0449\u0451:<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/526174\/\">\u041a\u0442\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442 \u0437\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438: QA \u0434\u043b\u044f \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0414\u0430\u043d\u043d\u044b\u0445<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/527602\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/527602\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<blockquote>\n<p>\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 <a href=\"https:\/\/otus.pw\/mgfj\/\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u0435\u043c\u043e-\u0443\u0440\u043e\u043a, <\/a>\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e <strong>\u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c Ni-Fi \u0438 \u0440\u043e\u043b\u044c data ingestion \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u043f\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Ni-Fi<\/strong><a href=\"https:\/\/otus.pw\/mgfj\/\">.<\/a> \u0423\u0440\u043e\u043a \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u0442 \u044d\u043a\u0441\u043f\u0435\u0440\u0442 OTUS &#8212; \u0415\u0433\u043e\u0440 \u041c\u0430\u0442\u0435\u0448\u0443\u043a.<\/p>\n<p>\u0410 \u043f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c.<\/p>\n<\/blockquote>\n<hr>\n<h4>Delta Lake 0.4.0 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 Python API \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435<\/h4>\n<p>\u041c\u044b \u0440\u0430\u0434\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e \u0440\u0435\u043b\u0438\u0437\u0435 <a href=\"http:\/\/delta.io\/\">Delta Lake<\/a> 0.4.0, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d Python API, \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 Delta-\u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0444\u0438\u0447\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043b\u0438\u0437\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>Python API \u0434\u043b\u044f DML \u0438 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (<a href=\"https:\/\/github.com\/delta-io\/delta\/issues\/89\">#89<\/a>) &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python API \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f(update)\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f(delete)\/\u0441\u043b\u0438\u044f\u043d\u0438\u044f(merge) \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e, vacuum \u0438 history) \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 Delta Lake. \u041e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0432 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#slowly-changing-data-scd-type-2-operation-into-delta-tables\">\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 (SCD &#8212; Slowly Changing Dimension)<\/a>, \u0441\u043b\u0438\u044f\u043d\u0438\u044f <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#write-change-data-into-a-delta-table\">\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/a> <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#write-change-data-into-a-delta-table\">\u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0434\u043b\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html#upsert-from-streaming-queries-using-foreachbatch\">\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 upsert \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a>. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>Convert-to-Delta (<a href=\"https:\/\/github.com\/delta-io\/delta\/issues\/78\">#78<\/a>) &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 Parquet, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 Delta-\u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0442\u0438\u043c &#8212; \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake, \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c) \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Parquet. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#convert-to-delta\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>SQL \u0434\u043b\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 &#8212; \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SQL \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 vacuum \u0438 history. \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#enable-sql-commands-within-apache-spark\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c Spark \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0434\u043b\u044f Delta Lake \u043a\u043e\u043c\u0430\u043d\u0434 SQL.<\/p>\n<\/li>\n<\/ul>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/delta-io\/delta\/releases\/tag\/v0.4.0\">\u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u0445 \u043a \u0440\u0435\u043b\u0438\u0437\u0443 Delta Lake 0.4.0<\/a> \u0438 \u0432 <a href=\"https:\/\/docs.delta.io\/0.4.0\/index.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e Delta Lake<\/a> &gt; <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-update.html\">\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446<\/a>.<\/p>\n<p><iframe id=\"5fabf8bccb79a1e12d666419\" src=\"https:\/\/embedd.srv.habr.com\/iframe\/5fabf8bccb79a1e12d666419\" class=\"embed_video embed__content\"><\/iframe><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python \u0438 \u043d\u043e\u0432\u044b\u0439 Python API \u0432 Delta Lake 0.4.0 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 <em>\u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432<\/em> \u043d\u0430 <a href=\"https:\/\/spark.apache.org\/news\/spark-2-4-3-released.html\">Apache Spark\u2122 2.4.3<\/a>. \u041c\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 upsert \u0438 delete, \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (time travel) \u0438 \u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e vacuum.<\/p>\n<h3>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Delta Lake<\/h3>\n<p>\u041f\u0430\u043a\u0435\u0442 Delta Lake \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 <code>--packages<\/code>. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c VACUUM \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c Delta Lake SQL \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 Apache Spark. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>spark.databricks.delta.retentionDurationCheck.enabled=false<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c vacuum \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0440\u043e\u043a \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u0435\u043d\u044c\u0448\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0440\u043e\u043a\u0430 \u0432 7 \u0434\u043d\u0435\u0439. \u042d\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b SQL VACUUM.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension<\/code> \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Delta Lake SQL \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 Apache Spark; \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u0432 Python API \u0438\u043b\u0438 Scala \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 Spark  .\/bin\/pyspark --packages io.delta:delta-core2.11:0.4.0 --conf \"spark.databricks.delta.retentionDurationCheck.enabled=false\" --conf \"spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension\"<\/code><\/pre>\n<h3>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 Delta Lake \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043b\u0435\u0442\u043e\u0432 \u0438\u043b\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0432\u044b\u043b\u0435\u0442\u043e\u0432 RITA BTS; \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c &#8212; <a href=\"https:\/\/dennyglee.com\/2014\/06\/06\/2014-flight-departure-performance-via-d3-js-crossfilter\/\">\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0437\u0430 2014 \u0432 d3.js Crossfilter<\/a>, \u0438 \u0437\u0434\u0435\u0441\u044c &#8212; <a href=\"https:\/\/databricks.com\/blog\/2016\/03\/16\/on-time-flight-performance-with-graphframes-for-apache-spark.html\">\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u0432\u044b\u043b\u0435\u0442\u0430\u0445 \u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 GraphFrames \u0434\u043b\u044f Apache Spark\u2122<\/a>. \u042d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441 \u044d\u0442\u043e\u0433\u043e <a href=\"https:\/\/github.com\/dennyglee\/databricks\/blob\/master\/misc\/departuredelays.csv.gz\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u043d\u0430 github<\/a>. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 <code>pyspark<\/code>.<\/p>\n<pre><code class=\"python\"># \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f tripdelaysFilePath = \"\/root\/data\/departuredelays.csv\" pathToEventsTable = \"\/root\/deltalake\/departureDelays.delta\"  # \u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 departureDelays = spark.read \\ .option(\"header\", \"true\") \\ .option(\"inferSchema\", \"true\") \\ .csv(tripdelaysFilePath) <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043d\u0430\u0448 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 <code>departureDelays<\/code> \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Delta Lake. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u044d\u0442\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 Delta Lake, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 ACID \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u0430\u043a\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Delta Lake departureDelays \\ .write \\ .format(\"delta\") \\ .mode(\"overwrite\") \\ .save(\"departureDelays.delta\")<\/code><\/pre>\n<p><em>&nbsp;<\/em><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u0435\u043d \u043e\u0431\u044b\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 Parquet; \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f <code>format(\"parquet\")<\/code> \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0435 <code>format(\"delta\")<\/code>. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u0432 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b Delta Lake <code>departureDelays<\/code>.<\/p>\n<pre><code class=\"python\">\/departureDelays.delta$ ls -l . .. _delta_log part-00000-df6f69ea-e6aa-424b-bc0e-f3674c4f1906-c000.snappy.parquet part-00001-711bcce3-fe9e-466e-a22c-8256f8b54930-c000.snappy.parquet part-00002-778ba97d-89b8-4942-a495-5f6238830b68-c000.snappy.parquet part-00003-1a791c4a-6f11-49a8-8837-8093a3220581-c000.snappy.parquet<\/code><\/pre>\n<blockquote>\n<p><em>\u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e <\/em><code>_delta_log<\/code><em> &#8212; \u043f\u0430\u043f\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u043e\u0433 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 Delta Lake. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <\/em><a href=\"https:\/\/databricks.com\/blog\/2019\/08\/21\/diving-into-delta-lake-unpacking-the-transaction-log.html\"><em>\u041f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 Delta Lake: \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043b\u043e\u0433\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439<\/em><\/a><em>.<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u0448 DataFrame \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f Delta Lake.<\/p>\n<pre><code class=\"python\"># \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Delta Lake delays_delta = spark \\ .read \\ .format(\"delta\") \\ .load(\"departureDelays.delta\")  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 delays_delta.createOrReplaceTempView(\"delays_delta\")   # \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e spark.sql(\"select count(1) from delays_delta where origin = 'SEA' and destination = 'SFO'\").show()<\/code><\/pre>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e; \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0438\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 1698.<\/p>\n<h3>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0432 Delta Lake<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Parquet, \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0430\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 Delta Lake \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0442.\u0435. \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.<\/p>\n<pre><code class=\"python\">from delta.tables import *  # \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 parquet \u043f\u043e \u043f\u0443\u0442\u0438 '\/path\/to\/table' deltaTable = DeltaTable.convertToDelta(spark, \"parquet.`\/path\/to\/table`\")  # \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 parquet \u043f\u043e \u043f\u0443\u0442\u0438 '\/path\/to\/table', \u0441\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u043c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c 'part' partitionedDeltaTable = DeltaTable.convertToDelta(spark, \"parquet.`\/path\/to\/table`\", \"part int\")<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Scala \u0438 SQL, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/docs.delta.io\/0.4.0\/delta-utility.html#convert-to-delta\">\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Delta Lake<\/a>.<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 Data Lake \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043c\u0435\u043d\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432 Delta Lake \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 DELETE. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0440\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0431\u044b\u043b\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u0442.\u0435. <code>delay &lt; 0<\/code>).<\/p>\n<pre><code class=\"python\">from delta.tables import * from pyspark.sql.functions import *  # \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 Delta Lake deltaTable = DeltaTable.forPath(spark, pathToEventsTable ) # \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u0440\u0435\u0439\u0441\u044b \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0440\u0430\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f deltaTable.delete(\"delay &lt; 0\")   # \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0439\u0441\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0421\u0438\u044d\u0442\u043b\u043e\u043c \u0438 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e spark.sql(\"select count(1) from delays_delta where origin = 'SEA' and destination = 'SFO'\").show()<\/code><\/pre>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f<\/em> (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435) \u0432\u0441\u0435\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0445 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 837 \u043e\u043f\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0445 \u0440\u0435\u0439\u0441\u043e\u0432 \u0438\u0437 \u0421\u0438\u044d\u0442\u043b\u0430 \u0432 \u0421\u0430\u043d-\u0424\u0440\u0430\u043d\u0446\u0438\u0441\u043a\u043e. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b <em>\u0443\u0434\u0430\u043b\u0438\u043b\u0438<\/em> \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<pre><code class=\"python\">\/departureDelays.delta$ ls -l _delta_log part-00000-a2a19ba4-17e9-4931-9bbf-3c9d4997780b-c000.snappy.parquet part-00000-df6f69ea-e6aa-424b-bc0e-f3674c4f1906-c000.snappy.parquet part-00001-711bcce3-fe9e-466e-a22c-8256f8b54930-c000.snappy.parquet part-00001-a0423a18-62eb-46b3-a82f-ca9aac1f1e93-c000.snappy.parquet part-00002-778ba97d-89b8-4942-a495-5f6238830b68-c000.snappy.parquet part-00002-bfaa0a2a-0a31-4abf-aa63-162402f802cc-c000.snappy.parquet part-00003-1a791c4a-6f11-49a8-8837-8093a3220581-c000.snappy.parquet part-00003-b0247e1d-f5ce-4b45-91cd-16413c784a66-c000.snappy.parquet<\/code><\/pre>\n<p>\u0412 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043e\u0437\u0435\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/em> (\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <em>delete<\/em>) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u044b. \u0412 Delta Lake \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e <em>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/em> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0431\u043e\u0440\u043e\u0447\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0442\u043e\u043b\u044c\u043a\u043e<em> \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f<\/em> \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0435. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 Delta Lake \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043d\u043e\u0433\u043e\u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u043e\u0441\u0442\u0438: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043a\u0430 \u043e\u0434\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u042d\u0442\u0430 \u043c\u043d\u043e\u0433\u043e\u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0430\u0434 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/databricks.com\/blog\/2019\/02\/04\/introducing-delta-time-travel-for-large-scale-data-lakes.html\">\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/a>) \u0438 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u043e\u0437\u0436\u0435.&nbsp;<\/p>\n<h3>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u043b\u0435\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>&nbsp;\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b Data Lake, \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\/\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0437\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u043c\u0435\u043d\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u043d\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432 Delta Lake \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440<\/p>\n<\/hr>\n<\/blockquote>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-312982","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312982","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=312982"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312982\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}