如何从视图中检查配置单元中是否定义了变量?
how to check if a variable is defined in hive from within the view?
我想设置一个 <check if='...'>
,其中 if 语句是在正在定义的参数上定义的。有没有办法直接使用视图访问它?
您可以在 if 条件下使用变量,它有效:
<check if="@doesnotexist">
<true>The variable exists (?!)</true>
<false>The variable does not exist</false>
</check>
这是可能的,因为当您尝试从 F3 Hive, it returns NULL
when the key does not exist. Per documentation, NULL
is considered false
中检索值以进行此验证时:
An F3 expression inside an if attribute that equates to NULL, an empty string, a boolean FALSE, an empty array or zero, automatically invokes <false>
我想设置一个 <check if='...'>
,其中 if 语句是在正在定义的参数上定义的。有没有办法直接使用视图访问它?
您可以在 if 条件下使用变量,它有效:
<check if="@doesnotexist">
<true>The variable exists (?!)</true>
<false>The variable does not exist</false>
</check>
这是可能的,因为当您尝试从 F3 Hive, it returns NULL
when the key does not exist. Per documentation, NULL
is considered false
中检索值以进行此验证时:
An F3 expression inside an if attribute that equates to NULL, an empty string, a boolean FALSE, an empty array or zero, automatically invokes
<false>