doc-exports/docs/dli/sqlreference/dli_08_0345.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

133 lines
9.8 KiB
HTML

<a name="dli_08_0345"></a><a name="dli_08_0345"></a>
<h1 class="topictitle1">Print Result Table</h1>
<div id="body8662426"><div class="section" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_dli_08_0256_en-us_topic_0132788972_section108631122164917"><h4 class="sectiontitle">Function</h4><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p661816320442">The print connector exports your data output to the <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b998291265520">error</strong> file or the <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b73301417105517">out</strong> file of TaskManager. It is mainly used for code debugging and output viewing.</p>
</div>
<div class="section" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_dli_08_0256_en-us_topic_0132788972_section3126105364419"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_dli_08_0256_screen1461215294716"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span>
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">create</span><span class="w"> </span><span class="k">table</span><span class="w"> </span><span class="n">printSink</span><span class="w"> </span><span class="p">(</span>
<span class="w"> </span><span class="n">attr_name</span><span class="w"> </span><span class="n">attr_type</span><span class="w"> </span><span class="p">(</span><span class="s1">','</span><span class="w"> </span><span class="n">attr_name</span><span class="w"> </span><span class="n">attr_type</span><span class="p">)</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="p">(</span><span class="s1">','</span><span class="w"> </span><span class="k">PRIMARY</span><span class="w"> </span><span class="k">KEY</span><span class="w"> </span><span class="p">(</span><span class="n">attr_name</span><span class="p">,...)</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="n">ENFORCED</span><span class="p">)</span>
<span class="p">)</span><span class="w"> </span><span class="k">with</span><span class="w"> </span><span class="p">(</span>
<span class="w"> </span><span class="s1">'connector'</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'print'</span><span class="p">,</span>
<span class="w"> </span><span class="s1">'print-identifier'</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">''</span><span class="p">,</span>
<span class="w"> </span><span class="s1">'standard-error'</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">''</span>
<span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_dli_08_0256_section4299113491"><h4 class="sectiontitle">Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_table11617424154613" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_row146177242466"><th align="left" class="cellrowborder" valign="top" width="11.501150115011502%" id="mcps1.3.3.2.2.4.1.1"><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p1361712418461">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.26102610261026%" id="mcps1.3.3.2.2.4.1.2"><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p176171424114615">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="78.23782378237823%" id="mcps1.3.3.2.2.4.1.3"><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p261712247467">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_row136171242461"><td class="cellrowborder" valign="top" width="11.501150115011502%" headers="mcps1.3.3.2.2.4.1.1 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p992213916285">connector</p>
</td>
<td class="cellrowborder" valign="top" width="10.26102610261026%" headers="mcps1.3.3.2.2.4.1.2 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p169221598288">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="78.23782378237823%" headers="mcps1.3.3.2.2.4.1.3 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p1492219917287">The value is fixed to <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b2771191619567">print</strong>.</p>
</td>
</tr>
<tr id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_row1961742414462"><td class="cellrowborder" valign="top" width="11.501150115011502%" headers="mcps1.3.3.2.2.4.1.1 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p189227911283">print-identifier</p>
</td>
<td class="cellrowborder" valign="top" width="10.26102610261026%" headers="mcps1.3.3.2.2.4.1.2 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p119227912817">No</p>
</td>
<td class="cellrowborder" valign="top" width="78.23782378237823%" headers="mcps1.3.3.2.2.4.1.3 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p7867103732716">Message that identifies print and is prefixed to the output of the value.</p>
</td>
</tr>
<tr id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_row1761802415461"><td class="cellrowborder" valign="top" width="11.501150115011502%" headers="mcps1.3.3.2.2.4.1.1 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p1092209122818">standard-error</p>
</td>
<td class="cellrowborder" valign="top" width="10.26102610261026%" headers="mcps1.3.3.2.2.4.1.2 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p149225917285">No</p>
</td>
<td class="cellrowborder" valign="top" width="78.23782378237823%" headers="mcps1.3.3.2.2.4.1.3 "><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p9635357112713">The value can be only <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b158821435145619">true</strong> or <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b17882183545617">false</strong>. The default value is <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b1888293585613">false</strong>.</p>
<ul id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_ul1450115619284"><li id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_li12798014112819">If the value is <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b6329940105619">true</strong>, data is output to the error file of the TaskManager.</li><li id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_li850111672814">If the value is <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b662724419561">false</strong>, data is output to the <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b56280440568">out</strong> file of the TaskManager.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_section8515152835418"><h4 class="sectiontitle">Example</h4><p id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_p5999124192910">Read data from Kafka and export the data to the <strong id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_b370911645714">out</strong> file of TaskManager. You can view the output in the exported file.</p>
<pre class="screen" id="dli_08_0345__en-us_topic_0000001335803393_en-us_topic_0000001156760176_screen11244155517544">create table kafkaSource(
attr0 string,
attr1 boolean,
attr3 decimal(38, 18),
attr4 TINYINT,
attr5 smallint,
attr6 int,
attr7 bigint,
attr8 float,
attr9 double,
attr10 date,
attr11 time,
attr12 timestamp(3)
) with (
'connector.type' = 'kafka',
'connector.version' = '0.11',
'connector.topic' = 'test_json',
'connector.properties.bootstrap.servers' = 'xx.xx.xx.xx:9092',
'connector.properties.group.id' = 'test_print',
'connector.startup-mode' = 'latest-offset',
'format.type' = 'csv'
);
create table printTable(
attr0 string,
attr1 boolean,
attr3 decimal(38,18),
attr4 TINYINT,
attr5 smallint,
attr6 int,
attr7 bigint,
attr8 float,
attr9 double,
attr10 date,
attr11 time,
attr12 timestamp(3),
attr13 array&lt;string&gt;,
attr14 row&lt;attr15 float, attr16 timestamp(3)&gt;,
attr17 map&lt;int, bigint&gt;
) with (
"connector" = "print"
);
insert into
printTable
select
attr0,
attr1,
attr3,
attr4,
attr5,
attr6,
attr7,
attr8,
attr9,
attr10,
attr11,
attr12,
array [cast(attr0 as string), cast(attr0 as string)],
row(
cast(attr8 as float),
cast(attr12 as timestamp(3))
),
map [cast(attr6 as int), cast(attr7 as bigint)]
from
kafkaSource;</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0307.html">Creating a Result Table</a></div>
</div>
</div>