blob: e73d46c2d84c2c1dfe81fccacd64c40519681821 [file] [log] [blame]
import{_ as t,C as o,O as p,P as i,ah as r,Q as a,U as n,ai as c,aW as s}from"./framework-e4340ccd.js";const l={},d=s(`<h2 id="_0-import-dependency" tabindex="-1"><a class="header-anchor" href="#_0-import-dependency" aria-hidden="true">#</a> 0. Import Dependency</h2><div class="language-xml line-numbers-mode" data-ext="xml"><pre class="language-xml"><code> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">&gt;</span></span>org.apache.iotdb<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">&gt;</span></span>influxdb-protocol<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">&gt;</span></span>1.0.0<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">&gt;</span></span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,2),u={href:"https://github.com/apache/iotdb/tree/master/example/inflxudb-protocol-example/src/main/java/org/apache/iotdb/influxdb/InfluxDBExample.java",target:"_blank",rel:"noopener noreferrer"},k=s(`<h2 id="_1-switching-scheme" tabindex="-1"><a class="header-anchor" href="#_1-switching-scheme" aria-hidden="true">#</a> 1. Switching Scheme</h2><p>If your original service code for accessing InfluxDB is as follows:</p><div class="language-java line-numbers-mode" data-ext="java"><pre class="language-java"><code><span class="token class-name">InfluxDB</span> influxDB <span class="token operator">=</span> <span class="token class-name">InfluxDBFactory</span><span class="token punctuation">.</span><span class="token function">connect</span><span class="token punctuation">(</span>openurl<span class="token punctuation">,</span> username<span class="token punctuation">,</span> password<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>You only need to replace the InfluxDBFactory with <strong>IoTDBInfluxDBFactory</strong> to switch the business to IoTDB:</p><div class="language-java line-numbers-mode" data-ext="java"><pre class="language-java"><code><span class="token class-name">InfluxDB</span> influxDB <span class="token operator">=</span> <span class="token class-name">IoTDBInfluxDBFactory</span><span class="token punctuation">.</span><span class="token function">connect</span><span class="token punctuation">(</span>openurl<span class="token punctuation">,</span> username<span class="token punctuation">,</span> password<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h2 id="_2-conceptual-design" tabindex="-1"><a class="header-anchor" href="#_2-conceptual-design" aria-hidden="true">#</a> 2. Conceptual Design</h2><h3 id="_2-1-influxdb-protocol-adapter" tabindex="-1"><a class="header-anchor" href="#_2-1-influxdb-protocol-adapter" aria-hidden="true">#</a> 2.1 InfluxDB-Protocol Adapter</h3><p>Based on the IoTDB Java ServiceProvider interface, the adapter implements the &#39;interface InfluxDB&#39; of the java interface of InfluxDB, and provides users with all the interface methods of InfluxDB. End users can use the InfluxDB protocol to initiate write and read requests to IoTDB without perception.</p><figure><img src="https://alioss.timecho.com/docs/img/UserGuide/API/IoTDB-InfluxDB/architecture-design.png" alt="architecture-design" tabindex="0" loading="lazy"><figcaption>architecture-design</figcaption></figure><figure><img src="https://alioss.timecho.com/docs/img/UserGuide/API/IoTDB-InfluxDB/class-diagram.png" alt="class-diagram" tabindex="0" loading="lazy"><figcaption>class-diagram</figcaption></figure><h3 id="_2-2-metadata-format-conversion" tabindex="-1"><a class="header-anchor" href="#_2-2-metadata-format-conversion" aria-hidden="true">#</a> 2.2 Metadata Format Conversion</h3><p>The metadata of InfluxDB is tag field model, and the metadata of IoTDB is tree model. In order to make the adapter compatible with the InfluxDB protocol, the metadata model of InfluxDB needs to be transformed into the metadata model of IoTDB.</p><h4 id="_2-2-1-influxdb-metadata" tabindex="-1"><a class="header-anchor" href="#_2-2-1-influxdb-metadata" aria-hidden="true">#</a> 2.2.1 InfluxDB Metadata</h4><ol><li>database: database name.</li><li>measurement: measurement name.</li><li>tags: various indexed attributes.</li><li>fields: various record values(attributes without index).</li></ol><figure><img src="https://alioss.timecho.com/docs/img/UserGuide/API/IoTDB-InfluxDB/influxdb-data.png" alt="influxdb-data" tabindex="0" loading="lazy"><figcaption>influxdb-data</figcaption></figure><h4 id="_2-2-2-iotdb-metadata" tabindex="-1"><a class="header-anchor" href="#_2-2-2-iotdb-metadata" aria-hidden="true">#</a> 2.2.2 IoTDB Metadata</h4><ol><li>database: database name.</li><li>path(time series ID): storage path.</li><li>measurement: physical quantity.</li></ol><figure><img src="https://alioss.timecho.com/docs/img/UserGuide/API/IoTDB-InfluxDB/iotdb-data.png" alt="iotdb-data" tabindex="0" loading="lazy"><figcaption>iotdb-data</figcaption></figure><h4 id="_2-2-3-mapping-relationship-between-the-two" tabindex="-1"><a class="header-anchor" href="#_2-2-3-mapping-relationship-between-the-two" aria-hidden="true">#</a> 2.2.3 Mapping relationship between the two</h4><p>The mapping relationship between InfluxDB metadata and IoTDB metadata is as follows:</p><ol><li>The database and measurement in InfluxDB are combined as the database in IoTDB.</li><li>The field key in InfluxDB is used as the measurement path in IoTDB, and the field value in InfluxDB is the measured point value recorded under the path.</li><li>Tag in InfluxDB is expressed by the path between database and measurement in IoTDB. The tag key of InfluxDB is implicitly expressed by the order of the path between database and measurement, and the tag value is recorded as the name of the path in the corresponding order.</li></ol><p>The transformation relationship from InfluxDB metadata to IoTDB metadata can be represented by the following publicity:</p><p><code>root.{database}.{measurement}.{tag value 1}.{tag value 2}...{tag value N-1}.{tag value N}.{field key}</code></p><figure><img src="https://alioss.timecho.com/docs/img/UserGuide/API/IoTDB-InfluxDB/influxdb-vs-iotdb-data.png" alt="influxdb-vs-iotdb-data" tabindex="0" loading="lazy"><figcaption>influxdb-vs-iotdb-data</figcaption></figure><p>As shown in the figure above, it can be seen that:</p><p>In IoTDB, we use the path between database and measurement to express the concept of InfluxDB tag, which is the part of the green box on the right in the figure.</p><p>Each layer between database and measurement represents a tag. If the number of tag keys is n, the number of layers of the path between database and measurement is n. We sequentially number each layer between database and measurement, and each sequence number corresponds to a tag key one by one. At the same time, we use the <strong>path name</strong> of each layer between database and measurement to remember tag value. Tag key can find the tag value under the corresponding path level through its own serial number.</p><h4 id="_2-2-4-key-problem" tabindex="-1"><a class="header-anchor" href="#_2-2-4-key-problem" aria-hidden="true">#</a> 2.2.4 Key Problem</h4><p>In the SQL statement of InfluxDB, the different order of tags does not affect the actual execution .</p><p>For example: <code>insert factory, workshop=A1, production=B1, temperature=16.9</code> and <code>insert factory, production=B1, workshop=A1, temperature=16.9</code> have the same meaning (and execution result) of the two InfluxDB SQL.</p><p>However, in IoTDB, the above inserted data points can be stored in <code>root.monitor.factory.A1.B1.temperature</code> can also be stored in <code>root.monitor.factory.B1.A1.temperature</code>. Therefore, the order of the tags of the InfluxDB stored in the IoTDB path needs special consideration because <code>root.monitor.factory.A1.B1.temperature</code> and</p><p><code>root.monitor.factory.B1.A1.temperature</code> is two different sequences. We can think that iotdb metadata model is &quot;sensitive&quot; to the processing of tag order.</p><p>Based on the above considerations, we also need to record the hierarchical order of each tag in the IoTDB path in the IoTDB, as to ensure that the adapter can only operate on a time series in the IoTDB as long as the SQL expresses operations on the same time series, regardless of the order in which the tags appear in the InfluxDB SQL.</p><p>Another problem that needs to be considered here is how to persist the tag key and corresponding order relationship of InfluxDB into the IoTDB database to ensure that relevant information will not be lost.</p><p><strong>Solution:</strong></p><p><strong>The form of tag key correspondence in memory</strong></p><p>Maintain the order of tags at the IoTDB path level by using the map structure of <code>Map&lt;Measurement,Map&lt;Tag key, order&gt;&gt;</code> in memory.</p><div class="language-java line-numbers-mode" data-ext="java"><pre class="language-java"><code> <span class="token class-name">Map</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span> <span class="token class-name">Map</span><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">,</span> <span class="token class-name">Integer</span><span class="token punctuation">&gt;</span><span class="token punctuation">&gt;</span></span> measurementTagOrder
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>It can be seen that map is a two-tier structure.</p><p>The key of the first layer is an InfluxDB measurement of string type, and the value of the first layer is a Map&lt;string,Integer&gt; structure.</p><p>The key of the second layer is the InfluxDB tag key of string type, and the value of the second layer is the tag order of Integer type, that is, the order of tags at the IoTDB path level.</p><p>When in use, you can first locate the tag through the InfluxDB measurement, then locate the tag through the InfluxDB tag key, and finally get the order of tags at the IoTDB path level.</p><p><strong>Persistence scheme of tag key correspondence order</strong></p><p>Database is <code>root.TAG_ Info</code>, using <code>database_name</code>,<code>measurement_ name</code>, <code>tag_ Name </code> and <code>tag_ Order</code> under the database to store tag key and its corresponding order relationship by measuring points.</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+---------------------------+------------------------------+----------------------+-----------------------+
| Time|root.TAG_INFO.database_name|root.TAG_INFO.measurement_name|root.TAG_INFO.tag_name|root.TAG_INFO.tag_order|
+-----------------------------+---------------------------+------------------------------+----------------------+-----------------------+
|2021-10-12T01:21:26.907+08:00| monitor| factory| workshop| 1|
|2021-10-12T01:21:27.310+08:00| monitor| factory| production| 2|
|2021-10-12T01:21:27.313+08:00| monitor| factory| cell| 3|
|2021-10-12T01:21:47.314+08:00| building| cpu| tempture| 1|
+-----------------------------+---------------------------+------------------------------+----------------------+-----------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="_2-3-example" tabindex="-1"><a class="header-anchor" href="#_2-3-example" aria-hidden="true">#</a> 2.3 Example</h3><h4 id="_2-3-1-insert-records" tabindex="-1"><a class="header-anchor" href="#_2-3-1-insert-records" aria-hidden="true">#</a> 2.3.1 Insert records</h4><ol><li><p>Suppose three pieces of data are inserted into the InfluxDB in the following order (database = monitor):</p><p>(1)<code>insert student,name=A,phone=B,sex=C score=99</code></p><p>(2)<code>insert student,address=D score=98</code></p><p>(3)<code>insert student,name=A,phone=B,sex=C,address=D score=97</code></p></li><li><p>Simply explain the timing of the above InfluxDB, and database is monitor; Measurement is student; Tag is name, phone, sex and address respectively; Field is score.</p></li></ol><p>The actual storage of the corresponding InfluxDB is:</p><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>time address name phone sex socre
---- ------- ---- ----- --- -----
1633971920128182000 A B C 99
1633971947112684000 D 98
1633971963011262000 D A B C 97
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ol start="3"><li><p>The process of inserting three pieces of data in sequence by IoTDB is as follows:</p><p>(1) When inserting the first piece of data, we need to update the three new tag keys to the table. The table of the record tag sequence corresponding to IoTDB is:</p><p>| database | measurement | tag_key | Order | | -------- | ----------- | ------- | ----- | | monitor | student | name | 0 | | monitor | student | phone | 1 | | monitor | student | sex | 2 |</p><p>(2) When inserting the second piece of data, since there are already three tag keys in the table recording the tag order, it is necessary to update the record with the fourth tag key=address. The table of the record tag sequence corresponding to IoTDB is:</p><p>| database | measurement | tag_key | order | | -------- | ----------- | ------- | ----- | | monitor | student | name | 0 | | monitor | student | phone | 1 | | monitor | student | sex | 2 | | monitor | student | address | 3 |</p><p>(3) When inserting the third piece of data, the four tag keys have been recorded at this time, so there is no need to update the record. The table of the record tag sequence corresponding to IoTDB is:</p><p>| database | measurement | tag_key | order | | -------- | ----------- | ------- | ----- | | monitor | student | name | 0 | | monitor | student | phone | 1 | | monitor | student | sex | 2 | | monitor | student | address | 3 |</p></li><li><p>(1) The IoTDB sequence corresponding to the first inserted data is root.monitor.student.A.B.C</p><p>(2) The IoTDB sequence corresponding to the second inserted data is root.monitor.student.PH.PH.PH.D (where PH is a placeholder).</p><p>It should be noted that since the tag key = address of this data appears the fourth, but it does not have the corresponding first three tag values, it needs to be replaced by a PH. The purpose of this is to ensure that the tag order in each data will not be disordered, which is consistent with the order in the current order table, so that the specified tag can be filtered when querying data.</p><p>(3) The IoTDB sequence corresponding to the second inserted data is root.monitor.student.A.B.C.D</p><p>The actual storage of the corresponding IoTDB is:</p></li></ol><div class="language-text line-numbers-mode" data-ext="text"><pre class="language-text"><code>+-----------------------------+--------------------------------+-------------------------------------+----------------------------------+
| Time|root.monitor.student.A.B.C.score|root.monitor.student.PH.PH.PH.D.score|root.monitor.student.A.B.C.D.score|
+-----------------------------+--------------------------------+-------------------------------------+----------------------------------+
|2021-10-12T01:21:26.907+08:00| 99| NULL| NULL|
|2021-10-12T01:21:27.310+08:00| NULL| 98| NULL|
|2021-10-12T01:21:27.313+08:00| NULL| NULL| 97|
+-----------------------------+--------------------------------+-------------------------------------+----------------------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ol start="5"><li>If the insertion order of the above three data is different, we can see that the corresponding actual path has changed, because the order of tags in the InfluxDB data has changed, and the order of the corresponding path nodes in IoTDB has also changed.</li></ol><p>However, this will not affect the correctness of the query, because once the tag order of InfluxDB is determined, the query will also filter the tag values according to the order recorded in this order table. Therefore, the correctness of the query will not be affected.</p><h4 id="_2-3-2-query-data" tabindex="-1"><a class="header-anchor" href="#_2-3-2-query-data" aria-hidden="true">#</a> 2.3.2 Query Data</h4><ol><li><p>Query the data of phone = B in student. In database = monitor, measurement = student, the order of tag = phone is 1, and the maximum order is 3. The query corresponding to IoTDB is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span>B
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div></li><li><p>Query the data with phone = B and score &gt; 97 in the student. The query corresponding to IoTDB is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span>B <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div></li><li><p>Query the data of the student with phone = B and score &gt; 97 in the last seven days. The query corresponding to IoTDB is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span>B <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span> <span class="token operator">and</span> <span class="token keyword">time</span> <span class="token operator">&gt;</span> <span class="token function">now</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">-</span><span class="token number">7</span>d
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div></li><li><p>Query the name = a or score &gt; 97 in the student. Since the tag is stored in the path, there is no way to complete the <strong>or</strong> semantic query of tag and field at the same time with one query. Therefore, multiple queries or operation union set are required. The query corresponding to IoTDB is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span>A
<span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p>Finally, manually combine the results of the above two queries.</p></li><li><p>Query the student (name = a or phone = B or sex = C) with a score &gt; 97. Since the tag is stored in the path, there is no way to use one query to complete the <strong>or</strong> semantics of the tag. Therefore, multiple queries or operations are required to merge. The query corresponding to IoTDB is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span>A <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span>
<span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span>B <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span>
<span class="token keyword">select</span> <span class="token operator">*</span> <span class="token keyword">from</span> root<span class="token punctuation">.</span>monitor<span class="token punctuation">.</span>student<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span>C <span class="token keyword">where</span> score<span class="token operator">&gt;</span><span class="token number">97</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Finally, manually combine the results of the above three queries.</p></li></ol><h2 id="_3-support" tabindex="-1"><a class="header-anchor" href="#_3-support" aria-hidden="true">#</a> 3. Support</h2><h3 id="_3-1-influxdb-version-support" tabindex="-1"><a class="header-anchor" href="#_3-1-influxdb-version-support" aria-hidden="true">#</a> 3.1 InfluxDB Version Support</h3><p>Currently, supports InfluxDB 1.x version, which does not support InfluxDB 2.x version.</p><p>The Maven dependency of <code>influxdb-java</code> supports 2.21 +, and the lower version is not tested.</p><h3 id="_3-2-function-interface-support" tabindex="-1"><a class="header-anchor" href="#_3-2-function-interface-support" aria-hidden="true">#</a> 3.2 Function Interface Support</h3><p>Currently, supports interface functions are as follows:</p><div class="language-java line-numbers-mode" data-ext="java"><pre class="language-java"><code><span class="token keyword">public</span> <span class="token class-name">Pong</span> <span class="token function">ping</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token class-name">String</span> <span class="token function">version</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">flush</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token class-name">InfluxDB</span> <span class="token function">setDatabase</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token class-name">QueryResult</span> <span class="token function">query</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">Query</span> query<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">Point</span> point<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> retentionPolicy<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">Point</span> point<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token keyword">int</span> udpPort<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">Point</span> point<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">BatchPoints</span> batchPoints<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> retentionPolicy<span class="token punctuation">,</span>
<span class="token keyword">final</span> <span class="token class-name">ConsistencyLevel</span> consistency<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> retentionPolicy<span class="token punctuation">,</span>
<span class="token keyword">final</span> <span class="token class-name">ConsistencyLevel</span> consistency<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">TimeUnit</span> precision<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> retentionPolicy<span class="token punctuation">,</span>
<span class="token keyword">final</span> <span class="token class-name">ConsistencyLevel</span> consistency<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token class-name">String</span> database<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> retentionPolicy<span class="token punctuation">,</span>
<span class="token keyword">final</span> <span class="token class-name">ConsistencyLevel</span> consistency<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">TimeUnit</span> precision<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token keyword">int</span> udpPort<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">String</span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">public</span> <span class="token keyword">void</span> <span class="token function">write</span><span class="token punctuation">(</span><span class="token keyword">final</span> <span class="token keyword">int</span> udpPort<span class="token punctuation">,</span><span class="token keyword">final</span> <span class="token class-name">List</span><span class="token generics"><span class="token punctuation">&lt;</span><span class="token class-name">String</span><span class="token punctuation">&gt;</span></span> records<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="_3-3-query-syntax-support" tabindex="-1"><a class="header-anchor" href="#_3-3-query-syntax-support" aria-hidden="true">#</a> 3.3 Query Syntax Support</h3><p>The currently supported query SQL syntax is:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">SELECT</span> <span class="token operator">&lt;</span>field_key<span class="token operator">&gt;</span><span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token operator">&lt;</span>field_key<span class="token operator">&gt;</span><span class="token punctuation">,</span> <span class="token operator">&lt;</span>tag_key<span class="token operator">&gt;</span><span class="token punctuation">]</span>
<span class="token keyword">FROM</span> <span class="token operator">&lt;</span>measurement_name<span class="token operator">&gt;</span>
<span class="token keyword">WHERE</span> <span class="token operator">&lt;</span>conditional_expression <span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token punctuation">(</span> <span class="token operator">AND</span> <span class="token operator">|</span> <span class="token operator">OR</span><span class="token punctuation">)</span> <span class="token operator">&lt;</span>conditional_expression <span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">]</span><span class="token punctuation">]</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>WHERE clause supports <code>conditional_expressions</code> on <code>field</code>,<code>tag</code> and <code>timestamp</code>.</p><h4 id="field" tabindex="-1"><a class="header-anchor" href="#field" aria-hidden="true">#</a> field</h4><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>field_key <span class="token operator">&lt;</span>operator<span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token string">&#39;string&#39;</span> <span class="token operator">|</span> <span class="token keyword">boolean</span> <span class="token operator">|</span> <span class="token keyword">float</span> <span class="token operator">|</span> <span class="token keyword">integer</span><span class="token punctuation">]</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h4 id="tag" tabindex="-1"><a class="header-anchor" href="#tag" aria-hidden="true">#</a> tag</h4><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>tag_key <span class="token operator">&lt;</span>operator<span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token string">&#39;tag_value&#39;</span><span class="token punctuation">]</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h4 id="timestamp" tabindex="-1"><a class="header-anchor" href="#timestamp" aria-hidden="true">#</a> timestamp</h4><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">timestamp</span> <span class="token operator">&lt;</span>operator<span class="token operator">&gt;</span> <span class="token punctuation">[</span><span class="token string">&#39;time&#39;</span><span class="token punctuation">]</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>At present, the filter condition of timestamp only supports the expressions related to now(), such as now () - 7d. The specific timestamp is not supported temporarily.</p>`,74);function h(m,g){const e=o("ExternalLinkIcon");return p(),i("div",null,[r(`
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
`),d,a("p",null,[n("Here are some "),a("a",u,[n("examples"),c(e)]),n(" of connecting IoTDB using the InfluxDB-Protocol adapter.")]),k])}const v=t(l,[["render",h],["__file","InfluxDB-Protocol.html.vue"]]);export{v as default};