Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag array not working #507

Open
localvar opened this issue Feb 29, 2024 · 12 comments
Open

tag array not working #507

localvar opened this issue Feb 29, 2024 · 12 comments
Labels
bug Something isn't working wait to close Problem Solved

Comments

@localvar
Copy link
Contributor

Describe the bug(Bug 描述)

I follow this document to try the tag array feature, but the examples are not working as expected.

To Reproduce(Bug 复现步骤)

> create database db0
> use db0
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT

Expected behavior(期望结果)

3 records been written to the database

Screenshots(屏幕截图)

No response

Logs(完整的错误日志)

No response

Additional context(其他的一些补充内容)

No response

@localvar localvar added the bug Something isn't working label Feb 29, 2024
@supercz
Copy link

supercz commented Feb 29, 2024

to use tag array feature, should create database like this:

> create database db0 tag attribute array
> use db0
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
> select * from cpu
name: cpu
time                tk1    tk2      tk3      value
----                ---    ---      ---      -----
1670491329000000000 value1 value2   value3   2
1670491329000000000 value1 value22  value33  2
1670491329000000000 value1 value222 value333 2

@xiangyu5632 Please update the doc. https://docs.opengemini.org/zh/guide/features/tag_array.html

@xiangyu5632
Copy link
Member

to use tag array feature, should create database like this:

> create database db0 tag attribute array
> use db0
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
> select * from cpu
name: cpu
time                tk1    tk2      tk3      value
----                ---    ---      ---      -----
1670491329000000000 value1 value2   value3   2
1670491329000000000 value1 value22  value33  2
1670491329000000000 value1 value222 value333 2

@xiangyu5632 Please update the doc. https://docs.opengemini.org/zh/guide/features/tag_array.html

tkx @supercz, after I update the document, I‘ll feedbacks here

@localvar
Copy link
Contributor Author

@localvar
Copy link
Contributor Author

hmm, seems still not working with 'tag attribute array'

> create database db0 tag attribute array
> use db0
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT
> select * from cpu
ERR: measurement not found

I tried on below two versions:

$ ./ts-cli version
openGemini version info:
ts-cli: 1.1.0~rc1
git: main 222f626c7cf22b8a90983bd84cf5fc7e4969ef6c
os: linux
arch: amd64
$ ./ts-cli version
2024/02/29 11:06:39 proto: duplicate proto type registered: influxql.Measurements
2024/02/29 11:06:39 proto: duplicate proto type registered: influxql.Measurement
openGemini version info:
ts-cli: v1.1.1
git: HEAD bde0e11a903a87811ed3d92b5dc6f1f1c6f6713f
os: linux
arch: amd64

@supercz

@xiangyu5632
Copy link
Member

firstly, delete database db0, and then create it again using create database db0 tag attribute array

@localvar
Copy link
Contributor Author

localvar commented Feb 29, 2024

firstly, delete database db0, and then create it again using create database db0 tag attribute array

@xiangyu5632 I haven't paste that statement, but I did it.

> show databases
name: databases
+------+
| name |
+------+
| db0  |
+------+
1 columns, 1 rows in set

> drop database db0
> show databases
name: databases
+------+
| name |
+------+
+------+
1 columns, 0 rows in set

> create database db0 tag attribute array
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT

@xiangyu5632
Copy link
Member

@xiangyu5632
Copy link
Member

create database db0 tag attribute array
insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT

before inserting, maybe you missed use db0

@localvar
Copy link
Contributor Author

create database db0 tag attribute array
insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT

before inserting, maybe you missed use db0

no, that's not the case, this is a mistake when I want to show you the result of show databases, I have use db0 before.
and below is the result after I delete the data files and restart the server:

$ ./ts-cli
openGemini CLI 0.1.0 (rev-revision)
Please use `quit`, `exit` or `Ctrl-D` to exit this program.
> show databases
name: databases
+------+
| name |
+------+
+------+
1 columns, 0 rows in set

> create database db0 tag attribute array
> use db0
> insert cpu,tk1=value1,tk2=[value2,value22,value222],tk3=[value3,value33,value333] value=2 1670491329000000000
ERR: error parsing query: syntax error: unexpected IDENT

note it says "error parsing query", that's should happen before it checks db0 attributes.

@xiangyu5632
Copy link
Member

@supercz please check it, Why is there a grammar error?

@xiangyu5632
Copy link
Member

xiangyu5632 commented Feb 29, 2024

@localvar mmm, I found it!
use client influx work well, and ts-cli have not support this syntax.

@xiangyu5632 xiangyu5632 added the wait to close Problem Solved label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wait to close Problem Solved
Projects
None yet
Development

No branches or pull requests

3 participants