1

当我尝试使用以下代码运行 oozie hive 操作时

<action name="Hive-Node">
    <hive xmlns="uri:oozie:hive-action:0.2">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <job-xml>hive-site.xml</job-xml>
        <prepare>
            <mkdir path="${nameNode}/hive/output"/>
        </prepare>
        <configuration>
            <property>
                <name>mapred.job.queue.name</name>
                <value>${queueName}</value>
            </property>
            <property>
                <name>hive.insert.into.multilevel.dirs</name>
                <value>true</value>
            </property>
            <property>
                <name>hbase.zookeeper.quorum</name>
                <value>${hbaseZooQuorum}</value>
            </property>
        </configuration>
        <script>${HIVE_QUERY_FILE}</script>
    </hive>
    <ok to="End" />
    <error to="Fail" />
</action>

我收到以下错误:

Error: E0701 : E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'prepare'. One of '{"uri:oozie:hive-action:0.2":configuration, "uri:oozie:hive-action:0.2":script}' is expected.

但是在我修改了在 hive 操作中声明标签的顺序<job-xml>...</job-xml>之后<prepare>...</prepare>,它工作正常。

是否有必要在 oozie 操作中遵循这些命令?

4

1 回答 1

5

来自Oozie Hive 行动文档

架构使用,

<xs:sequence>
    <xs:element name="job-tracker" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="name-node" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="prepare" type="hive:PREPARE" minOccurs="0" maxOccurs="1"/>
    <xs:element name="job-xml" type="xs:string" minOccurs="0" maxOccurs="1"/>
    <xs:element name="configuration" type="hive:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
    <xs:element name="script" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="file" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="archive" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>

根据 W3Schools的元素xs:sequence

序列元素指定子元素必须出现在序列中。每个子元素可以出现 0 到任意次数。

我们可以看到按照 Hive-Action 的模式<prepare>依次<job-xml>出现

于 2013-11-11T12:01:46.273 回答