http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3be0f122/docs/topics/impala_drop_function.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_drop_function.xml b/docs/topics/impala_drop_function.xml new file mode 100644 index 0000000..dfad51b --- /dev/null +++ b/docs/topics/impala_drop_function.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> +<concept rev="1.2" id="drop_function"> + + <title>DROP FUNCTION Statement</title> + <titlealts audience="PDF"><navtitle>DROP FUNCTION</navtitle></titlealts> + <prolog> + <metadata> + <data name="Category" value="Impala"/> + <data name="Category" value="SQL"/> + <data name="Category" value="DDL"/> + <data name="Category" value="Impala Functions"/> + <data name="Category" value="UDFs"/> + <data name="Category" value="Schemas"/> + <data name="Category" value="Developers"/> + <data name="Category" value="Data Analysts"/> + </metadata> + </prolog> + + <conbody> + + <p> + <indexterm audience="Cloudera">DROP FUNCTION statement</indexterm> + Removes a user-defined function (UDF), so that it is not available for execution during Impala + <codeph>SELECT</codeph> or <codeph>INSERT</codeph> operations. + </p> + + <p conref="../shared/impala_common.xml#common/syntax_blurb"/> + + <p> + To drop C++ UDFs and UDAs: + </p> + +<codeblock>DROP [AGGREGATE] FUNCTION [IF EXISTS] [<varname>db_name</varname>.]<varname>function_name</varname>(<varname>type</varname>[, <varname>type</varname>...])</codeblock> + + <note rev="2.5.0 IMPALA-2843 CDH-39148"> + <p rev="2.5.0 IMPALA-2843 CDH-39148"> + The preceding syntax, which includes the function signature, also applies to Java UDFs that were created + using the corresponding <codeph>CREATE FUNCTION</codeph> syntax that includes the argument and return types. + After upgrading to <keyword keyref="impala25_full"/> or higher, consider re-creating all Java UDFs with the + <codeph>CREATE FUNCTION</codeph> syntax that does not include the function signature. Java UDFs created this + way are now persisted in the metastore database and do not need to be re-created after an Impala restart. + </p> + </note> + + <p rev="2.5.0 IMPALA-2843 CDH-39148"> + To drop Java UDFs (created using the <codeph>CREATE FUNCTION</codeph> syntax with no function signature): + </p> + +<codeblock rev="2.5.0">DROP FUNCTION [IF EXISTS] [<varname>db_name</varname>.]<varname>function_name</varname></codeblock> + +<!-- +Examples: +CREATE FUNCTION IF NOT EXISTS foo location '/path/to/jar' SYMBOL='TestUdf'; +CREATE FUNCTION bar location '/path/to/jar' SYMBOL='TestUdf2'; +DROP FUNCTION foo; +DROP FUNCTION IF EXISTS bar; +--> + + <p conref="../shared/impala_common.xml#common/ddl_blurb"/> + + <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/> + + <p> + Because the same function name could be overloaded with different argument signatures, you specify the + argument types to identify the exact function to drop. + </p> + + <p conref="../shared/impala_common.xml#common/restrictions_blurb"/> + + <p conref="../shared/impala_common.xml#common/udf_persistence_restriction"/> + + <p conref="../shared/impala_common.xml#common/cancel_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/permissions_blurb"/> + <p rev="CDH-19187"> + The user ID that the <cmdname>impalad</cmdname> daemon runs under, + typically the <codeph>impala</codeph> user, does not need any + particular HDFS permissions to perform this statement. + All read and write operations are on the metastore database, + not HDFS files and directories. + </p> + + <p conref="../shared/impala_common.xml#common/example_blurb"/> + <p rev="2.5.0 IMPALA-2843 CDH-39148"> + The following example shows how to drop Java functions created with the signatureless + <codeph>CREATE FUNCTION</codeph> syntax in <keyword keyref="impala25_full"/> and higher. + Issuing <codeph>DROP FUNCTION <varname>function_name</varname></codeph> removes all the + overloaded functions under that name. + (See <xref href="impala_create_function.xml#create_function"/> for a longer example + showing how to set up such functions in the first place.) + </p> +<codeblock rev="2.5.0 IMPALA-2843 CDH-39148"> +create function my_func location '/user/impala/udfs/udf-examples-cdh570.jar' + symbol='com.cloudera.impala.TestUdf'; + +show functions; ++-------------+---------------------------------------+-------------+---------------+ +| return type | signature | binary type | is persistent | ++-------------+---------------------------------------+-------------+---------------+ +| BIGINT | my_func(BIGINT) | JAVA | true | +| BOOLEAN | my_func(BOOLEAN) | JAVA | true | +| BOOLEAN | my_func(BOOLEAN, BOOLEAN) | JAVA | true | +... +| BIGINT | testudf(BIGINT) | JAVA | true | +| BOOLEAN | testudf(BOOLEAN) | JAVA | true | +| BOOLEAN | testudf(BOOLEAN, BOOLEAN) | JAVA | true | +... + +drop function my_func; +show functions; ++-------------+---------------------------------------+-------------+---------------+ +| return type | signature | binary type | is persistent | ++-------------+---------------------------------------+-------------+---------------+ +| BIGINT | testudf(BIGINT) | JAVA | true | +| BOOLEAN | testudf(BOOLEAN) | JAVA | true | +| BOOLEAN | testudf(BOOLEAN, BOOLEAN) | JAVA | true | +... +</codeblock> + + <p conref="../shared/impala_common.xml#common/related_info"/> + + <p> + <xref href="impala_udf.xml#udfs"/>, <xref href="impala_create_function.xml#create_function"/> + </p> + </conbody> +</concept>
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3be0f122/docs/topics/impala_drop_role.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_drop_role.xml b/docs/topics/impala_drop_role.xml new file mode 100644 index 0000000..7383b46 --- /dev/null +++ b/docs/topics/impala_drop_role.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> +<concept rev="1.4.0" id="drop_role"> + + <title>DROP ROLE Statement (<keyword keyref="impala20"/> or higher only)</title> + <titlealts audience="PDF"><navtitle>DROP ROLE</navtitle></titlealts> + <prolog> + <metadata> + <data name="Category" value="Impala"/> + <data name="Category" value="DDL"/> + <data name="Category" value="SQL"/> + <data name="Category" value="Sentry"/> + <data name="Category" value="Security"/> + <data name="Category" value="Roles"/> + <data name="Category" value="Administrators"/> + <data name="Category" value="Developers"/> + <data name="Category" value="Data Analysts"/> + <!-- Consider whether to go deeper into categories like Security for the Sentry-related statements. --> + </metadata> + </prolog> + + <conbody> + + <p> + <indexterm audience="Cloudera">DROP ROLE statement</indexterm> +<!-- Copied from Sentry docs. Turn into conref. I did some rewording for clarity. --> + The <codeph>DROP ROLE</codeph> statement removes a role from the metastore database. Once dropped, the role + is revoked for all users to whom it was previously assigned, and all privileges granted to that role are + revoked. Queries that are already executing are not affected. Impala verifies the role information + approximately every 60 seconds, so the effects of <codeph>DROP ROLE</codeph> might not take effect for new + Impala queries for a brief period. + </p> + + <p conref="../shared/impala_common.xml#common/syntax_blurb"/> + +<codeblock>DROP ROLE <varname>role_name</varname> +</codeblock> + + <p conref="../shared/impala_common.xml#common/privileges_blurb"/> + + <p> + Only administrative users (initially, a predefined set of users specified in the Sentry service configuration + file) can use this statement. + </p> + + <p conref="../shared/impala_common.xml#common/compatibility_blurb"/> + + <p> + Impala makes use of any roles and privileges specified by the <codeph>GRANT</codeph> and + <codeph>REVOKE</codeph> statements in Hive, and Hive makes use of any roles and privileges specified by the + <codeph>GRANT</codeph> and <codeph>REVOKE</codeph> statements in Impala. The Impala <codeph>GRANT</codeph> + and <codeph>REVOKE</codeph> statements for privileges do not require the <codeph>ROLE</codeph> keyword to be + repeated before each role name, unlike the equivalent Hive statements. + </p> + + <p conref="../shared/impala_common.xml#common/related_info"/> + + <p> + <xref href="impala_authorization.xml#authorization"/>, <xref href="impala_grant.xml#grant"/> + <xref href="impala_revoke.xml#revoke"/>, <xref href="impala_create_role.xml#create_role"/>, + <xref href="impala_show.xml#show"/> + </p> + +<!-- To do: nail down the new SHOW syntax, e.g. SHOW ROLES, SHOW CURRENT ROLES, SHOW GROUPS. --> + + <p conref="../shared/impala_common.xml#common/cancel_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/permissions_blurb_no"/> + + </conbody> +</concept> http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3be0f122/docs/topics/impala_drop_stats.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_drop_stats.xml b/docs/topics/impala_drop_stats.xml new file mode 100644 index 0000000..df82d6b --- /dev/null +++ b/docs/topics/impala_drop_stats.xml @@ -0,0 +1,279 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> +<concept rev="2.1.0" id="drop_stats"> + + <title>DROP STATS Statement</title> + <titlealts audience="PDF"><navtitle>DROP STATS</navtitle></titlealts> + <prolog> + <metadata> + <data name="Category" value="Impala"/> + <data name="Category" value="SQL"/> + <data name="Category" value="DDL"/> + <data name="Category" value="ETL"/> + <data name="Category" value="Ingest"/> + <data name="Category" value="Tables"/> + <data name="Category" value="Performance"/> + <data name="Category" value="Scalability"/> + <data name="Category" value="Developers"/> + <data name="Category" value="Data Analysts"/> + </metadata> + </prolog> + + <conbody> + + <p rev="2.1.0"> + <indexterm audience="Cloudera">DROP STATS statement</indexterm> + Removes the specified statistics from a table or partition. The statistics were originally created by the + <codeph>COMPUTE STATS</codeph> or <codeph>COMPUTE INCREMENTAL STATS</codeph> statement. + </p> + + <p conref="../shared/impala_common.xml#common/syntax_blurb"/> + +<codeblock rev="2.1.0">DROP STATS [<varname>database_name</varname>.]<varname>table_name</varname> +DROP INCREMENTAL STATS [<varname>database_name</varname>.]<varname>table_name</varname> PARTITION (<varname>partition_spec</varname>) + +<varname>partition_spec</varname> ::= <varname>partition_col</varname>=<varname>constant_value</varname> +</codeblock> + + <p conref="../shared/impala_common.xml#common/incremental_partition_spec"/> + + <p> + <codeph>DROP STATS</codeph> removes all statistics from the table, whether created by <codeph>COMPUTE + STATS</codeph> or <codeph>COMPUTE INCREMENTAL STATS</codeph>. + </p> + + <p rev="2.1.0"> + <codeph>DROP INCREMENTAL STATS</codeph> only affects incremental statistics for a single partition, specified + through the <codeph>PARTITION</codeph> clause. The incremental stats are marked as outdated, so that they are + recomputed by the next <codeph>COMPUTE INCREMENTAL STATS</codeph> statement. + </p> + +<!-- To do: what release was this added in? --> + + <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/> + + <p> + You typically use this statement when the statistics for a table or a partition have become stale due to data + files being added to or removed from the associated HDFS data directories, whether by manual HDFS operations + or <codeph>INSERT</codeph>, <codeph>INSERT OVERWRITE</codeph>, or <codeph>LOAD DATA</codeph> statements, or + adding or dropping partitions. + </p> + + <p> + When a table or partition has no associated statistics, Impala treats it as essentially zero-sized when + constructing the execution plan for a query. In particular, the statistics influence the order in which + tables are joined in a join query. To ensure proper query planning and good query performance and + scalability, make sure to run <codeph>COMPUTE STATS</codeph> or <codeph>COMPUTE INCREMENTAL STATS</codeph> on + the table or partition after removing any stale statistics. + </p> + + <p> + Dropping the statistics is not required for an unpartitioned table or a partitioned table covered by the + original type of statistics. A subsequent <codeph>COMPUTE STATS</codeph> statement replaces any existing + statistics with new ones, for all partitions, regardless of whether the old ones were outdated. Therefore, + this statement was rarely used before the introduction of incremental statistics. + </p> + + <p> + Dropping the statistics is required for a partitioned table containing incremental statistics, to make a + subsequent <codeph>COMPUTE INCREMENTAL STATS</codeph> statement rescan an existing partition. See + <xref href="impala_perf_stats.xml#perf_stats"/> for information about incremental statistics, a new feature + available in Impala 2.1.0 and higher. + </p> + + <p conref="../shared/impala_common.xml#common/ddl_blurb"/> + + <p conref="../shared/impala_common.xml#common/cancel_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/permissions_blurb"/> + <p rev="CDH-19187"> + The user ID that the <cmdname>impalad</cmdname> daemon runs under, + typically the <codeph>impala</codeph> user, does not need any + particular HDFS permissions to perform this statement. + All read and write operations are on the metastore database, + not HDFS files and directories. + </p> + + <p conref="../shared/impala_common.xml#common/example_blurb"/> + + <p> + The following example shows a partitioned table that has associated statistics produced by the + <codeph>COMPUTE INCREMENTAL STATS</codeph> statement, and how the situation evolves as statistics are dropped + from specific partitions, then the entire table. + </p> + + <p> + Initially, all table and column statistics are filled in. + </p> + +<!-- Note: chopped off any excess characters at position 87 and after, + to avoid weird wrapping in PDF. + Applies to any subsequent examples with output from SHOW ... STATS too. --> + +<codeblock>show table stats item_partitioned; ++-------------+-------+--------+----------+--------------+---------+----------------- +| i_category | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats ++-------------+-------+--------+----------+--------------+---------+----------------- +| Books | 1733 | 1 | 223.74KB | NOT CACHED | PARQUET | true +| Children | 1786 | 1 | 230.05KB | NOT CACHED | PARQUET | true +| Electronics | 1812 | 1 | 232.67KB | NOT CACHED | PARQUET | true +| Home | 1807 | 1 | 232.56KB | NOT CACHED | PARQUET | true +| Jewelry | 1740 | 1 | 223.72KB | NOT CACHED | PARQUET | true +| Men | 1811 | 1 | 231.25KB | NOT CACHED | PARQUET | true +| Music | 1860 | 1 | 237.90KB | NOT CACHED | PARQUET | true +| Shoes | 1835 | 1 | 234.90KB | NOT CACHED | PARQUET | true +| Sports | 1783 | 1 | 227.97KB | NOT CACHED | PARQUET | true +| Women | 1790 | 1 | 226.27KB | NOT CACHED | PARQUET | true +| Total | 17957 | 10 | 2.25MB | 0B | | ++-------------+-------+--------+----------+--------------+---------+----------------- +show column stats item_partitioned; ++------------------+-----------+------------------+--------+----------+-------------- +| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size ++------------------+-----------+------------------+--------+----------+-------------- +| i_item_sk | INT | 19443 | -1 | 4 | 4 +| i_item_id | STRING | 9025 | -1 | 16 | 16 +| i_rec_start_date | TIMESTAMP | 4 | -1 | 16 | 16 +| i_rec_end_date | TIMESTAMP | 3 | -1 | 16 | 16 +| i_item_desc | STRING | 13330 | -1 | 200 | 100.302803039 +| i_current_price | FLOAT | 2807 | -1 | 4 | 4 +| i_wholesale_cost | FLOAT | 2105 | -1 | 4 | 4 +| i_brand_id | INT | 965 | -1 | 4 | 4 +| i_brand | STRING | 725 | -1 | 22 | 16.1776008605 +| i_class_id | INT | 16 | -1 | 4 | 4 +| i_class | STRING | 101 | -1 | 15 | 7.76749992370 +| i_category_id | INT | 10 | -1 | 4 | 4 +| i_manufact_id | INT | 1857 | -1 | 4 | 4 +| i_manufact | STRING | 1028 | -1 | 15 | 11.3295001983 +| i_size | STRING | 8 | -1 | 11 | 4.33459997177 +| i_formulation | STRING | 12884 | -1 | 20 | 19.9799995422 +| i_color | STRING | 92 | -1 | 10 | 5.38089990615 +| i_units | STRING | 22 | -1 | 7 | 4.18690013885 +| i_container | STRING | 2 | -1 | 7 | 6.99259996414 +| i_manager_id | INT | 105 | -1 | 4 | 4 +| i_product_name | STRING | 19094 | -1 | 25 | 18.0233001708 +| i_category | STRING | 10 | 0 | -1 | -1 ++------------------+-----------+------------------+--------+----------+-------------- +</codeblock> + + <p> + To remove statistics for particular partitions, use the <codeph>DROP INCREMENTAL STATS</codeph> statement. + After removing statistics for two partitions, the table-level statistics reflect that change in the + <codeph>#Rows</codeph> and <codeph>Incremental stats</codeph> fields. The counts, maximums, and averages of + the column-level statistics are unaffected. + </p> + + <note> + (It is possible that the row count might be preserved in future after a <codeph>DROP INCREMENTAL + STATS</codeph> statement. Check the resolution of the issue + <xref href="https://issues.cloudera.org/browse/IMPALA-1615" scope="external" format="html">IMPALA-1615</xref>.) + </note> + +<codeblock>drop incremental stats item_partitioned partition (i_category='Sports'); +drop incremental stats item_partitioned partition (i_category='Electronics'); + +show table stats item_partitioned ++-------------+-------+--------+----------+--------------+---------+------------------ +| i_category | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats ++-------------+-------+--------+----------+--------------+---------+----------------- +| Books | 1733 | 1 | 223.74KB | NOT CACHED | PARQUET | true +| Children | 1786 | 1 | 230.05KB | NOT CACHED | PARQUET | true +| Electronics | -1 | 1 | 232.67KB | NOT CACHED | PARQUET | false +| Home | 1807 | 1 | 232.56KB | NOT CACHED | PARQUET | true +| Jewelry | 1740 | 1 | 223.72KB | NOT CACHED | PARQUET | true +| Men | 1811 | 1 | 231.25KB | NOT CACHED | PARQUET | true +| Music | 1860 | 1 | 237.90KB | NOT CACHED | PARQUET | true +| Shoes | 1835 | 1 | 234.90KB | NOT CACHED | PARQUET | true +| Sports | -1 | 1 | 227.97KB | NOT CACHED | PARQUET | false +| Women | 1790 | 1 | 226.27KB | NOT CACHED | PARQUET | true +| Total | 17957 | 10 | 2.25MB | 0B | | ++-------------+-------+--------+----------+--------------+---------+----------------- +show column stats item_partitioned ++------------------+-----------+------------------+--------+----------+-------------- +| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size ++------------------+-----------+------------------+--------+----------+-------------- +| i_item_sk | INT | 19443 | -1 | 4 | 4 +| i_item_id | STRING | 9025 | -1 | 16 | 16 +| i_rec_start_date | TIMESTAMP | 4 | -1 | 16 | 16 +| i_rec_end_date | TIMESTAMP | 3 | -1 | 16 | 16 +| i_item_desc | STRING | 13330 | -1 | 200 | 100.302803039 +| i_current_price | FLOAT | 2807 | -1 | 4 | 4 +| i_wholesale_cost | FLOAT | 2105 | -1 | 4 | 4 +| i_brand_id | INT | 965 | -1 | 4 | 4 +| i_brand | STRING | 725 | -1 | 22 | 16.1776008605 +| i_class_id | INT | 16 | -1 | 4 | 4 +| i_class | STRING | 101 | -1 | 15 | 7.76749992370 +| i_category_id | INT | 10 | -1 | 4 | 4 +| i_manufact_id | INT | 1857 | -1 | 4 | 4 +| i_manufact | STRING | 1028 | -1 | 15 | 11.3295001983 +| i_size | STRING | 8 | -1 | 11 | 4.33459997177 +| i_formulation | STRING | 12884 | -1 | 20 | 19.9799995422 +| i_color | STRING | 92 | -1 | 10 | 5.38089990615 +| i_units | STRING | 22 | -1 | 7 | 4.18690013885 +| i_container | STRING | 2 | -1 | 7 | 6.99259996414 +| i_manager_id | INT | 105 | -1 | 4 | 4 +| i_product_name | STRING | 19094 | -1 | 25 | 18.0233001708 +| i_category | STRING | 10 | 0 | -1 | -1 ++------------------+-----------+------------------+--------+----------+-------------- +</codeblock> + + <p> + To remove all statistics from the table, whether produced by <codeph>COMPUTE STATS</codeph> or + <codeph>COMPUTE INCREMENTAL STATS</codeph>, use the <codeph>DROP STATS</codeph> statement without the + <codeph>INCREMENTAL</codeph> clause). Now, both table-level and column-level statistics are reset. + </p> + +<codeblock>drop stats item_partitioned; + +show table stats item_partitioned ++-------------+-------+--------+----------+--------------+---------+------------------ +| i_category | #Rows | #Files | Size | Bytes Cached | Format | Incremental stats ++-------------+-------+--------+----------+--------------+---------+------------------ +| Books | -1 | 1 | 223.74KB | NOT CACHED | PARQUET | false +| Children | -1 | 1 | 230.05KB | NOT CACHED | PARQUET | false +| Electronics | -1 | 1 | 232.67KB | NOT CACHED | PARQUET | false +| Home | -1 | 1 | 232.56KB | NOT CACHED | PARQUET | false +| Jewelry | -1 | 1 | 223.72KB | NOT CACHED | PARQUET | false +| Men | -1 | 1 | 231.25KB | NOT CACHED | PARQUET | false +| Music | -1 | 1 | 237.90KB | NOT CACHED | PARQUET | false +| Shoes | -1 | 1 | 234.90KB | NOT CACHED | PARQUET | false +| Sports | -1 | 1 | 227.97KB | NOT CACHED | PARQUET | false +| Women | -1 | 1 | 226.27KB | NOT CACHED | PARQUET | false +| Total | -1 | 10 | 2.25MB | 0B | | ++-------------+-------+--------+----------+--------------+---------+------------------ +show column stats item_partitioned ++------------------+-----------+------------------+--------+----------+----------+ +| Column | Type | #Distinct Values | #Nulls | Max Size | Avg Size | ++------------------+-----------+------------------+--------+----------+----------+ +| i_item_sk | INT | -1 | -1 | 4 | 4 | +| i_item_id | STRING | -1 | -1 | -1 | -1 | +| i_rec_start_date | TIMESTAMP | -1 | -1 | 16 | 16 | +| i_rec_end_date | TIMESTAMP | -1 | -1 | 16 | 16 | +| i_item_desc | STRING | -1 | -1 | -1 | -1 | +| i_current_price | FLOAT | -1 | -1 | 4 | 4 | +| i_wholesale_cost | FLOAT | -1 | -1 | 4 | 4 | +| i_brand_id | INT | -1 | -1 | 4 | 4 | +| i_brand | STRING | -1 | -1 | -1 | -1 | +| i_class_id | INT | -1 | -1 | 4 | 4 | +| i_class | STRING | -1 | -1 | -1 | -1 | +| i_category_id | INT | -1 | -1 | 4 | 4 | +| i_manufact_id | INT | -1 | -1 | 4 | 4 | +| i_manufact | STRING | -1 | -1 | -1 | -1 | +| i_size | STRING | -1 | -1 | -1 | -1 | +| i_formulation | STRING | -1 | -1 | -1 | -1 | +| i_color | STRING | -1 | -1 | -1 | -1 | +| i_units | STRING | -1 | -1 | -1 | -1 | +| i_container | STRING | -1 | -1 | -1 | -1 | +| i_manager_id | INT | -1 | -1 | 4 | 4 | +| i_product_name | STRING | -1 | -1 | -1 | -1 | +| i_category | STRING | 10 | 0 | -1 | -1 | ++------------------+-----------+------------------+--------+----------+----------+ +</codeblock> + + <p conref="../shared/impala_common.xml#common/related_info"/> + + <p> + <xref href="impala_compute_stats.xml#compute_stats"/>, <xref href="impala_show.xml#show_table_stats"/>, + <xref href="impala_show.xml#show_column_stats"/>, <xref href="impala_perf_stats.xml#perf_stats"/> + </p> + </conbody> +</concept> http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3be0f122/docs/topics/impala_drop_table.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_drop_table.xml b/docs/topics/impala_drop_table.xml new file mode 100644 index 0000000..8a75158 --- /dev/null +++ b/docs/topics/impala_drop_table.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> +<concept id="drop_table"> + + <title>DROP TABLE Statement</title> + <titlealts audience="PDF"><navtitle>DROP TABLE</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="Schemas"/> + <data name="Category" value="S3"/> + <data name="Category" value="Developers"/> + <data name="Category" value="Data Analysts"/> + </metadata> + </prolog> + + <conbody> + + <p> + <indexterm audience="Cloudera">DROP TABLE statement</indexterm> + Removes an Impala table. Also removes the underlying HDFS data files for internal tables, although not for + external tables. + </p> + + <p conref="../shared/impala_common.xml#common/syntax_blurb"/> + +<codeblock>DROP TABLE [IF EXISTS] [<varname>db_name</varname>.]<varname>table_name</varname> <ph rev="2.3.0">[PURGE]</ph></codeblock> + + <p> + <b>IF EXISTS clause:</b> + </p> + + <p> + The optional <codeph>IF EXISTS</codeph> clause makes the statement succeed whether or not the table exists. + If the table does exist, it is dropped; if it does not exist, the statement has no effect. This capability is + useful in standardized setup scripts that remove existing schema objects and create new ones. By using some + combination of <codeph>IF EXISTS</codeph> for the <codeph>DROP</codeph> statements and <codeph>IF NOT + EXISTS</codeph> clauses for the <codeph>CREATE</codeph> statements, the script can run successfully the first + time you run it (when the objects do not exist yet) and subsequent times (when some or all of the objects do + already exist). + </p> + + <p rev="2.3.0"> + <b>PURGE clause:</b> + </p> + + <p rev="2.3.0"> The optional <codeph>PURGE</codeph> keyword, available in + <keyword keyref="impala23_full"/> and higher, causes Impala to remove the associated + HDFS data files immediately, rather than going through the HDFS trashcan + mechanism. Use this keyword when dropping a table if it is crucial to + remove the data as quickly as possible to free up space, or if there is a + problem with the trashcan, such as the trash cannot being configured or + being in a different HDFS encryption zone than the data files. </p> + + <p conref="../shared/impala_common.xml#common/ddl_blurb"/> + + <p conref="../shared/impala_common.xml#common/usage_notes_blurb"/> + + <p> + By default, Impala removes the associated HDFS directory and data files for the table. If you issue a + <codeph>DROP TABLE</codeph> and the data files are not deleted, it might be for the following reasons: + </p> + + <ul> + <li> + If the table was created with the + <codeph><xref href="impala_tables.xml#external_tables">EXTERNAL</xref></codeph> clause, Impala leaves all + files and directories untouched. Use external tables when the data is under the control of other Hadoop + components, and Impala is only used to query the data files from their original locations. + </li> + + <li> + Impala might leave the data files behind unintentionally, if there is no HDFS location available to hold + the HDFS trashcan for the <codeph>impala</codeph> user. See + <xref href="impala_prereqs.xml#prereqs_account"/> for the procedure to set up the required HDFS home + directory. + </li> + </ul> + + <p> + Make sure that you are in the correct database before dropping a table, either by issuing a + <codeph>USE</codeph> statement first or by using a fully qualified name + <codeph><varname>db_name</varname>.<varname>table_name</varname></codeph>. + </p> + + <p> + If you intend to issue a <codeph>DROP DATABASE</codeph> statement, first issue <codeph>DROP TABLE</codeph> + statements to remove all the tables in that database. + </p> + + <p conref="../shared/impala_common.xml#common/example_blurb"/> + +<codeblock>create database temporary; +use temporary; +create table unimportant (x int); +create table trivial (s string); +-- Drop a table in the current database. +drop table unimportant; +-- Switch to a different database. +use default; +-- To drop a table in a different database... +drop table trivial; +<i>ERROR: AnalysisException: Table does not exist: default.trivial</i> +-- ...use a fully qualified name. +drop table temporary.trivial;</codeblock> + + <p conref="../shared/impala_common.xml#common/disk_space_blurb"/> + + <p conref="../shared/impala_common.xml#common/s3_blurb"/> + <p rev="2.6.0 CDH-39913 IMPALA-1878"> + The <codeph>DROP TABLE</codeph> statement can remove data files from S3 + if the associated S3 table is an internal table. + In <keyword keyref="impala26_full"/> and higher, as part of improved support for writing + to S3, Impala also removes the associated folder when dropping an internal table + that resides on S3. + See <xref href="impala_s3.xml#s3"/> for details about working with S3 tables. + </p> + + <p conref="../shared/impala_common.xml#common/s3_drop_table_purge"/> + + <p conref="../shared/impala_common.xml#common/s3_ddl"/> + + <p conref="../shared/impala_common.xml#common/cancel_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/permissions_blurb"/> + <p rev="CDH-19187"> + For an internal table, the user ID that the <cmdname>impalad</cmdname> daemon runs under, + typically the <codeph>impala</codeph> user, must have write + permission for all the files and directories that make up the table. + </p> + <p> + For an external table, dropping the table only involves changes to metadata in the metastore database. + Because Impala does not remove any HDFS files or directories when external tables are dropped, + no particular permissions are needed for the associated HDFS files or directories. + </p> + + <p conref="../shared/impala_common.xml#common/related_info"/> + + <p> + <xref href="impala_tables.xml#tables"/>, + <xref href="impala_alter_table.xml#alter_table"/>, <xref href="impala_create_table.xml#create_table"/>, + <xref href="impala_partitioning.xml#partitioning"/>, <xref href="impala_tables.xml#internal_tables"/>, + <xref href="impala_tables.xml#external_tables"/> + </p> + + </conbody> +</concept> http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/3be0f122/docs/topics/impala_drop_view.xml ---------------------------------------------------------------------- diff --git a/docs/topics/impala_drop_view.xml b/docs/topics/impala_drop_view.xml new file mode 100644 index 0000000..627fd47 --- /dev/null +++ b/docs/topics/impala_drop_view.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> +<concept rev="1.1" id="drop_view"> + + <title>DROP VIEW Statement</title> + <titlealts audience="PDF"><navtitle>DROP VIEW</navtitle></titlealts> + <prolog> + <metadata> + <data name="Category" value="Impala"/> + <data name="Category" value="SQL"/> + <data name="Category" value="DDL"/> + <data name="Category" value="Schemas"/> + <data name="Category" value="Tables"/> + <data name="Category" value="Views"/> + </metadata> + </prolog> + + <conbody> + + <p> + <indexterm audience="Cloudera">DROP VIEW statement</indexterm> + Removes the specified view, which was originally created by the <codeph>CREATE VIEW</codeph> statement. + Because a view is purely a logical construct (an alias for a query) with no physical data behind it, + <codeph>DROP VIEW</codeph> only involves changes to metadata in the metastore database, not any data files in + HDFS. + </p> + + <p conref="../shared/impala_common.xml#common/syntax_blurb"/> + +<codeblock>DROP VIEW [IF EXISTS] [<varname>db_name</varname>.]<varname>view_name</varname></codeblock> + + <p conref="../shared/impala_common.xml#common/ddl_blurb"/> + + <p conref="../shared/impala_common.xml#common/cancel_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/permissions_blurb_no"/> + + <p conref="../shared/impala_common.xml#common/example_blurb"/> + + <p conref="../shared/impala_common.xml#common/create_drop_view_examples"/> + + <p conref="../shared/impala_common.xml#common/related_info"/> + + <p> + <xref href="impala_views.xml#views"/>, <xref href="impala_create_view.xml#create_view"/>, + <xref href="impala_alter_view.xml#alter_view"/> + </p> + </conbody> +</concept>
