doc-exports/docs/dli/sqlreference/dli_08_0101.html
Su, Xiaomeng 04d4597cf3 dli_sqlreference_0511_version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2023-11-02 14:34:08 +00:00

70 lines
5.5 KiB
HTML

<a name="dli_08_0101"></a><a name="dli_08_0101"></a>
<h1 class="topictitle1">Other Functions</h1>
<div id="body1574406512530"><div class="section" id="dli_08_0101__section893454311217"><h4 class="sectiontitle">Array Functions</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0101__t2a7d47f623e746809ce29da3d3282e25" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Array functions</caption><thead align="left"><tr id="dli_08_0101__rec5e1b7418ee4d21a15ea4b1dfe539be"><th align="left" class="cellrowborder" valign="top" width="24.310000000000002%" id="mcps1.3.1.2.2.4.1.1"><p id="dli_08_0101__a8eb7b99cbd7b453bb4d9a65ebb2e1cd3">Function</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.77%" id="mcps1.3.1.2.2.4.1.2"><p id="dli_08_0101__a89ac9077d7fa43ab9532d7f800bcf0de">Return Data Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.92%" id="mcps1.3.1.2.2.4.1.3"><p id="dli_08_0101__en-us_topic_0060575892_p163789443591">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0101__rd2d793d57f474c8ba1ec5c838db4aed8"><td class="cellrowborder" valign="top" width="24.310000000000002%" headers="mcps1.3.1.2.2.4.1.1 "><p id="dli_08_0101__a796431e302ff4155bf18ebf732d08f4d">CARDINALITY(ARRAY)</p>
</td>
<td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.1.2.2.4.1.2 "><p id="dli_08_0101__afd220772ce51417c956d7e550dba2c53">INT</p>
</td>
<td class="cellrowborder" valign="top" width="56.92%" headers="mcps1.3.1.2.2.4.1.3 "><p id="dli_08_0101__en-us_topic_0060575892_p374124717217">Return the element count of an array.</p>
</td>
</tr>
<tr id="dli_08_0101__r794cd630c1384a678383131823cc7e94"><td class="cellrowborder" valign="top" width="24.310000000000002%" headers="mcps1.3.1.2.2.4.1.1 "><p id="dli_08_0101__ac4302e80c6a24c3498d56447655f1592">ELEMENT(ARRAY)</p>
</td>
<td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.1.2.2.4.1.2 "><p id="dli_08_0101__a8811ddf27ca4485ab4e0d7acea8d1f53">-</p>
</td>
<td class="cellrowborder" valign="top" width="56.92%" headers="mcps1.3.1.2.2.4.1.3 "><p id="dli_08_0101__en-us_topic_0060575892_p374134716212">Return the sole element of an array with a single element. If the array contains no elements, <strong id="dli_08_0101__b84235270617287">null</strong> is returned. If the array contains multiple elements, an exception is reported.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="dli_08_0101__p5590325162210">Example:</p>
<p id="dli_08_0101__en-us_topic_0060575892_p102342741020">The returned number of elements in the array is 3.</p>
<pre class="screen" id="dli_08_0101__s70e35ea4aaa44817a4e271328ede2985">insert into temp select CARDINALITY(ARRAY[TRUE, TRUE, FALSE]) from source_stream;</pre>
<p id="dli_08_0101__en-us_topic_0060575892_p22409404105"><strong id="dli_08_0101__b842352706172838">HELLO WORLD</strong> is returned.</p>
<pre class="screen" id="dli_08_0101__s39441138181c49e483ea8587c540b223">insert into temp select ELEMENT(ARRAY['HELLO WORLD']) from source_stream;</pre>
</div>
<div class="section" id="dli_08_0101__section37538115232"><h4 class="sectiontitle">Attribute Access Functions</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0101__te3dd0e6386154ddaba966bbc036d1ad8" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Attribute access functions</caption><thead align="left"><tr id="dli_08_0101__r4746387fd00d4aa7ac94725d6a4a4829"><th align="left" class="cellrowborder" valign="top" width="24.310000000000002%" id="mcps1.3.2.2.2.4.1.1"><p id="dli_08_0101__a39098570c0dd484db9f604420e29c38d">Function</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.77%" id="mcps1.3.2.2.2.4.1.2"><p id="dli_08_0101__a80e82b02aadc4b5a9bb5dd35793f2375">Return Data Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.92%" id="mcps1.3.2.2.2.4.1.3"><p id="dli_08_0101__a3a83837a03da48e4a2f1e1639ff4a94e">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0101__rbed1b20c9708403fbaf8443c45d79653"><td class="cellrowborder" valign="top" width="24.310000000000002%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_0101__en-us_topic_0061207848_p553214468505">tableName.compositeType.field</p>
</td>
<td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_0101__en-us_topic_0061207848_p753254625015">-</p>
</td>
<td class="cellrowborder" valign="top" width="56.92%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_0101__a217ca30e6a4646729fd24819d0bdc950">Select a single field, use the name to access the field of Apache Flink composite types, such as Tuple and POJO, and return the value.</p>
</td>
</tr>
<tr id="dli_08_0101__r170509d0555946a489bbea9f8363a1c7"><td class="cellrowborder" valign="top" width="24.310000000000002%" headers="mcps1.3.2.2.2.4.1.1 "><p id="dli_08_0101__en-us_topic_0061207848_p65326461508">tableName.compositeType.*</p>
</td>
<td class="cellrowborder" valign="top" width="18.77%" headers="mcps1.3.2.2.2.4.1.2 "><p id="dli_08_0101__acce29f234df648fc87cc5a5b6cf5ab47">-</p>
</td>
<td class="cellrowborder" valign="top" width="56.92%" headers="mcps1.3.2.2.2.4.1.3 "><p id="dli_08_0101__a33aa18ca20b844428a8e59dcdb659211">Select all fields, and convert Apache Flink composite types, such as Tuple and POJO, and all their direct subtypes into a simple table. Each subtype is a separate field.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0086.html">Built-In Functions</a></div>
</div>
</div>