Open
Description
Compiled using cargo build --target-dir ../target --target=x86_64-unknown-linux-musl --workspace --release
from checkout of commit 6f3d6b1b7eaed72a51113ed504b34776e4758000
.
Create some line protocol:
$ cat > file.lp <<EOM
t0,t0_tag0=initTag t0_f0=0i 1715694000
t0,t0_tag0=initTag t0_f0=1i 1715694001
t0,t0_tag1=initTag t0_f0=0i 1715694000
EOM
In one terminal, start server with RUST_BACKTRACE=1 ./influxdb3 serve --object-store file --data-dir ./.influxdb3
.
In another terminal, write in the files:
$ ./influxdb3 write --dbname test -f ./file.lp
success
Do some queries:
# ok
$ ./influxdb3 query --lang influxql --dbname test "select * from t0"
+------------------+---------------------+-------+---------+---------+
| iox::measurement | time | t0_f0 | t0_tag0 | t0_tag1 |
+------------------+---------------------+-------+---------+---------+
| t0 | 2024-05-14T13:40:00 | 0 | initTag | |
| t0 | 2024-05-14T13:40:00 | 0 | | initTag |
| t0 | 2024-05-14T13:40:01 | 1 | initTag | |
+------------------+---------------------+-------+---------+---------+
# this parses via `influxql query --lang influxql`
$ ./influxdb3 query --lang influxql --dbname test "select * from t0 where (1 != 0) and (t0_tag0 != 'tag')"
+------------------+---------------------+-------+---------+---------+
| iox::measurement | time | t0_f0 | t0_tag0 | t0_tag1 |
+------------------+---------------------+-------+---------+---------+
| t0 | 2024-05-14T13:40:00 | 0 | initTag | |
| t0 | 2024-05-14T13:40:00 | 0 | | initTag |
| t0 | 2024-05-14T13:40:01 | 1 | initTag | |
+------------------+---------------------+-------+---------+---------+
# but doesn't via curl(!?)
$ curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -X POST "$URL/api/v3/query_influxql" --data-binary '{"format": "csv", "db": "test", "q": "select * from t0 where (1 != 0) and (t0_tag0 != 'tag')"}'
error in InfluxQL statement: parsing error: invalid conditional expression at pos 47
$
# should parse but doesn't
$ ./influxdb3 query --lang influxql --dbname test "select * from t0 where true & ((1 != 0) and (t0_tag0 != 'tag'))"
Query command failed: server responded with error [500 Internal Server Error]: error in InfluxQL statement: parsing error: invalid SQL statement at pos 28
# should parse but doesn't
$ ./influxdb3 query --lang influxql --dbname test "select * from t0 where ((2514049662u) ^ (((0) != (201203873)) OR (''))) ORDER BY DESC LIMIT 2147483647"
Query command failed: server responded with error [500 Internal Server Error]: error in InfluxQL statement: parsing error: invalid SQL statement at pos 0
# should parse but doesn't
$ ./influxdb3 query --lang influxql --dbname test "SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t1_tag0, t1_f0 ORDER BY DESC LIMIT 2147483647"
Query command failed: server responded with error [500 Internal Server Error]: error in InfluxQL statement: parsing error: invalid SQL statement at pos 0
# should parse but doesn't
$ ./influxdb3 query --lang influxql --dbname test "SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t0_tag0 ORDER BY DESC LIMIT 2147483647"
Query command failed: server responded with error [500 Internal Server Error]: error in InfluxQL statement: parsing error: invalid SQL statement at pos 0
Server output:
$ RUST_BACKTRACE=1 ./influxdb3 serve --object-store file --data-dir ./.influxdb3
2024-05-15T20:01:18.916440Z INFO influxdb3::commands::serve: InfluxDB3 Edge server starting git_hash=v2.5.0-14031-g6f3d6b1b7eaed72a51113ed504b34776e4758000 version=0.1.0 uuid=dfdb433f-b17f-4ebb-864f-101723463105 num_cpus=20 build_malloc_conf=
2024-05-15T20:01:18.916567Z INFO clap_blocks::object_store: Object Store db_dir="./.influxdb3" object_store_type="Directory"
2024-05-15T20:01:18.916736Z INFO influxdb3::commands::serve: Creating shared query executor num_threads=20
2024-05-15T20:01:28.380376Z INFO influxdb3_server::http: write_lp to test
2024-05-15T20:01:28.380428Z INFO influxdb3_write::catalog: return new db test
2024-05-15T20:01:28.380518Z INFO influxdb3_write::catalog: inserted/updated database in catalog: test
2024-05-15T20:01:28.390947Z INFO influxdb3_write::catalog: db_schema test
2024-05-15T20:01:33.898202Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=select * from t0 format=Pretty
2024-05-15T20:01:33.898313Z INFO influxdb3_server::query_executor: query in executor test
2024-05-15T20:01:33.898324Z INFO influxdb3_write::catalog: db_schema test
2024-05-15T20:01:33.898452Z INFO iox_query::query_log: query when="received" id=124f2fb9-e34c-4e91-abe4-171af4cb67a5 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 query_params=Params { } issue_time=2024-05-15T20:01:33.898450541+00:00 success=false running=true cancelled=false
2024-05-15T20:01:33.898504Z INFO influxdb3_server::query_executor: plan
2024-05-15T20:01:33.898596Z INFO influxdb3_server::query_executor: CatalogProvider schema iox
2024-05-15T20:01:33.901006Z INFO influxdb3_server::query_executor: TableProvider scan Some([0, 1, 2, 3]) [] None
2024-05-15T20:01:33.901051Z INFO influxdb3_write::catalog: db_schema test
2024-05-15T20:01:33.902453Z INFO iox_query::query_log: query when="planned" id=124f2fb9-e34c-4e91-abe4-171af4cb67a5 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 query_params=Params { } issue_time=2024-05-15T20:01:33.898450541+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.00399812 success=false running=true cancelled=false
2024-05-15T20:01:33.902500Z INFO iox_query::query_log: query when="permit" id=124f2fb9-e34c-4e91-abe4-171af4cb67a5 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 query_params=Params { } issue_time=2024-05-15T20:01:33.898450541+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.00399812 permit_duration_secs=5.0637e-5 success=false running=true cancelled=false
2024-05-15T20:01:33.902534Z INFO influxdb3_server::query_executor: execute_stream
2024-05-15T20:01:33.903112Z INFO iox_query::query_log: query when="success" id=124f2fb9-e34c-4e91-abe4-171af4cb67a5 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 query_params=Params { } issue_time=2024-05-15T20:01:33.898450541+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.00399812 permit_duration_secs=5.0637e-5 execute_duration_secs=0.000593098 end2end_duration_secs=0.004658183 compute_duration_secs=1.6008e-5 max_memory=0 success=true running=false cancelled=false
2024-05-15T20:01:39.371676Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=select * from t0 where (1 != 0) and (t0_tag0 != 'tag') format=Pretty
2024-05-15T20:01:39.371771Z INFO influxdb3_server::query_executor: query in executor test
2024-05-15T20:01:39.371782Z INFO influxdb3_write::catalog: db_schema test
2024-05-15T20:01:39.371870Z INFO iox_query::query_log: query when="received" id=926815aa-e6b2-47df-be13-776da7f360b1 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 WHERE (1 != 0) AND (t0_tag0 != 'tag') query_params=Params { } issue_time=2024-05-15T20:01:39.371868421+00:00 success=false running=true cancelled=false
2024-05-15T20:01:39.371903Z INFO influxdb3_server::query_executor: plan
2024-05-15T20:01:39.371930Z INFO influxdb3_server::query_executor: CatalogProvider schema iox
2024-05-15T20:01:39.375093Z INFO influxdb3_server::query_executor: TableProvider scan Some([0, 1, 2, 3]) [BinaryExpr(BinaryExpr { left: IsNull(Column(Column { relation: None, name: "t0_tag0" })), op: Or, right: BinaryExpr(BinaryExpr { left: Column(Column { relation: None, name: "t0_tag0" }), op: NotEq, right: Literal(Dictionary(Int32, Utf8("tag"))) }) })] None
2024-05-15T20:01:39.375150Z INFO influxdb3_write::catalog: db_schema test
2024-05-15T20:01:39.376651Z INFO iox_query::query_log: query when="planned" id=926815aa-e6b2-47df-be13-776da7f360b1 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 WHERE (1 != 0) AND (t0_tag0 != 'tag') query_params=Params { } issue_time=2024-05-15T20:01:39.371868421+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.004777015 success=false running=true cancelled=false
2024-05-15T20:01:39.376702Z INFO iox_query::query_log: query when="permit" id=926815aa-e6b2-47df-be13-776da7f360b1 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 WHERE (1 != 0) AND (t0_tag0 != 'tag') query_params=Params { } issue_time=2024-05-15T20:01:39.371868421+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.004777015 permit_duration_secs=5.547e-5 success=false running=true cancelled=false
2024-05-15T20:01:39.376732Z INFO influxdb3_server::query_executor: execute_stream
2024-05-15T20:01:39.377538Z INFO iox_query::query_log: query when="success" id=926815aa-e6b2-47df-be13-776da7f360b1 namespace_id=0 namespace_name="influxdb3 edge" query_type="sql" query_text=SELECT * FROM t0 WHERE (1 != 0) AND (t0_tag0 != 'tag') query_params=Params { } issue_time=2024-05-15T20:01:39.371868421+00:00 partitions=0 parquet_files=0 plan_duration_secs=0.004777015 permit_duration_secs=5.547e-5 execute_duration_secs=0.000804541 end2end_duration_secs=0.00566583 compute_duration_secs=0.000208102 max_memory=1610 success=true running=false cancelled=false
2024-05-15T20:01:46.153832Z INFO influxdb3_server::http: handling query_influxql database=Some("influxql1") query_str=select * from t0 where (1 != 0) and (t0_tag0 != tag) format=Csv
2024-05-15T20:01:46.153906Z ERROR influxdb3_server::http: Error while handling request error=error in InfluxQL statement: parsing error: invalid conditional expression at pos 47 method=POST uri=/api/v3/query_influxql content_length=Some("97")
2024-05-15T20:01:52.164010Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=select * from t0 where true & ((1 != 0) and (t0_tag0 != 'tag')) format=Pretty
2024-05-15T20:01:52.164060Z ERROR influxdb3_server::http: Error while handling request error=error in InfluxQL statement: parsing error: invalid SQL statement at pos 28 method=POST uri=/api/v3/query_influxql content_length=Some("115")
2024-05-15T20:01:59.452872Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=select * from t0 where ((2514049662u) ^ (((0) != (201203873)) OR (''))) ORDER BY DESC LIMIT 2147483647 format=Pretty
2024-05-15T20:01:59.452931Z ERROR influxdb3_server::http: Error while handling request error=error in InfluxQL statement: parsing error: invalid SQL statement at pos 0 method=POST uri=/api/v3/query_influxql content_length=Some("154")
2024-05-15T20:02:03.756691Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t1_tag0, t1_f0 ORDER BY DESC LIMIT 2147483647 format=Pretty
2024-05-15T20:02:03.756773Z ERROR influxdb3_server::http: Error while handling request error=error in InfluxQL statement: parsing error: invalid SQL statement at pos 0 method=POST uri=/api/v3/query_influxql content_length=Some("179")
2024-05-15T20:02:07.528114Z INFO influxdb3_server::http: handling query_influxql database=Some("test") query_str=SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t0_tag0 ORDER BY DESC LIMIT 2147483647 format=Pretty
2024-05-15T20:02:07.528172Z ERROR influxdb3_server::http: Error while handling request error=error in InfluxQL statement: parsing error: invalid SQL statement at pos 0 method=POST uri=/api/v3/query_influxql content_length=Some("172")
All of these parse fine and return the correct results in 1.x:
$ export V1AUTH=$(echo -n "anything:$TOKEN" | base64 --wrap 0)
# write
$ curl -H "Authorization: Basic $V1AUTH" -X POST "$URL/write?db=influxql1&precision=s" --data-binary @./file.lp
# queries
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql1&rp=autogen" --data-urlencode "q=select * from t0;"
t0,,1715694000000000000,0,initTag,
t0,,1715694000000000000,0,,initTag
t0,,1715694001000000000,1,initTag,
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql1&rp=autogen" --data-urlencode "q=select * from t0 where (1 != 0) and (t0_tag0 != 'tag')"
name,tags,time,t0_f0,t0_tag0,t0_tag1
t0,,1715694000000000000,0,initTag,
t0,,1715694000000000000,0,,initTag
t0,,1715694001000000000,1,initTag,
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql1&rp=autogen" --data-urlencode "q=select * from t0 where true & ((1 != 0) and (t0_tag0 != 'tag'))"
t0,,1715694000000000000,0,initTag,
t0,,1715694000000000000,0,,initTag
t0,,1715694001000000000,1,initTag,
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql2&rp=autogen" --data-urlencode "q=select * from t0 where ((2514049662u) ^ (((0) != (201203873)) OR (''))) ORDER BY DESC LIMIT 2147483647"
t0,,1715694001000000000,1,initTag,
t0,,1715694000000000000,0,,initTag
t0,,1715694000000000000,0,initTag,
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql2&rp=autogen" --data-urlencode "q=SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t1_tag0, t1_f0 ORDER BY DESC LIMIT 2147483647"
t0,,1715694001000000000,1,initTag,
t0,,1715694000000000000,0,,initTag
t0,,1715694000000000000,0,initTag,
$ curl -H "Authorization: Basic $V1AUTH" -H "Accept: application/csv" -X POST "$URL/query?db=influxql2&rp=autogen" --data-urlencode "q=SELECT * FROM t0 WHERE ((2514049662u) ^ (((0) != (201203873)) OR (''))) GROUP BY t0_tag0 ORDER BY DESC LIMIT 2147483647"
t0,t0_tag0=initTag,1715694001000000000,1,
t0,t0_tag0=initTag,1715694000000000000,0,
t0,,1715694000000000000,0,initTag
Interestingly, these parse fine:
$ ./influxdb3 query --lang influxql --dbname test "select * from t0 where (1) < (17693) ORDER BY ASC LIMIT 2147483647"
+------------------+---------------------+-------+---------+---------+
| iox::measurement | time | t0_f0 | t0_tag0 | t0_tag1 |
+------------------+---------------------+-------+---------+---------+
| t0 | 2024-05-14T13:40:00 | 0 | initTag | |
| t0 | 2024-05-14T13:40:00 | 0 | | initTag |
| t0 | 2024-05-14T13:40:01 | 1 | initTag | |
+------------------+---------------------+-------+---------+---------+
$ ./influxdb3 query --lang influxql --dbname test "select * from t0 where (t0_f0) < (17693) ORDER BY ASC LIMIT 2147483647"
+------------------+---------------------+-------+---------+---------+
| iox::measurement | time | t0_f0 | t0_tag0 | t0_tag1 |
+------------------+---------------------+-------+---------+---------+
| t0 | 2024-05-14T13:40:00 | 0 | initTag | |
| t0 | 2024-05-14T13:40:00 | 0 | | initTag |
| t0 | 2024-05-14T13:40:01 | 1 | initTag | |
+------------------+---------------------+-------+---------+---------+
But creating a new line protocol file that has unsigned integers does not:
# write
$ ./influxdb3 write --dbname test2 -f ./file2.lp
success
# ok
$ ./influxdb3 query --lang influxql --dbname test2 "select * from t0"
+------------------+---------------------+-------+---------+---------+
| iox::measurement | time | t0_f0 | t0_tag0 | t0_tag1 |
+------------------+---------------------+-------+---------+---------+
| t0 | 2024-05-14T13:40:00 | 0 | initTag | |
| t0 | 2024-05-14T13:40:00 | 0 | | initTag |
| t0 | 2024-05-14T13:40:01 | 1 | initTag | |
+------------------+---------------------+-------+---------+---------+
# unsigned integers in the query do not parse (changing 1u and 17693u to 1 and 17693 makes these work)
$ ./influxdb3 query --lang influxql --dbname test2 "select * from t0 where (1u) < (17693u) ORDER BY ASC LIMIT 2147483647"
Query command failed: server responded with error [500 Internal Server Error]: query error: error while planning query: Error during planning: invalid conditional expression at pos 33
$ ./influxdb3 query --lang influxql --dbname test2 "select * from t0 where (t0_f0) < (17693u) ORDER BY ASC LIMIT 2147483647"
Query command failed: server responded with error [500 Internal Server Error]: query error: error while planning query: Error during planning: invalid conditional expression at pos 32
2.7.6 is able to parse these (but gives wrong results, see #25011).