mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-18 22:10:42 +00:00
* change dep Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * feat: adapt to arrow's interval array * chore: fix compile errors in datatypes crate * chore: fix api crate compiler errors * chore: fix compiler errors in common-grpc * chore: fix common-datasource errors * chore: fix deprecated code in common-datasource * fix promql and physical plan related Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * wip: upgrading network deps Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * block on updating `sqlparser` * upgrade sqlparser Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * adapt new df's trait requirements Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * chore: fix compiler errors in mito2 * chore: fix common-function crate errors * chore: fix catalog errors * change import path Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * chore: fix some errors in query crate * chore: fix some errors in query crate * aggr expr and some other tiny fixes Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * chore: fix expr related errors in query crate * chore: fix query serializer and admin command * chore: fix grpc services * feat: axum serve * chore: fix http server * remove handle_error handler * refactor timeout layer * serve axum * chore: fix flow aggr functions * chore: fix flow * feat: fix errors in meta-srv * boxed() * use TokioIo * feat!: Remove script crate and python feature (#5321) * feat: exclude script crate * chore: simplify feature * feat: remove the script crate * chore: remove python feature and some comments * chore: fix warning * chore: fix servers tests compiler errors * feat: fix tests-integration errors * chore: fix unused * test: fix catalog test * chore: fix compiler errors for crates using common-meta testing feature is enabled when check with --workspace * test: use display for logical plan test * test: implement rewrite for ScanHintRule * fix: http server build panic * test: fix mito test * fix: sql parser type alias error * test: fix TestClient not listen * test: some flow tests * test(flow): more fix * fix: test_otlp_logs * test: fix promql test that using deprecated method fun() * fix: sql type replace supports Int8 ~ Int64, UInt8 ~ UInt64 * test: fix infer schema test case * test: fix tests related to plan display * chore: fix last flow test * test: fix function format related assertion * test: use larger port range for tests * fix: test_otlp_traces * fix: test_otlp_metrics * fix range query and dist plan Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix: flow handle distinct use deprecated field * fix: can't pass Join plan expressions to LogicalPlan::with_new_exprs * test: fix deserialize test * test: reduce split key case num * tests: lower case aggr func name * test: fix some sqlness tests * tests: more sqlness fix * tests: fixed sqlness test * commit non-bug changes Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix: make our udf correct * fix: implement empty methods of ContextProvider for DfContextProviderAdapter * test: update sqlness test result * chore: remove unused * fix: provide alias name for AggregateExprBuilder in range plan * test: update range query result * fix: implement missing ContextProvider methods for DfContextProviderAdapter * test: update timestamps, cte result * fix: supports empty projection in mito * test: update comment for cte test * fix: support projection for numbers * test: update test cases after projection fix * fix: fix range select first_value/last_value * fix: handle CAST and time index conflict * fix: handle order by correctly in range first_value/last_value * test: update sqlness result * test: update view test result * test: update decimal test wait for https://github.com/apache/datafusion/pull/14126 to fix this * feat: remove redundant physical optimization todo(ruihang): Check if we can remove this. * test: update sqlness test result * chore: range select default sort use nulls_first = false * test: update filter push down test result * test: comment deciaml test to avoid different panic message * test: update some distributed test result * test: update test for distributed count and filter push down * test: update subqueries test * fix: SessionState may overwrite our UDFs * chore: fix compiler errors after merging main * fix: fix elasticsearch and dashboard router panic * chore: fix common-functions tests * chore: update sqlness result * test: fix id keyword and update sqlness result * test: fix flow_null test * fix: enlarge thread size in debug mode to avoid overflow * chore: fix warnings in common-function * chore: fix warning in flow * chore: fix warnings in query crate * chore: remove unused warnings * chore: fix deprecated warnings for parquet * chore: fix deprecated warning in servers crate * style: fix clippy * test: enlarge mito cache tttl test ttl time * chore: fix typo * style: fmt toml * refactor: reimplement PartialOrd for RangeSelect * chore: remove script crate files introduced by merge * fix: return error if sql option is not kv * chore: do not use ..default::default() * chore: per review * chore: update error message in BuildAdminFunctionArgsSnafu Co-authored-by: jeremyhi <jiachun_feng@proton.me> * refactor: typed precision * update sqlness view case Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * chore: flow per review * chore: add example in comment * chore: warn if parquet stats of timestamp is not INT64 * style: add a newline before derive to make the comment more clear * test: update sqlness result * fix: flow from substrait * chore: change update_range_context log to debug level * chore: move axum-extra axum-macros to workspace --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: Ruihang Xia <waynestxia@gmail.com> Co-authored-by: luofucong <luofc@foxmail.com> Co-authored-by: discord9 <discord9@163.com> Co-authored-by: shuiyisong <xixing.sys@gmail.com> Co-authored-by: jeremyhi <jiachun_feng@proton.me>
220 lines
15 KiB
Plaintext
220 lines
15 KiB
Plaintext
CREATE TABLE test(i DOUBLE, j TIMESTAMP TIME INDEX, k STRING PRIMARY KEY);
|
|
|
|
Affected Rows: 0
|
|
|
|
-- insert two points at 1ms and one point at 2ms
|
|
INSERT INTO test VALUES (1, 1, "a"), (1, 1, "b"), (2, 2, "a");
|
|
|
|
Affected Rows: 3
|
|
|
|
-- explain at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
TQL EXPLAIN (0, 10, '5s') test;
|
|
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
| plan_type | plan |
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
| logical_plan | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivide: tags=["k"] |
|
|
| | MergeScan [is_placeholder=false] |
|
|
| physical_plan | PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivideExec: tags=["k"] |
|
|
| | SortPreservingMergeExec: [k@2 ASC NULLS LAST] |
|
|
| | SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true] |
|
|
| | MergeScanExec: REDACTED
|
|
| | |
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
|
|
-- 'lookback' parameter is not fully supported, the test has to be updated
|
|
-- explain at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
TQL EXPLAIN (0, 10, '1s', '2s') test;
|
|
|
|
+---------------+---------------------------------------------------------------------------------------------+
|
|
| plan_type | plan |
|
|
+---------------+---------------------------------------------------------------------------------------------+
|
|
| logical_plan | PromInstantManipulate: range=[0..0], lookback=[2000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivide: tags=["k"] |
|
|
| | MergeScan [is_placeholder=false] |
|
|
| physical_plan | PromInstantManipulateExec: range=[0..0], lookback=[2000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivideExec: tags=["k"] |
|
|
| | SortPreservingMergeExec: [k@2 ASC NULLS LAST] |
|
|
| | SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true] |
|
|
| | MergeScanExec: REDACTED
|
|
| | |
|
|
+---------------+---------------------------------------------------------------------------------------------+
|
|
|
|
-- explain at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
TQL EXPLAIN ('1970-01-01T00:00:00'::timestamp, '1970-01-01T00:00:00'::timestamp + '10 seconds'::interval, '5s') test;
|
|
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
| plan_type | plan |
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
| logical_plan | PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivide: tags=["k"] |
|
|
| | MergeScan [is_placeholder=false] |
|
|
| physical_plan | PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j] |
|
|
| | PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false] |
|
|
| | PromSeriesDivideExec: tags=["k"] |
|
|
| | SortPreservingMergeExec: [k@2 ASC NULLS LAST] |
|
|
| | SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true] |
|
|
| | MergeScanExec: REDACTED
|
|
| | |
|
|
+---------------+-----------------------------------------------------------------------------------------------+
|
|
|
|
-- explain verbose at 0s, 5s and 10s. No point at 0s.
|
|
-- SQLNESS REPLACE (-+) -
|
|
-- SQLNESS REPLACE (\s\s+) _
|
|
-- SQLNESS REPLACE (elapsed_compute.*) REDACTED
|
|
-- SQLNESS REPLACE (peers.*) REDACTED
|
|
-- SQLNESS REPLACE (RoundRobinBatch.*) REDACTED
|
|
TQL EXPLAIN VERBOSE (0, 10, '5s') test;
|
|
|
|
+-+-+
|
|
| plan_type_| plan_|
|
|
+-+-+
|
|
| initial_logical_plan_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivide: tags=["k"]_|
|
|
|_|_Sort: test.k DESC NULLS LAST, test.j DESC NULLS LAST_|
|
|
|_|_Filter: test.j >= TimestampMillisecond(-300000, None) AND test.j <= TimestampMillisecond(300000, None)_|
|
|
|_|_TableScan: test_|
|
|
| logical_plan after count_wildcard_to_time_index_rule_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after StringNormalizationRule_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after inline_table_scan_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after expand_wildcard_rule_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after resolve_grouping_function_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after type_coercion_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after DistPlannerAnalyzer_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivide: tags=["k"]_|
|
|
|_|_MergeScan [is_placeholder=false]_|
|
|
| analyzed_logical_plan_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_nested_union_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after simplify_expressions_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after unwrap_cast_in_comparison_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after replace_distinct_aggregate_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_join_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after decorrelate_predicate_subquery_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after scalar_subquery_to_join_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after extract_equijoin_predicate_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_duplicated_expr_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_filter_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_cross_join_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after common_sub_expression_eliminate_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_limit_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after propagate_empty_relation_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_one_union_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after filter_null_join_keys_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_outer_join_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after push_down_limit_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after push_down_filter_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after single_distinct_aggregation_to_group_by | SAME TEXT AS ABOVE_|
|
|
| logical_plan after simplify_expressions_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after unwrap_cast_in_comparison_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after common_sub_expression_eliminate_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after eliminate_group_by_constant_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after optimize_projections_| SAME TEXT AS ABOVE_|
|
|
| logical_plan after ScanHintRule_| SAME TEXT AS ABOVE_|
|
|
| logical_plan_| PromInstantManipulate: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalize: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivide: tags=["k"]_|
|
|
|_|_MergeScan [is_placeholder=false]_|
|
|
| initial_physical_plan_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| initial_physical_plan_with_stats_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j], statistics=[Rows=Inexact(0), Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]] |
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| initial_physical_plan_with_schema_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after parallelize_scan_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after OutputRequirements_| OutputRequirementExec_|
|
|
|_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after aggregate_statistics_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after join_selection_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after LimitedDistinctAggregation_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after EnforceDistribution_| OutputRequirementExec_|
|
|
|_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_CoalescePartitionsExec_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after CombinePartialFinalAggregate_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after EnforceSorting_| OutputRequirementExec_|
|
|
|_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_SortPreservingMergeExec: [k@2 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after OptimizeAggregateOrder_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after ProjectionPushdown_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after coalesce_batches_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after OutputRequirements_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_SortPreservingMergeExec: [k@2 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan after LimitAggregation_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after ProjectionPushdown_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after LimitPushdown_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after WindowedSortRule_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after RemoveDuplicateRule_| SAME TEXT AS ABOVE_|
|
|
| physical_plan after SanityCheckPlan_| SAME TEXT AS ABOVE_|
|
|
| physical_plan_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"]_|
|
|
|_|_SortPreservingMergeExec: [k@2 ASC NULLS LAST]_|
|
|
|_|_SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan_with_stats_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j], statistics=[Rows=Inexact(0), Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]] |
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_SortPreservingMergeExec: [k@2 ASC NULLS LAST], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true], statistics=[Rows=Absent, Bytes=Absent, [(Col[0]:),(Col[1]:),(Col[2]:)]]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
| physical_plan_with_schema_| PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[j], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [false], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_PromSeriesDivideExec: tags=["k"], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_SortPreservingMergeExec: [k@2 ASC NULLS LAST], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_SortExec: expr=[k@2 ASC NULLS LAST], preserve_partitioning=[true], schema=[i:Float64;N, j:Timestamp(Millisecond, None), k:Utf8;N]_|
|
|
|_|_MergeScanExec: REDACTED
|
|
|_|_|
|
|
+-+-+
|
|
|
|
DROP TABLE test;
|
|
|
|
Affected Rows: 0
|
|
|