<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                **1. 動態分區特點** * 往分區表裝載數據時,只需要指定分區字段即可; * 只支持`insert` 一種插入數據方式; **2. 創建動態分區表的前提** 開啟動態分區:低于hive2.3.4版本的默認關閉,hive2.3.4版本之后默認開啟。 嚴格模式:嚴格模式必須至少指定一個靜態分區列,這是為了避免意外覆蓋分區,非嚴格模式則不必指定靜態分區。 (1)在當前會話開啟動態分區和設置非嚴格模式 ```sql # true為開啟動態分區,false為關閉 0: jdbc:hive2://hadoop101:10000> SET hive.exec.dynamic.partition=true; # nonstrict為非嚴格模式,strict為嚴格模式 0: jdbc:hive2://hadoop101:10000> SET hive.exec.dynamic.partition.mode=nonstrict; ``` 或者在 {hive_home}/conf/hive-site.xml中配置 ```xml <property> <name>hive.exec.dynamic.partition</name> <value>true</value> <description>Whether or not to allow dynamic partitions in DML/DDL.</description> </property> <property> <name>hive.exec.dynamic.partition.mode</name> <value>nonstrict</value> <description> In strict mode, the user must specify at least one static partition in case the user accidentally overwrites all partitions. In nonstrict mode all partitions are allowed to be dynamic. </description> </property> ``` <br/> **3. 示例:將people內部表的數據復制到 dynamic_people 動態分區表中** (1) 準備數據`people.txt` ```xml 001,tom,23,2019-03-16 002,jack,12,2019-03-13 003,robin,14,2018-08-13 004,justin,34,2018-10-12 005,jarry,24,2017-11-11 006,jasper,24,2017-12-12 ``` (2) 創建people內部表和dynamic_people分區表 ```sql create table if not exists people( people_id int, people_name string, people_age int, people_start_date date ) row format delimited fields terminated by "," ; create table if not exists dynamic_people( dypeople_id int, dypeople_name string, dypeople_age int, dypeople_start_date date ) -- year、month字段名必須是建表字段中沒有的字段 partitioned by(year string, month string) row format delimited fields terminated by "," ; ``` (3) 向people內部表插入數據,然后再向dynamic_people分區表動態插入數據 ```sql load data local inpath "/hdatas/people.txt" into table people; 0: jdbc:hive2://hadoop101:10000> select * from people; +-------------------+---------------------+--------------------+---------------------------+--+ | people.people_id | people.people_name | people.people_age | people.people_start_date | +-------------------+---------------------+--------------------+---------------------------+--+ | 1 | tom | 23 | 2019-03-16 | | 2 | jack | 12 | 2019-03-13 | | 3 | robin | 14 | 2018-08-13 | | 4 | justin | 34 | 2018-10-12 | | 5 | jarry | 24 | 2017-11-11 | | 6 | jasper | 24 | 2017-12-12 | +-------------------+---------------------+--------------------+---------------------------+--+ #### 往分區表中插入數據 #### insert into table dynamic_people partition(year, month) select people_id as dypeople_id, people_name as dypeople_name, people_age as dypople_age, people_start_date as dypeople_start_date, year(people_start_date) as year, month(people_start_date) as month from people; ``` 在hdfs中存儲路徑如下,使用的數據庫為hivebook: ```xml /hivebook.db/dynamic_people/year=2017/month=11/000000_0 /hivebook.db/dynamic_people/year=2017/month=12/000000_0 /hivebook.db/dynamic_people/year=2018/month=8/000000_0 /hivebook.db/dynamic_people/year=2018/month=10/000000_0 /hivebook.db/dynamic_people/year=2019/month=3/000000_0 ``` ```sql 0: jdbc:hive2://hadoop101:10000> select * from dynamic_people where year="2019" and month="3"; +-----------------------------+-------------------------------+------------------------------+-------------------------------------+----------------------+-----------------------+--+ | dynamic_people.dypeople_id | dynamic_people.dypeople_name | dynamic_people.dypeople_age | dynamic_people.dypeople_start_date | dynamic_people.year | dynamic_people.month | +-----------------------------+-------------------------------+------------------------------+-------------------------------------+----------------------+-----------------------+--+ | 1 | tom | 23 | 2019-03-16 | 2019 | 3 | | 2 | jack | 12 | 2019-03-13 | 2019 | 3 | +-----------------------------+-------------------------------+------------------------------+-------------------------------------+--- ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看