{"id":311687,"date":"2020-10-19T15:00:43","date_gmt":"2020-10-19T15:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311687"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311687","title":{"rendered":"Spark schemaEvolution \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/neoflex\/blog\/524080\/\">\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0434\u043d\u044f!<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0430\u043d\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Big Data Solutions \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u00ab\u041d\u0435\u043e\u0444\u043b\u0435\u043a\u0441\u00bb, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Apache Spark.<\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043b\u0430\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043b\u043e\u0433\u0438, \u0438\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 JSON \u0438\u043b\u0438 XML. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0432 Hadoop, \u0434\u0430\u043b\u0435\u0435 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0438\u0442\u0440\u0438\u043d\u0443. \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u0435 \u043c\u043e\u0436\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 Impala. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0445\u0435\u043c\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0441\u0445\u0435\u043c\u0430 \u0435\u0449\u0435 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u0441\u0430\u043c\u044b\u043c\u0438 \u0441\u043b\u0430\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <b>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442:<\/b><\/p>\n<pre><code class=\"plaintext\">{source: &quot;app1&quot;, error_code: &quot;&quot;}<\/code><\/pre>\n<p>  \u0430 \u0437\u0430\u0432\u0442\u0440\u0430 \u043e\u0442 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442:<\/p>\n<pre><code class=\"plaintext\">{source: &quot;app1&quot;, error_code: &quot;error&quot;, description: &quot;Network error&quot;}<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443 \u0434\u043e\u043b\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u0435 \u2014 description, \u0438 \u043f\u0440\u0438\u0434\u0435\u0442 \u043e\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f, \u0438 \u0443 Spark \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 JSON, \u0438 XML, \u0430 \u0434\u043b\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0445\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 schemaEvolution.<\/p>\n<p>  \u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430\u0434\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0441 JSON \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 dataframe. Spark \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0445\u0435\u043c\u0443, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 parquet, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0432 Impala, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443 \u0432 Hive metastore.<\/p>\n<p>  <b>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/b><br \/>  <a name=\"habracut\"><\/a><br \/>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0438\u0437 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0435 \u044f\u0441\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0440\u044f\u0434\u043e\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<p>  \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b, \u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f JSON \u0438\u043b\u0438 XML \u0432 dataframe.<\/p>\n<p>  \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c JSON:<\/p>\n<pre><code class=\"plaintext\">df = spark.read.json(path...)<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f Spark.<\/p>\n<p>  \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c JSON \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438, \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c dataframe. \u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0441\u0445\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  <b>\u041e\u0431\u044b\u0447\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u0442\u0430\u043a\u0430\u044f:<\/b><\/p>\n<p>  <b>\u0428\u0430\u0433 1. <\/b>\u0414\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0432 Hadoop \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0434\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e \u0434\u043d\u044f\u043c \u043f\u0430\u043f\u043a\u0430 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <b>\u0428\u0430\u0433 2. <\/b>\u0412 \u0445\u043e\u0434\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u0430 \u043f\u0430\u043f\u043a\u0430 \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0430\u0440\u0441\u0438\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 Spark. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 dataframe \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 parquet, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Impala. \u0422\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443.<\/p>\n<p>  <b>\u0428\u0430\u0433 3. <\/b>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0432\u0438\u0442\u0440\u0438\u043d\u0443.<br \/>  \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b, \u0438 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043e\u0431\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u044b \u0432\u0438\u0442\u0440\u0438\u043d\u044b.<\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 JSON \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043f\u043a\u0443. <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 dataframe, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0432\u0438\u0442\u0440\u0438\u043d\u0443, \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442. \u042d\u0442\u043e \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Spark:<\/p>\n<pre><code class=\"plaintext\">df = spark.read.option(&quot;mergeSchema&quot;, True).json(&quot;...\/*&quot;)  df.printSchema()  root  |-- a: long (nullable = true)  |-- b: string (nullable = true)  |-- c: struct (nullable = true) |     |-- d: long (nullable = true)<\/code><\/pre>\n<p>  <b>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e.<\/b><\/p>\n<p>  \u041c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0438 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u043b\u0438 JSON, \u0434\u0430\u043b\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c dataframe \u043a\u0430\u043a parquet, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u0432 Hive \u043b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"plaintext\">df.write.format(\u201cparquet\u201d).option('path','&lt;External Table Path&gt;').saveAsTable('&lt;Table Name&gt;')<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0438\u0442\u0440\u0438\u043d\u0443.<\/p>\n<p>  \u041d\u043e, \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0435\u043d\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043a\u0430 \u0441 JSON, \u0438 \u0432\u0438\u0442\u0440\u0438\u043d\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u043e\u0440\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0435 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u043e\u0434\u0438\u043d \u0434\u0435\u043d\u044c.<\/p>\n<p>  \u041b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0442\u0440\u0438\u043d\u0443 \u043f\u043e \u0434\u043d\u044f\u043c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e. \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u044d\u0442\u043e\u0433\u043e \u0442\u043e\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, Spark \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"plaintext\">df.write.partitionBy(&quot;date_load&quot;).mode(&quot;overwrite&quot;).parquet(dbpath + &quot;\/&quot; + db + &quot;\/&quot; + destTable)<\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0443\u044e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e:<\/p>\n<pre><code class=\"plaintext\">df.coalesce(1).write.mode(&quot;overwrite&quot;).parquet(dbpath + &quot;\/&quot; + db + &quot;\/&quot; + destTable +&quot;\/date_load=&quot; + date_load + &quot;\/&quot;)<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Hive, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443.<br \/>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0437\u0434\u0435\u0441\u044c \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f parquet \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 parquet \u0438 JSON \u043a \u043f\u0443\u0441\u0442\u044b\u043c \u043f\u043e\u043b\u044f\u043c.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0447\u0435\u0440\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 JSON:<\/p>\n<pre><code class=\"plaintext\">\u0414\u0435\u043d\u044c 1: {&quot;a&quot;: {&quot;b&quot;: 1}},<\/code><\/pre>\n<p>  \u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044d\u0442\u043e\u0442 \u0436\u0435 JSON \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<pre><code class=\"plaintext\">\u0414\u0435\u043d\u044c 2: {&quot;a&quot;: null}<\/code><\/pre>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<br \/>  \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, Spark \u0441\u0443\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f, \u0438 \u043f\u043e\u0439\u043c\u0435\u0442, \u0447\u0442\u043e \u00aba\u00bb \u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0442\u0438\u043f\u0430 \u00ab\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00bb, \u0441\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u00abb\u00bb \u0442\u0438\u043f\u0430 INT. \u041d\u043e, \u0435\u0441\u043b\u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f parquet \u0441 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439:<\/p>\n<pre><code class=\"plaintext\">df1 (a: &lt;struct&lt;&quot;b&quot;: INT&gt;&gt;) df2 (a: STRING NULLABLE)<\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043e\u043f\u0446\u0438\u044f \u2014 \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"plaintext\">df = spark.read.json(&quot;...&quot;, dropFieldIfAllNull=True)<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 parquet \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435. <br \/>  \u0425\u043e\u0442\u044f \u0442\u0435, \u043a\u0442\u043e \u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0442\u0443\u0442 \u0433\u043e\u0440\u044c\u043a\u043e \u0443\u0441\u043c\u0435\u0445\u043d\u0443\u0442\u0441\u044f. \u041f\u043e\u0447\u0435\u043c\u0443? \u0414\u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0435\u0449\u0435 \u0434\u0432\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u0418\u043b\u0438 \u0442\u0440\u0438. \u0418\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435. \u041f\u0435\u0440\u0432\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430, \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 JSON \u0444\u0430\u0439\u043b\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, {intField: 1} \u0438 {intField: 1.1}. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e\u043f\u0430\u0434\u0443\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0442\u0446\u0438\u0438, \u0442\u043e \u043c\u0435\u0440\u0436 \u0441\u0445\u0435\u043c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u044f \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443. \u0410 \u0432\u043e\u0442 \u0435\u0441\u043b\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445, \u0442\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 intField: int, \u0430 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 intField: double.<\/p>\n<p>  \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u043b\u0430\u0433:<\/p>\n<pre><code class=\"plaintext\">df = spark.read.json(&quot;...&quot;, dropFieldIfAllNull=True, primitivesAsString=True)<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043a\u0430, \u0433\u0434\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0435\u0434\u0438\u043d\u044b\u0439 dataframe \u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 parquet \u0432\u0441\u0435\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b. \u0414\u0430? \u041d\u0435\u0442.<\/p>\n<p>  \u041d\u0430\u0434\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 Hive. Hive \u043d\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u043e\u043b\u0435\u0439, \u0430 parquet \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0441\u043e \u0441\u0445\u0435\u043c\u0430\u043c\u0438: field1: int, \u0438 Field1: int \u0434\u043b\u044f Hive \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435, \u0430 \u0434\u043b\u044f Spark \u043d\u0435\u0442. \u041d\u0430\u0434\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u043a \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443.<\/p>\n<p>  <b>\u0412\u043e\u0442 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e.<\/b><\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0442\u043e\u0440\u0430\u044f, \u0442\u043e\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0432\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u0432 \u043f\u0430\u043f\u043a\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b Spark, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u043b\u0430\u0433 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 _SUCCESS. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 parquet. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043d\u0430\u0434\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0432 Spark \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<pre><code class=\"plaintext\">hadoopConf = sc._jsc.hadoopConfiguration() hadoopConf.set(&quot;parquet.enable.summary-metadata&quot;, &quot;false&quot;) hadoopConf.set(&quot;mapreduce.fileoutputcommitter.marksuccessfuljobs&quot;, &quot;false&quot;)<\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f parquet \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f, \u0433\u0434\u0435 \u043b\u0435\u0436\u0430\u0442 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u0434\u0435\u043d\u044c. \u041c\u044b \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u0437\u0430\u0431\u043e\u0442\u0438\u043b\u0438\u0441\u044c \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u0441 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u043c \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041d\u043e, \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u2014 \u0442\u0440\u0435\u0442\u044c\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 Hive \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u0430\u0436\u0434\u0430\u044f \u043d\u043e\u0432\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u043d\u0435\u0441\u043b\u0430 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0441\u0445\u0435\u043c\u0443.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e: \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c parquet \u0432\u0438\u0442\u0440\u0438\u043d\u044b, \u0432\u0437\u044f\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430 \u0435\u0435 \u043e\u0441\u043d\u043e\u0432\u0435 DDL, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0432 Hive \u043a\u0430\u043a \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043e\u0431\u043d\u043e\u0432\u0438\u0432 \u0441\u0445\u0435\u043c\u0443 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b. <\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u043c\u044b \u043e\u043f\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u043d\u0430 Spark. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0441\u0430\u043c\u0438, \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043b\u044f parquet \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0434\u043b\u044f Hive. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Spark \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0441\u043c\u043e\u0433 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0432 \u043f\u043e\u043b\u0435 \u00abcorrupt_record\u00bb. \u0422\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Hive \u0431\u0435\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <b>\u0417\u043d\u0430\u044f \u044d\u0442\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0445\u0435\u043c\u0443:<\/b><\/p>\n<pre><code class=\"plaintext\">f_def = &quot;&quot; for f in pf.dtypes:   if f[0] != &quot;date_load&quot;:     f_def = f_def + &quot;,&quot; + f[0].replace(&quot;_corrupt_record&quot;, &quot;`_corrupt_record`&quot;) + &quot; &quot; + f[1].replace(&quot;:&quot;, &quot;`:&quot;).replace(&quot;&lt;&quot;, &quot;&lt;`&quot;).replace(&quot;,&quot;, &quot;,`&quot;).replace(&quot;array&lt;`&quot;, &quot;array&lt;&quot;)  table_define = &quot;CREATE EXTERNAL TABLE jsonevolvtable (&quot; + f_def[1:] + &quot; ) &quot; table_define = table_define + &quot;PARTITIONED BY (date_load string) STORED AS PARQUET LOCATION '\/user\/admin\/testJson\/testSchemaEvolution\/pq\/'&quot; hc.sql(&quot;drop table if exists jsonevolvtable&quot;) hc.sql(table_define)<\/code><\/pre>\n<p>  \u041a\u043e\u0434 <b>(&quot;_corrupt_record&quot;, &quot;`_corrupt_record`&quot;) + &quot; &quot; + f[1].replace(&quot;:&quot;, &quot;`:&quot;).replace(&quot;&lt;&quot;, &quot;&lt;`&quot;).replace(&quot;,&quot;, &quot;,`&quot;).replace(\u00abarray&lt;`\u00bb, \u00abarray&lt;\u00bb)<\/b> \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 DDL, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e: <\/p>\n<pre><code class=\"plaintext\">create table tname (_field1 string, 1field string)<\/code><\/pre>\n<p>  \u0421 \u0442\u0430\u043a\u0438\u043c\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u043f\u043e\u043b\u0435\u0439 \u043a\u0430\u043a \u00ab_field1, 1field\u00bb, \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 DDL, \u0433\u0434\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u044b: create table `tname` (`_field1` string, `1field` string).<\/p>\n<p>  \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c dataframe \u0441 \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u043e\u0439 (\u0432 \u043a\u043e\u0434\u0435 pf)? \u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 pf? \u042d\u0442\u043e \u043f\u044f\u0442\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u0432\u0441\u0435\u0445 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 \u0441 parquet \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b? \u042d\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0441\u0430\u043c\u044b\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439, \u043d\u043e \u0442\u044f\u0436\u0435\u043b\u044b\u0439. <\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 Hive. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0432 \u0441\u0445\u0435\u043c\u0443 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043d\u043e\u0432\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438. \u0417\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0434\u043e \u0441\u0445\u0435\u043c\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0440\u0430\u0442\u044c \u0438\u0437 Hive \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0435\u0435 \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u043d\u043e\u0432\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Hive, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u0438\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043f\u043a\u0443 \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Spark \u043e\u0431\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0441\u0440\u0430\u0437\u0443.<\/p>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438, \u0435\u0441\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e: \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 Hive \u0438 \u043d\u043e\u0432\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f. \u0414\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c. \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0445\u0435\u043c\u0430 \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u0438 \u043d\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438:<\/p>\n<pre><code class=\"plaintext\">from pyspark.sql import HiveContext from pyspark.sql.functions import lit hc = HiveContext(spark) df = spark.read.json(&quot;...&quot;, dropFieldIfAllNull=True) df.write.mode(&quot;overwrite&quot;).parquet(&quot;...\/date_load=12-12-2019&quot;) pe = hc.sql(&quot;select * from jsonevolvtable limit 1&quot;) pe.write.mode(&quot;overwrite&quot;).parquet(&quot;...\/fakePartiton\/&quot;) pf = spark.read.option(&quot;mergeSchema&quot;, True).parquet(&quot;...\/date_load=12-12-2019\/*&quot;, &quot;...\/fakePartiton\/*&quot;)<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c DDL \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u0430\u043a \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0431\u044b\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430, \u0438 \u0432 Hive \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  \u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 Hive, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u043c\u0430\u043d\u0430. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c Hive \u043f\u043e\u0447\u0438\u043d\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439:<\/p>\n<pre><code class=\"plaintext\">from pyspark.sql import HiveContext hc = HiveContext(spark)  hc.sql(&quot;MSCK REPAIR TABLE &quot; + db + &quot;.&quot; + destTable)<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0447\u0442\u0435\u043d\u0438\u044f JSON \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u0432\u044b\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u043d\u0438\u0435 \u0440\u044f\u0434\u0430 \u043d\u0435\u044f\u0432\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439, \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0418 \u0445\u043e\u0442\u044f \u044d\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435, \u043d\u043e \u043d\u0430 \u0438\u0445 \u043f\u043e\u0438\u0441\u043a \u0443\u0445\u043e\u0434\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  <b>\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0432\u0438\u0442\u0440\u0438\u043d\u044b, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c:<\/b><\/p>\n<ul>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443, \u0438\u0437\u0431\u0430\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u043e\u0442 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/li>\n<li>\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 Spark \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b<\/li>\n<li>\u041f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0438\u043f\u044b \u043a \u0441\u0442\u0440\u043e\u043a\u0435<\/li>\n<li>\u041f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u043a \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443<\/li>\n<li>\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 Hive (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 DDL)<\/li>\n<li>\u041d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b \u0441 Hive<\/li>\n<li>\u041d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 Hive<\/li>\n<\/ul>\n<p>  \u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433, \u043e\u0442\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044e \u0432\u0438\u0442\u0440\u0438\u043d \u0442\u0430\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u043f\u044b\u0442\u043d\u043e\u043c\u0443 \u043f\u0430\u0440\u0442\u043d\u0435\u0440\u0443 \u0441 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0438\u0437\u043e\u0439.<\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u043c \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/neoflex\/blog\/524080\/\"> https:\/\/habr.com\/ru\/company\/neoflex\/blog\/524080\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/neoflex\/blog\/524080\/\">\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0434\u043e\u0431\u0440\u043e\u0433\u043e \u0434\u043d\u044f!<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u043d\u0441\u0443\u043b\u044c\u0442\u0430\u043d\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Big Data Solutions \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u00ab\u041d\u0435\u043e\u0444\u043b\u0435\u043a\u0441\u00bb, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Apache Spark.<\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043b\u0430\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u043b\u043e\u0433\u0438, \u0438\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 JSON \u0438\u043b\u0438 XML. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0432 Hadoop, \u0434\u0430\u043b\u0435\u0435 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0438\u0442\u0440\u0438\u043d\u0443. \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u0435 \u043c\u043e\u0436\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 Impala. <\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0445\u0435\u043c\u0430 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0441\u0445\u0435\u043c\u0430 \u0435\u0449\u0435 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u0441\u0430\u043c\u044b\u043c\u0438 \u0441\u043b\u0430\u0431\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <b>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442:<\/b><\/p>\n<pre><code class=\"plaintext\">{source: &quot;app1&quot;, error_code: &quot;&quot;}<\/code><\/pre>\n<p>  \u0430 \u0437\u0430\u0432\u0442\u0440\u0430 \u043e\u0442 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442:<\/p>\n<pre><code class=\"plaintext\">{source: &quot;app1&quot;, error_code: &quot;error&quot;, description: &quot;Network error&quot;}<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443 \u0434\u043e\u043b\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u0435 \u2014 description, \u0438 \u043f\u0440\u0438\u0434\u0435\u0442 \u043e\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442.<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0438\u0442\u0440\u0438\u043d\u044b \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f, \u0438 \u0443 Spark \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438 JSON, \u0438 XML, \u0430 \u0434\u043b\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u0445\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 schemaEvolution.<\/p>\n<p>  \u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430\u0434\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0441 JSON \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 dataframe. Spark \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0445\u0435\u043c\u0443, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0414\u0430\u043b\u0435\u0435 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 parquet, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0432 Impala, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443 \u0432 Hive metastore.<\/p>\n<p>  <b>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/b>  <\/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-311687","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311687","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=311687"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311687\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}