Skip to content

Commit 1a9ccef

Browse files
authored
Explanation for adding quotation marks on the modeling scheme design page (#450)
1 parent cdad4d5 commit 1a9ccef

File tree

8 files changed

+211
-189
lines changed

8 files changed

+211
-189
lines changed

src/UserGuide/Master/Tree/Basic-Concept/Data-Model-and-Terminology.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ The following are the constraints on the `nodeName`:
8787
* [ 0-9 a-z A-Z _ ] (letters, numbers, underscore)
8888
* ['\u2E80'..'\u9FFF'] (Chinese characters)
8989
* In particular, if the system is deployed on a Windows machine, the database layer name will be case-insensitive. For example, creating both `root.ln` and `root.LN` at the same time is not allowed.
90-
* If you want to use special characters in `nodeName`, you can quote it with back quote, detailed information can be found from charpter Syntax-Conventions,click here: [Syntax-Conventions](https://iotdb.apache.org/UserGuide/Master/Syntax-Conventions/Literal-Values.html).
90+
91+
### Special characters (Reverse quotation marks)
92+
93+
If you need to use special characters in the path node name, you can use reverse quotation marks to reference the path node name. For specific usage, please refer to [Reverse Quotation Marks](../Reference/Syntax-Rule.md#reverse-quotation-marks).
9194

9295
### Path Pattern
9396

src/UserGuide/Master/Tree/Reference/Syntax-Rule.md

Lines changed: 84 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -171,110 +171,111 @@ Below are basic constraints of identifiers, specific identifiers may have other
171171
- Permitted characters in unquoted identifiers:
172172
- [0-9 a-z A-Z _ ] (letters, digits and underscore)
173173
- ['\u2E80'..'\u9FFF'] (UNICODE Chinese characters)
174-
- Identifiers may begin with a digit, unquoted identifiers can not be a real number.
175-
- Identifiers are case sensitive.
176-
- Key words can be used as an identifier.
177174

178-
**You need to quote the identifier with back quote(`) in the following cases:**
175+
### Reverse quotation marks
179176

180-
- Identifier contains special characters.
181-
- Identifier that is a real number.
177+
**If the following situations occur, the identifier needs to be quoted using reverse quotes:**
182178

183-
### How to use quotations marks in quoted identifiers
179+
- The identifier contains special characters that are not allowed.
180+
- The identifier is a real number.
184181

185-
`'` and `"` can be used directly in quoted identifiers.
182+
#### How to use quotation marks in identifiers caused by reverse quotation marks
186183

187-
` may be written as `` in quoted identifiers. See the example below:
184+
**Single and double quotes can be directly used in identifiers caused by reverse quotes.**
188185

189-
```sql
190-
# create template t1't"t
191-
create device template `t1't"t`
192-
(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
186+
**In identifiers referenced with quotation marks, quotation marks can be used by double writing them, meaning ` can be represented as``.**
187+
188+
example:
193189
194-
# create template t1`t
190+
```SQL
191+
# Create Template t1 ` t
195192
create device template `t1``t`
196193
(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
194+
195+
# Create Template t1't "t
196+
create device template `t1't"t`
197+
(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
197198
```
198199

199-
### Examples
200+
#### Examples of Reverse Quotation Marks
200201

201-
Examples of case in which quoted identifier is used
202+
- When the trigger name encounters the above special situations, reverse quotation marks should be used to reference it:
202203

203-
- Trigger name should be quoted in cases described above :
204+
```sql
205+
# Create trigger alert.` listener-sg1d1s1
206+
CREATE TRIGGER `alert.``listener-sg1d1s1`
207+
AFTER INSERT
208+
ON root.sg1.d1.s1
209+
AS 'org.apache.iotdb.db.engine.trigger.example.AlertListener'
210+
WITH (
211+
'lo' = '0',
212+
'hi' = '100.0'
213+
)
214+
```
204215

205-
```sql
206-
# create trigger named alert.`listener-sg1d1s1
207-
CREATE TRIGGER `alert.``listener-sg1d1s1`
208-
AFTER INSERT
209-
ON root.sg1.d1.s1
210-
AS 'org.apache.iotdb.db.storageengine.trigger.example.AlertListener'
211-
WITH (
212-
'lo' = '0',
213-
'hi' = '100.0'
214-
)
215-
```
216+
- When the UDF name encounters the above special situations, reverse quotation marks should be used for reference:
216217

217-
- UDF name should be quoted in cases described above :
218-
219-
```sql
220-
# create a funciton named 111, 111 is a real number.
221-
CREATE FUNCTION `111` AS 'org.apache.iotdb.udf.UDTFExample'
222-
```
218+
```sql
219+
# Create a UDF named 111, which is a real number and needs to be quoted in reverse quotation marks.
220+
CREATE FUNCTION `111` AS 'org.apache.iotdb.udf.UDTFExample'
221+
```
223222

224-
- Template name should be quoted in cases described above :
223+
- When the metadata template name encounters the above special situations, reverse quotation marks should be used for reference:
225224

226-
```sql
227-
# create a template named 111, 111 is a real number.
228-
create device template `111`
229-
(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
230-
```
225+
```sql
226+
# Create a metadata template named 111, where 111 is a real number and needs to be quoted in reverse quotation marks.
227+
create device template `111`
228+
(temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)
229+
```
231230

232-
- User and Role name should be quoted in cases described above, blank space is not allow in User and Role name whether quoted or not :
231+
- When the username and role name encounter the above special situations, reverse quotation marks should be used for reference. Regardless of whether reverse quotation marks are used or not, spaces are not allowed in the username and role name. Please refer to the instructions in the permission management section for details.
233232

234-
```sql
235-
# create user special`user.
236-
CREATE USER `special``user.` 'write_pwd'
237-
238-
# create role 111
239-
CREATE ROLE `111`
240-
```
241-
242-
- Continuous query name should be quoted in cases described above :
243-
244-
```sql
245-
# create continuous query test.cq
246-
CREATE CONTINUOUS QUERY `test.cq`
247-
BEGIN
248-
SELECT max_value(temperature)
249-
INTO temperature_max
250-
FROM root.ln.*.*
251-
GROUP BY time(10s)
252-
END
253-
```
254-
255-
- Pipe、PipeSink should be quoted in cases described above :
233+
```sql
234+
# Create user special ` user.
235+
CREATE USER `special``user.` 'write_pwd'
236+
237+
# Create Character 111
238+
CREATE ROLE `111`
239+
```
240+
241+
- When encountering the above special situations in continuous query identification, reverse quotation marks should be used to reference:
242+
243+
```sql
244+
# Create continuous query test.cq
245+
CREATE CONTINUOUS QUERY `test.cq`
246+
BEGIN
247+
SELECT max_value(temperature)
248+
INTO temperature_max
249+
FROM root.ln.*.*
250+
GROUP BY time(10s)
251+
END
252+
```
253+
254+
- When the names Pipe and PipeSink encounter the above special situations, reverse quotation marks should be used for reference:
255+
256+
```sql
257+
# Create PipeSink test. * 1
258+
CREATE PIPESINK `test.*1` AS IoTDB ('ip' = '输入你的IP')
259+
260+
# Create Pipe Test. * 2
261+
CREATE PIPE `test.*2` TO `test.*1` FROM
262+
(select ** from root WHERE time>=yyyy-mm-dd HH:MM:SS) WITH 'SyncDelOp' = 'true'
263+
```
256264

257-
```sql
258-
# create PipeSink test.*1
259-
CREATE PIPESINK `test.*1` AS IoTDB ('ip' = '输入你的IP')
260-
261-
# create Pipe test.*2
262-
CREATE PIPE `test.*2` TO `test.*1` FROM
263-
(select ** from root WHERE time>=yyyy-mm-dd HH:MM:SS) WITH 'SyncDelOp' = 'true'
264-
```
265+
- In the Select clause, an alias can be specified for the value in the result set, which can be defined as a string or identifier. Examples are as follows:
265266

266-
- `AS` function provided by IoTDB can assign an alias to time series selected in query. Alias can be constant(including string) or identifier.
267+
```sql
268+
select s1 as temperature, s2 as speed from root.ln.wf01.wt01;
269+
# 表头如下所示
270+
+-----------------------------+-----------+-----+
271+
| Time|temperature|speed|
272+
+-----------------------------+-----------+-----+
273+
```
267274

268-
```sql
269-
select s1 as temperature, s2 as speed from root.ln.wf01.wt01;
270-
271-
# Header of result dataset
272-
+-----------------------------+-----------|-----+
273-
| Time|temperature|speed|
274-
+-----------------------------+-----------|-----+
275-
```
275+
- Used to represent key value pairs, the keys and values of key value pairs can be defined as constants (including strings) or identifiers. Please refer to the Key Value Pair section for details.
276276

277-
- The key/value of an attribute can be String Literal and identifier, more details can be found at **key-value pair** part.
278-
279-
- Nodes except database in the path are allowed to contain the "*" symbol, when using this symbol it is required to enclose the node in backquotes, e.g., root.db.`*`, but this usage is only recommended when the path cannot avoid containing the "*" symbol.
277+
- Non database nodes in the path are allowed to contain the symbol `*`. When using it, the node needs to be enclosed in reverse quotes (as shown below), but this usage is only recommended when the path inevitably contains `*`.
280278

279+
```sql
280+
`root.db.*`
281+
```

src/UserGuide/latest/Basic-Concept/Data-Model-and-Terminology.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ The following are the constraints on the `nodeName`:
8787
* [ 0-9 a-z A-Z _ ] (letters, numbers, underscore)
8888
* ['\u2E80'..'\u9FFF'] (Chinese characters)
8989
* In particular, if the system is deployed on a Windows machine, the database layer name will be case-insensitive. For example, creating both `root.ln` and `root.LN` at the same time is not allowed.
90-
* If you want to use special characters in `nodeName`, you can quote it with back quote, detailed information can be found from charpter Syntax-Conventions,click here: [Syntax-Conventions](https://iotdb.apache.org/UserGuide/Master/Syntax-Conventions/Literal-Values.html).
90+
91+
### Special characters (Reverse quotation marks)
92+
93+
If you need to use special characters in the path node name, you can use reverse quotation marks to reference the path node name. For specific usage, please refer to [Reverse Quotation Marks](../Reference/Syntax-Rule.md#reverse-quotation-marks).
94+
9195

9296
### Path Pattern
9397

0 commit comments

Comments
 (0)