<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="refresh">

  <title>REFRESH Statement</title>

  <titlealts audience="PDF">

    <navtitle>REFRESH</navtitle>

  </titlealts>

  <prolog>
    <metadata>
      <data name="Category" value="Impala"/>
      <data name="Category" value="SQL"/>
      <data name="Category" value="DDL"/>
      <data name="Category" value="Tables"/>
      <data name="Category" value="Hive"/>
      <data name="Category" value="Metastore"/>
      <data name="Category" value="ETL"/>
      <data name="Category" value="Ingest"/>
      <data name="Category" value="Developers"/>
      <data name="Category" value="Data Analysts"/>
    </metadata>
  </prolog>

  <conbody>

    <p>
      The <codeph>REFRESH</codeph> statement reloads the metadata for the table from the
      metastore database and does an incremental reload of the file and block metadata from the
      HDFS NameNode. <codeph>REFRESH</codeph> is used to avoid inconsistencies between Impala
      and external metadata sources, namely Hive Metastore (HMS) and NameNodes.
    </p>

    <p> The <codeph>REFRESH</codeph> statement is only required if you load data
      from outside of Impala. Updated metadata, as a result of running
        <codeph>REFRESH</codeph>, is broadcast to all Impala coordinators. </p>

    <p>
      See <xref href="impala_hadoop.xml#intro_metastore"/> for the information about the way
      Impala uses metadata and how it shares the same metastore database as Hive.
    </p>

    <p>
      Once issued, the <codeph>REFRESH</codeph> statement cannot be cancelled.
    </p>

    <p conref="../shared/impala_common.xml#common/syntax_blurb"/>

<codeblock rev="IMPALA-1683">REFRESH [<varname>db_name</varname>.]<varname>table_name</varname> [PARTITION (<varname>key_col1</varname>=<varname>val1</varname> [, <varname>key_col2</varname>=<varname>val2</varname>...])]</codeblock>

    <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>

    <p>
      The table name is a required parameter, and the table must already exist and be known to
      Impala.
    </p>

    <p>
      Only the metadata for the specified table is reloaded.
    </p>

    <p>
      Use the <codeph>REFRESH</codeph> statement to load the latest metastore metadata for a
      particular table after one of the following scenarios happens outside of Impala:
    </p>

    <ul>
      <li>
        Deleting or adding files.
        <p>
          For example, after loading new data files into the HDFS data directory for the table,
          including inserting data from Hive via <codeph>INSERT</codeph> or <codeph>LOAD
          DATA</codeph>.
        </p>
      </li>

      <li>
        Deleting, adding, or modifying partitions.
        <p>
          For example, after issuing <codeph>ALTER TABLE</codeph> or other table-modifying SQL
          statement in Hive
        </p><commit_msg>[DOCS] Added another scenario when REFRESH is required<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="refresh">

  <title>REFRESH Statement</title>

  <titlealts audience="PDF">

    <navtitle>REFRESH</navtitle>

  </titlealts>

  <prolog>
    <metadata>
      <data name="Category" value="Impala"/>
      <data name="Category" value="SQL"/>
      <data name="Category" value="DDL"/>
      <data name="Category" value="Tables"/>
      <data name="Category" value="Hive"/>
      <data name="Category" value="Metastore"/>
      <data name="Category" value="ETL"/>
      <data name="Category" value="Ingest"/>
      <data name="Category" value="Developers"/>
      <data name="Category" value="Data Analysts"/>
    </metadata>
  </prolog>

  <conbody>

    <p>
      The <codeph>REFRESH</codeph> statement reloads the metadata for the table from the
      metastore database and does an incremental reload of the file and block metadata from the
      HDFS NameNode. <codeph>REFRESH</codeph> is used to avoid inconsistencies between Impala
      and external metadata sources, namely Hive Metastore (HMS) and NameNodes.
    </p>

    <p> The <codeph>REFRESH</codeph> statement is only required if you load data
      from outside of Impala. Updated metadata, as a result of running
        <codeph>REFRESH</codeph>, is broadcast to all Impala coordinators. </p>

    <p>
      See <xref href="impala_hadoop.xml#intro_metastore"/> for the information about the way
      Impala uses metadata and how it shares the same metastore database as Hive.
    </p>

    <p>
      Once issued, the <codeph>REFRESH</codeph> statement cannot be cancelled.
    </p>

    <p conref="../shared/impala_common.xml#common/syntax_blurb"/>

<codeblock rev="IMPALA-1683">REFRESH [<varname>db_name</varname>.]<varname>table_name</varname> [PARTITION (<varname>key_col1</varname>=<varname>val1</varname> [, <varname>key_col2</varname>=<varname>val2</varname>...])]</codeblock>

    <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>

    <p>
      The table name is a required parameter, and the table must already exist and be known to
      Impala.
    </p>

    <p>
      Only the metadata for the specified table is reloaded.
    </p>

    <p>
      Use the <codeph>REFRESH</codeph> statement to load the latest metastore metadata for a
      particular table after one of the following scenarios happens outside of Impala:
    </p>

    <ul>
      <li> Deleting, adding, or modifying files. <p> For example, after loading
          new data files into the HDFS data directory for the table, appending
          to an existing HDFS file, inserting data from Hive via
            <codeph>INSERT</codeph> or <codeph>LOAD DATA</codeph>. </p>
      </li>

      <li>
        Deleting, adding, or modifying partitions.
        <p>
          For example, after issuing <codeph>ALTER TABLE</codeph> or other table-modifying SQL
          statement in Hive
        </p>
{'fraction_non_alphanumeric': 0.10699642904377728, 'fraction_numerical': 0.0039677291363576245, 'mean_word_length': 3.3162100456621006, 'pattern_counts': {'":': 0, '<': 167, '<?xml version=': 2, '>': 167, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3077988', 'n_tokens_mistral': 2281, 'n_tokens_neox': 2167, 'n_words': 814}