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

[BUG][cnosdb fdw] Using opengauss to query cnosdb fails when the tag is empty #2077

Open
Benxiaohai001 opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
type/bug Something isn't working

Comments

@Benxiaohai001
Copy link
Member

Describe the bug

Using opengauss to query cnosdb fails when the tag is empty

To Reproduce

cnosdb-cli

public ❯ CREATE TABLE air (visibility DOUBLE,temperature DOUBLE,pressure DOUBLE,TAGS(station));
Query took 0.002 seconds.

gsql

openGauss=# create foreign table air (time timestamp, visibility FLOAT8,temperature FLOAT8,pressure FLOAT8) server cnosdb_server options (tenant 'cnosdb', database 'public');
CREATE FOREIGN TABLE
openGauss=# INSERT INTO air (TIME, visibility, temperature, pressure) VALUES (now(), 56, 69, 411);
INSERT 0 1
openGauss=# INSERT INTO air (TIME, pressure) VALUES (now(),  411);
INSERT 0 1
openGauss=# select * from air;
ERROR:  Fail to request remote server: sql: SELECT time, visibility, temperature, pressure FROM public.air, reason: parse value error: ParseFloat

Expected behavior

No response

Additional context

No response

@Benxiaohai001 Benxiaohai001 added the type/bug Something isn't working label Apr 19, 2024
@Benxiaohai001
Copy link
Member Author

The same problem exists with the missing time column

openGauss=# select * from air;
ERROR:  Fail to request remote server: sql: SELECT station, visibility, temperature, pressure FROM public.air, reason: parse value error: ParseFloat

@Benxiaohai001
Copy link
Member Author

Null value problem solved

openGauss=# create foreign table air (time timestamp, visibility FLOAT8,temperature FLOAT8,pressure FLOAT8) server cnosdb_server options (tenant 'cnosdb', database 'public');
CREATE FOREIGN TABLE
openGauss=# INSERT INTO air (TIME, visibility, temperature, pressure) VALUES (now(), 56, 69, 411);
INSERT 0 1
openGauss=# INSERT INTO air (TIME, pressure) VALUES (now(),  411);
INSERT 0 1
openGauss=# select * from air;
            time            | visibility | temperature | pressure
----------------------------+------------+-------------+----------
 1970-01-01 00:00:00        |            |             |      411
 2024-04-19 16:30:38.119865 |         56 |          69 |      411
 2024-04-19 16:31:20.45643  |            |             |      411
 2024-04-22 11:31:42.164608 |         56 |          69 |      411
 2024-04-22 11:32:14.243136 |            |             |      411
 2024-04-19 16:23:20.916574 |         56 |          69 |      411
(6 rows)

openGauss=# drop foreign table air;
DROP FOREIGN TABLE
openGauss=# create foreign table air ( visibility FLOAT8,temperature FLOAT8,pressure FLOAT8) server cnosdb_server options (tenant 'cnosdb', database 'public');
CREATE FOREIGN TABLE
openGauss=# select * from air;
 visibility | temperature | pressure
------------+-------------+----------
            |             |      411
         56 |          69 |      411
            |             |      411
         56 |          69 |      411
            |             |      411
         56 |          69 |      411
(6 rows)

openGauss=# drop foreign table air;
DROP FOREIGN TABLE
openGauss=# create foreign table air ( time timestamp) server cnosdb_server options (tenant 'cnosdb', database 'public');
CREATE FOREIGN TABLE
openGauss=# select * from air;
            time
----------------------------
 1970-01-01 00:00:00
 2024-04-19 16:30:38.119865
 2024-04-19 16:31:20.45643
 2024-04-22 11:31:42.164608
 2024-04-22 11:32:14.243136
 2024-04-19 16:23:20.916574
(6 rows)

openGauss=#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants