{"id":354767,"date":"2024-05-20T22:54:59","date_gmt":"2024-05-20T22:54:59","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=354767"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=354767","title":{"rendered":"<span>\u041f\u044f\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e ad-hoc-\u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0432 PySpark<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/5u\/p5\/yc\/5up5ycq1svlqzz1yfma2pflwh4u.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/5u\/p5\/yc\/5up5ycq1svlqzz1yfma2pflwh4u.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  \u0414\u0430\u0442\u0430-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 PySpark, \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044b\u0447\u043d\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Spark \u043f\u043e\u0434\u0447\u0430\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u043e\u0442\u043d\u0438, \u0430 \u0442\u043e \u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u043a\u043e\u0434\u0430. \u0412 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0430\u0442\u0430-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u043a\u0430\u043a \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 VK Cloud \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f ad-hoc-\u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0422\u0430\u043a\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 ad-hoc \u0438 in-place \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u043d\u0438\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0437\u0435\u0440\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Parquet, Delta \u0438\u043b\u0438 CSV, \u0438\u043b\u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 Kafka. \u0422\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432 in-place \u0431\u0435\u0437 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<h2>\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u044c\u0437\u0430?<\/h2>\n<p>  \u041d\u043e\u0432\u044b\u0439 in-place-\u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ol>\n<li>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.  <\/li>\n<li>\u0421\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043c\u0438\u043d\u0438-\u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u043e\u0432 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.  <\/li>\n<li>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u0430\u0433\u043e\u0432 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 PySpark \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.  <\/li>\n<\/ol>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0436\u0438\u0437\u043d\u0438<\/h3>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u043e Spark 3.4.0 \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043e\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430. \u0412\u043e \u0432\u0441\u0435\u0445 \u043d\u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c JSON-\u0444\u0430\u0439\u043b\u044b, \u0430 \u0441\u0435\u0441\u0441\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 PERMISSIVE. \u0427\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u044d\u0442\u0438\u043c \u043d\u043e\u0432\u044b\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c OSS Spark. Databricks, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430 \u0436\u0435 \u0432\u0435\u0440\u0441\u0438\u044f Spark, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u044d\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 OSS \u0438 Databricks Spark \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0438\u0445 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a. \u041c\u044b \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0441\u043c\u0430\u0441\u0442\u0435\u0440\u0438\u043b\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u0438 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0442\u0438\u043a\u0435\u0442 \u0432\u00a0<a href=\"https:\/\/issues.apache.org\/jira\/browse\/SPARK-44079\">Spark JIRA<\/a>,\u00a0\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 JSON \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/p>\n<pre><code class=\"python\">from pyspark.sql.types import StructType, StructField, IntegerType, StringType import json   data = \"\"\"[{\"a\": \"incorrect\", \"b\": \"correct\"}]\"\"\" schema = StructType( \u00a0 \u00a0 [ \u00a0 \u00a0 \u00a0 \u00a0 StructField(\"a\", IntegerType(), True), \u00a0 \u00a0 \u00a0 \u00a0 StructField(\"b\", StringType(), True), \u00a0 \u00a0 \u00a0 \u00a0 StructField(\"_corrupt_record\", StringType(), True), \u00a0 \u00a0 ] )  ( \u00a0 \u00a0 spark.read.option(\"mode\", \"PERMISSIVE\") \u00a0 \u00a0 .option(\"multiline\", \"true\") \u00a0 \u00a0 .schema(schema) \u00a0 \u00a0 .json(spark.sparkContext.parallelize([data])) \u00a0 \u00a0 .show(truncate=False) )  # returns: # java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0430 \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0430 \u0432 \u0440\u0435\u043b\u0438\u0437 \u0444\u0438\u043a\u0441 \u0431\u0430\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0439\u0434\u0435\u0442 \u0432 \u0432\u0435\u0440\u0441\u0438\u044e\u00a0 Spark 3.4.2.<\/p>\n<h2>\u0420\u0430\u0437\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432<\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0438 \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u0438 \u0442\u0430 \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f:<\/p>\n<pre><code class=\"python\">from pyspark.sql import DataFrame  def check_dataframe(df: DataFrame): \u00a0 \u00a0 \"\"\"Helper for checking dataframe content and schema\"\"\" \u00a0 \u00a0  \u00a0 \u00a0 print('\"\"\" output:') \u00a0 \u00a0 df.show() \u00a0 \u00a0 df.printSchema() \u00a0 \u00a0 print('\"\"\"') <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 \u2116 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark SQL<\/h2>\n<p>  \u042d\u0442\u043e \u043c\u043e\u0439 \u043b\u044e\u0431\u0438\u043c\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 SQL \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0441\u0445\u0435\u043c\u043e\u0439 \u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u044b\u0435, \u0442\u0430\u043a \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<h3>1.1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark SQL<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">df = spark.sql( \u00a0 \u00a0 \"\"\" \u00a0 \u00a0 select * from  \u00a0 \u00a0 values  \u00a0 \u00a0 \u00a0 \u00a0 (1, 'abc'),  \u00a0 \u00a0 \u00a0 \u00a0 (2, 'def') as (id, value) \u00a0 \u00a0 \"\"\" ) check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: integer (nullable = false)  |-- value: string (nullable = false) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>1.2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark SQL<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">df = spark.sql( \u00a0 \u00a0 \"\"\" \u00a0 \u00a0 select  \u00a0 \u00a0 \u00a0 'a' as col1,\u00a0 \u00a0 \u00a0 \u00a0  \u00a0 \u00a0 \u00a0 struct(1 as child1, current_date as child2) as col2, \u00a0 \u00a0 \u00a0 array(1,2,3) as col3 \u00a0 \u00a0 \"\"\" ) check_dataframe(df)  \"\"\" output: +----+---------------+---------+ |col1| \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 col2| \u00a0 \u00a0 col3| +----+---------------+---------+ | \u00a0 a|{1, 2023-07-29}|[1, 2, 3]| +----+---------------+---------+  root  |-- col1: string (nullable = false)  |-- col2: struct (nullable = false)  |\u00a0 \u00a0 |-- child1: integer (nullable = false)  |\u00a0 \u00a0 |-- child2: date (nullable = false)  |-- col3: array (nullable = false)  |\u00a0 \u00a0 |-- element: integer (containsNull = false) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 \u2116 2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u0441\u0442\u0440\u043e\u043a CSV \u0438\u043b\u0438 JSON \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RDD<\/h2>\n<p>  \u0418\u043d\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0432\u0440\u043e\u0434\u0435 CSV \u0438\u043b\u0438 JSON, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c RDD, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<h3>2.1. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c JSON \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RDD<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">json_string = \"\"\" [ \u00a0 \u00a0 {\"id\": 1, \"value\": \"abc\"}, \u00a0 \u00a0 {\"id\": 2, \"value\": \"def\"} ]\"\"\"  rdd_data = spark.sparkContext.parallelize([json_string]) df = spark.read.json(rdd_data)  check_dataframe(df)   \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>02.2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c CSV \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RDD<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">csv_string = \"\"\" id,value 1,abc 2,def \"\"\"  rdd_data = spark.sparkContext.parallelize(csv_string.splitlines()) df = spark.read.options(header=True, inferSchema=True).csv(rdd_data)  check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: integer (nullable = true)  |-- value: string (nullable = true \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 \u2116 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pandas<\/h2>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Pandas. \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 RDD, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u043f\u0430\u043a\u0435\u0442.<\/p>\n<h3>3.1. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c JSON \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 string \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pandas<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">import pandas as pd import io  json_string = \"\"\" [ \u00a0 \u00a0 {\"id\": 1, \"value\": \"abc\"}, \u00a0 \u00a0 {\"id\": 2, \"value\": \"def\"} ] \"\"\"  pd_data = pd.read_json(io.StringIO(json_string)) df = spark.createDataFrame(pd_data)  check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>3.2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c CSV \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Pandas<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">import pandas as pd import io  csv_string = \"\"\" id,value 1,abc 2,def 3,xyz \"\"\"  data_io = io.StringIO(csv_string) pd_df = pd.read_csv(data_io, sep=\",\") df = spark.createDataFrame(pd_df)  check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| |\u00a0 3|\u00a0 xyz| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>3.3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c PySpark \u0438\u0437 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430 Pandas<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">import pandas as pd  pd_df = pd.DataFrame( \u00a0 \u00a0 { \u00a0 \u00a0 \u00a0 \u00a0 \"id\": [1, 2],  \u00a0 \u00a0 \u00a0 \u00a0 \"value\": [\"abc\", \"def\"] \u00a0 \u00a0 } ) df = spark.createDataFrame(pd_df) \u00a0   check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 \u2116 4. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Row<\/h2>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u043a\u043b\u0430\u0441\u0441\u00a0<code>pyspark.sql.row<\/code>. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 PySpark \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/medium.com\/plumbersofdatascience\/scripting-pyspark-dataframes-6527ea291e96\">\u00ab\u0421\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432 PySpark\u00bb<\/a>.<\/p>\n<h3>4.1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Row<\/h3>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 PySpark \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0438\u0436\u0435\u00a0ID \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f\u00a0long, \u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430:<\/p>\n<pre><code class=\"python\">from pyspark.sql import Row  rows_data = [Row(id=1, value=\"abc\"), Row(id=2, value=\"def\")] df = spark.createDataFrame(rows_data)  check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>4.2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Row \u0438 \u044f\u0432\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b<\/h3>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435\u00a0<code>id<\/code>\u00a0\u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u044f\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0442\u0438\u043f <code>int<\/code>:<\/p>\n<pre><code class=\"python\">from pyspark.sql import Row  rows = [Row(id=1, value=\"abc\"), Row(id=2, value=\"def\")] schema = \"id int, value string\" df = spark.createDataFrame(rows, schema)  check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: integer (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u0434\u0445\u043e\u0434 \u2116 5. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 Python<\/h2>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Python, \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u0442\u0430\u0441\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 Python, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0438, \u043a\u043e\u0440\u0442\u0435\u0436\u0438 \u0438 \u0441\u043f\u0438\u0441\u043a\u0438.<\/p>\n<h3>5.1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">data_dicts = [{\"id\": 1, \"value\": \"abc\"}, {\"id\": 2, \"value\": \"def\"}] df = spark.createDataFrame(data_dicts) check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: long (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>5.2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u044b \u0437\u0430\u0434\u0430\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0438 \u0438\u043c\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430.<\/p>\n<pre><code class=\"python\">data_tuples = [(1, \"abc\"), (2, \"def\")] schema = \"id int, value string\" df = spark.createDataFrame(data_tuples, schema) check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: integer (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<p>  <\/p>\n<h3>5.3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u0432<\/h3>\n<p>  <\/p>\n<pre><code class=\"python\">data_lists = [[1, \"abc\"], [2, \"def\"]] schema = \"id int, value string\" df = spark.createDataFrame(data_lists, schema) check_dataframe(df)  \"\"\" output: +---+-----+ | id|value| +---+-----+ |\u00a0 1|\u00a0 abc| |\u00a0 2|\u00a0 def| +---+-----+  root  |-- id: integer (nullable = true)  |-- value: string (nullable = true) \"\"\" <\/code><\/pre>\n<blockquote><p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0433\u043e\u0442\u043e\u0432\u0438\u0442 \u043a \u0440\u0435\u043b\u0438\u0437\u0443 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 Spark \u0432 K8s, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+mRmjbHoS0qoxMDAy\">\u00ab\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0441\u0442\u0435\u0440\u043e\u0438\u0434\u0430\u0445\u00bb<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0430\u043d\u043e\u043d\u0441!<\/p><\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/760796\/\"> https:\/\/habr.com\/ru\/articles\/760796\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/5u\/p5\/yc\/5up5ycq1svlqzz1yfma2pflwh4u.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/5u\/p5\/yc\/5up5ycq1svlqzz1yfma2pflwh4u.jpeg\" data-blurred=\"true\"\/><\/p>\n<p>  \u0414\u0430\u0442\u0430-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 PySpark, \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0431\u044b\u0447\u043d\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Spark \u043f\u043e\u0434\u0447\u0430\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u043e\u0442\u043d\u0438, \u0430 \u0442\u043e \u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u043a\u043e\u0434\u0430. \u0412 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0430\u0442\u0430-\u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u043a\u0430\u043a \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-354767","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/354767","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=354767"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/354767\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=354767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=354767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=354767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}