fix: skip schema check to avoid schema mismatch brought by metadata (#5662)

* fix: skip schema check to avoid schema mismatch brought by metadata

* docs: add some comment to remind me add that check back

* test: add sqlness case

* fix/skip-schema-check:
 ### Update CTE Test Cases

 - **Added GRPC Latencies Test**: Introduced a new test case for GRPC latencies in `cte.result` and `cte.sql` under `standalone/common/cte`.
 - **Removed Redundant Test Files**: Deleted `cte.result` and `cte.sql` under `standalone/common/range` as they were duplicates of the new test case.
This commit is contained in:
Lei, HUANG
2025-03-07 13:47:45 +08:00
committed by GitHub
parent 448e588fa7
commit 56c8c0651f
3 changed files with 75 additions and 1 deletions

View File

@@ -90,7 +90,15 @@ impl QueryEngineState {
plugins: Plugins,
) -> Self {
let runtime_env = Arc::new(RuntimeEnv::default());
let session_config = SessionConfig::new().with_create_default_catalog_and_schema(false);
let mut session_config = SessionConfig::new().with_create_default_catalog_and_schema(false);
// todo(hl): This serves as a workaround for https://github.com/GreptimeTeam/greptimedb/issues/5659
// and we can add that check back once we upgrade datafusion.
session_config
.options_mut()
.execution
.skip_physical_aggregate_schema_check = true;
// Apply extension rules
let mut extension_rules = Vec::new();

View File

@@ -130,3 +130,42 @@ drop table a;
Affected Rows: 0
CREATE TABLE grpc_latencies
(
ts TIMESTAMP TIME INDEX,
host VARCHAR(255),
latency FLOAT,
PRIMARY KEY (host),
);
Affected Rows: 0
INSERT INTO grpc_latencies
VALUES ('2023-10-01 10:00:00', 'host1', 120),
('2023-10-01 10:00:00', 'host2', 150),
('2023-10-01 10:00:05', 'host1', 130);
Affected Rows: 3
WITH latencies AS (SELECT ts,
host,
AVG(latency) RANGE '2s' AS avg_latency
FROM grpc_latencies ALIGN '2s' BY (host) FILL PREV
)
SELECT latencies.ts,
AVG(latencies.avg_latency)
FROM latencies
GROUP BY latencies.ts ORDER BY latencies.ts;
+---------------------+----------------------------+
| ts | avg(latencies.avg_latency) |
+---------------------+----------------------------+
| 2023-10-01T10:00:00 | 135.0 |
| 2023-10-01T10:00:02 | 120.0 |
| 2023-10-01T10:00:04 | 130.0 |
+---------------------+----------------------------+
DROP TABLE grpc_latencies;
Affected Rows: 0

View File

@@ -49,3 +49,30 @@ from cte
where alias2 > 0;
drop table a;
CREATE TABLE grpc_latencies
(
ts TIMESTAMP TIME INDEX,
host VARCHAR(255),
latency FLOAT,
PRIMARY KEY (host),
);
INSERT INTO grpc_latencies
VALUES ('2023-10-01 10:00:00', 'host1', 120),
('2023-10-01 10:00:00', 'host2', 150),
('2023-10-01 10:00:05', 'host1', 130);
WITH latencies AS (SELECT ts,
host,
AVG(latency) RANGE '2s' AS avg_latency
FROM grpc_latencies ALIGN '2s' BY (host) FILL PREV
)
SELECT latencies.ts,
AVG(latencies.avg_latency)
FROM latencies
GROUP BY latencies.ts ORDER BY latencies.ts;
DROP TABLE grpc_latencies;