Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change 
notification.

The "Hive/Tutorial" page has been changed by Ning Zhang.
http://wiki.apache.org/hadoop/Hive/Tutorial?action=diff&rev1=32&rev2=33

--------------------------------------------------

    * When there are already non-empty partitions exists for the dynamic 
partition columns, (e.g., country='CA' exists under some ds root partition), it 
will be overwritten if the dynamic partition insert saw the same value (say 
'CA') in the input data. This is in line with the 'insert overwrite' semantics. 
However, if the partition value 'CA' does not appear in the input data, the 
existing partition will not be overwritten. 
    * Since a Hive partition corresponds to a directory in HDFS, the partition 
value has to conform to the HDFS path format (URI in Java). Any character 
having a special meaning in URI (e.g., '%', ':', '/', '#') will be escaped with 
'%' followed by 2 bytes of its ASCII value.  
    * If the input column is a type different than STRING, its value will be 
first converted to STRING to be used to construct the HDFS path. 
-   * If the input column value is NULL or empty string, the row will be put 
into a special partition, whose name is controlled by the hive parameter 
hive.exec.default.dynamic.partition.name. The default value is 
__HIVE_DEFAULT_PARTITION__. Basically this partition will contain all "bad" 
rows whose value are not valid partition names. The caveat of this approach is 
that the bad value will be lost and is replaced by __HIVE_DEFAULT_PARTITION__ 
if you select them Hive. JIRA HIVE-1309 is a solution to let user specify "bad 
file" to retain the input partition column values as well.
+   * If the input column value is NULL or empty string, the row will be put 
into a special partition, whose name is controlled by the hive parameter 
hive.exec.default.dynamic.partition.name. The default value is 
`__HIVE_DEFAULT_PARTITION__`. Basically this partition will contain all "bad" 
rows whose value are not valid partition names. The caveat of this approach is 
that the bad value will be lost and is replaced by `__HIVE_DEFAULT_PARTITION__` 
if you select them Hive. JIRA HIVE-1309 is a solution to let user specify "bad 
file" to retain the input partition column values as well.
-   * Dynamic partition insert could potentially resource hog in that it could 
generate a large number of partitions in a short time. To get yourself buckled, 
we define two parameters hive.exec.max.dynamic.partitions (default value being 
1000) which is the total number of dynamic partitions could be created by one 
DML and hive.exec.max.dynamic.partitions.pernode (default value being 100) 
which is the maximum dynamic partitions that can be created for each mapper or 
reducer. If one mapper or reducer created more than that the threshold, a fatal 
error will be raised from the mapper/reducer (through counter) and the whole 
job will be killed. If each mapper/reducer did not exceed the limit but the 
total number of dynamic partitions does, then an exception is raised at the end 
of the job before the intermediate data are moved to the final destination. 
+   * Dynamic partition insert could potentially resource hog in that it could 
generate a large number of partitions in a short time. To get yourself buckled, 
we define three parameters:
+     * '''hive.exec.max.dynamic.partitions.pernode''' (default value being 
100) is the maximum dynamic partitions that can be created by each mapper or 
reducer. If one mapper or reducer created more than that the threshold, a fatal 
error will be raised from the mapper/reducer (through counter) and the whole 
job will be killed. 
+     * '''hive.exec.max.dynamic.partitions''' (default value being 1000) is 
the total number of dynamic partitions could be created by one DML. If each 
mapper/reducer did not exceed the limit but the total number of dynamic 
partitions does, then an exception is raised at the end of the job before the 
intermediate data are moved to the final destination.
+     * '''hive.max.created.files''' (default value being 100000) is the 
maximum total number of files created by all mappers and reducers. This is 
implemented by updating a Hadoop counter by each mapper/reducer whenever a new 
file is created. If the total number is exceeding hive.max.created.files, a 
fatal error will be thrown and the job will be killed. 
+  
    * Another situation we want to protect against dynamic partition insert is 
that the user may accidentally specify all partitions to be dynamic partitions 
without specifying one static partition, while the original intention is to 
just overwrite the sub-partitions of one root partition. We define another 
parameter hive.exec.dynamic.partition.mode=strict to prevent the all-dynamic 
partition case. In the strict mode, you have to specify at least one static 
partition. The default mode is strict. In addition, we have a parameter 
hive.exec.dynamic.partition=true/false to control whether to allow dynamic 
partition at all. The default value is false. 
-   * Currently dynamic partition insert will not work with 
hive.merge.mapfiles=true or hive.merge.mapredfiles=true, so it internally turns 
off the merge parameters. The reason is that if either of the merge parameters 
is set to true, there will be a map reduce job for that particular partition to 
merge all files into one. In dynamic partition insert, we do not know the 
number of partitions at compile time thus no MapReduce job could be generated. 
There is a new JIRA HIVE-1307 filed for this task. 
+   * In Hive 0.6, dynamic partition insert does not work with 
hive.merge.mapfiles=true or hive.merge.mapredfiles=true, so it internally turns 
off the merge parameters. Merging files in dynamic partition inserts are 
supported in Hive 0.7 (see JIRA HIVE-1307 for details). 
  
  Troubleshooting and best practices:
    * As stated above, there are too many dynamic partitions created by a 
particular mapper/reducer, a fatal error could be raised and the job will be 
killed. The error message looks something like: {{{

Reply via email to