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

refactor: replace DfLogicalPlan with datafusion_expr::LogicalPlan #4384

Closed
wants to merge 10 commits into from

Conversation

sunheyi6
Copy link

@sunheyi6 sunheyi6 commented Jul 18, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

as title, part of #3884

What's changed and what's your intention?

As the title said.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

Summary by CodeRabbit

  • Refactor
    • Updated module imports to use datafusion_expr::LogicalPlan for improved code maintainability.

@sunheyi6 sunheyi6 requested a review from evenyag as a code owner July 18, 2024 01:06
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jul 18, 2024
Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes primarily involve updating the import paths for the LogicalPlan from query::plan to datafusion_expr. This update affects several files, including repl.rs, transform.rs, and copy_table_to.rs, signifying a shift in module structure or dependencies to use the datafusion_expr crate.

Changes

File Path Summary of Changes
src/cmd/src/cli/repl.rs Updated LogicalPlan import from datafusion_expr and adjusted its usage.
src/flow/src/transform.rs Updated LogicalPlan import from datafusion_expr and modified references.
src/operator/src/statement/... Updated LogicalPlan import from datafusion_expr and modified its usage.

Poem

In the land of code, where data flows,
A shift in plans, the import shows.
From query::plan to datafusion_expr,
Our logical paths now freshly confer.
With every change, the system grows,
As bunnies cheer, the progress glows. 🌟🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e39f49f and 1ff724d.

Files selected for processing (1)
  • src/query/src/plan.rs (5 hunks)
Additional comments not posted (7)
src/query/src/plan.rs (7)

48-52: LGTM!

The schema function has been correctly refactored to take plan: &DfLogicalPlan as a parameter. The error handling is appropriate.


63-63: LGTM!

The display_indent function has been correctly refactored to take plan: &DfLogicalPlan as a parameter.


Line range hint 69-75:
LGTM!

The get_param_types function has been correctly refactored to take plan: &DfLogicalPlan as a parameter. The error handling and conversion logic are appropriate.


81-90: LGTM!

The replace_params_with_values function has been correctly refactored to take plan: &DfLogicalPlan and values: &[ScalarValue] as parameters. The error handling and logic to replace parameters are appropriate.


94-98: LGTM!

The unwrap_df_plan function has been correctly refactored to take plan: &LogicalPlan as a parameter. The error handling using a panic statement is appropriate.


103-107: LGTM!

The df_plan function has been correctly refactored to take plan: &LogicalPlan as a parameter. The error handling using a panic statement is appropriate.


Line range hint 206-212:
LGTM!

The extract_and_rewrite_full_table_names function's visibility has been correctly changed from pub to private. The logic to extract and rewrite table names is appropriate.

@evenyag
Copy link
Contributor

evenyag commented Jul 18, 2024

Thanks for submitting the PR. To remove the wrapper type, we also need to remove the definition of our LogicalPlan and use Datafusion's LogicalPlan directly.

#[derive(Clone, Debug)]
pub enum LogicalPlan {
    DfPlan(DfLogicalPlan),
}

You can refer to #3995 which removes the wrapper type for Expr.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1ff724d and 7c88eef.

Files selected for processing (1)
  • src/query/src/plan.rs (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/query/src/plan.rs

@sunheyi6 sunheyi6 requested review from zhongzc, waynexia and a team as code owners July 18, 2024 08:01
@sunheyi6 sunheyi6 changed the title refactor: LogicalPlan refactor: replace DfLogicalPlan with datafusion_expr::LogicalPlan Jul 18, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
tests-integration/src/instance.rs (1)

236-236: Update required: Instances of LogicalPlan::DfPlan found.

The following files still contain instances of the old usage pattern LogicalPlan::DfPlan and need to be updated to the new usage of LogicalPlan:

  • src/query/src/datafusion.rs
  • src/query/src/plan.rs
  • src/query/src/planner.rs
  • src/query/src/tests/query_engine_test.rs
  • src/servers/src/prom_store.rs
  • src/pipeline/src/manager/table.rs

Please ensure these instances are updated for consistency.

Analysis chain

Variable assignment change approved.

The variable assignment for LogicalPlan has been updated to use LogicalPlan directly, aligning with the refactoring objectives.

However, ensure that all variable assignments to LogicalPlan are correctly updated across the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all variable assignments to `LogicalPlan` are correctly updated.

# Test: Search for the variable assignments. Expect: Only occurrences of the new usage.
rg --type rust -A 5 $'let LogicalPlan'

Length of output: 4349


Script:

#!/bin/bash
# Description: Verify that all instances of the old usage pattern `LogicalPlan::DfPlan` have been updated.

# Test: Search for the old usage pattern. Expect: No occurrences.
rg --type rust 'LogicalPlan::DfPlan'

Length of output: 924

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7c88eef and f9a417c.

Files selected for processing (23)
  • src/cmd/src/cli/repl.rs (2 hunks)
  • src/datanode/src/tests.rs (1 hunks)
  • src/flow/src/transform.rs (4 hunks)
  • src/frontend/src/instance.rs (1 hunks)
  • src/operator/src/statement.rs (1 hunks)
  • src/operator/src/statement/copy_table_to.rs (2 hunks)
  • src/operator/src/statement/tql.rs (1 hunks)
  • src/pipeline/src/manager/table.rs (2 hunks)
  • src/query/src/range_select/plan_rewrite.rs (2 hunks)
  • src/script/src/table.rs (3 hunks)
  • src/servers/src/http.rs (1 hunks)
  • src/servers/src/interceptor.rs (1 hunks)
  • src/servers/src/lib.rs (1 hunks)
  • src/servers/src/mysql/handler.rs (1 hunks)
  • src/servers/src/postgres/types.rs (1 hunks)
  • src/servers/src/prom_store.rs (1 hunks)
  • src/servers/src/query_handler/sql.rs (1 hunks)
  • src/servers/tests/http/influxdb_test.rs (1 hunks)
  • src/servers/tests/http/opentsdb_test.rs (1 hunks)
  • src/servers/tests/http/prom_store_test.rs (1 hunks)
  • src/servers/tests/mod.rs (1 hunks)
  • tests-integration/src/grpc.rs (2 hunks)
  • tests-integration/src/instance.rs (2 hunks)
Additional comments not posted (30)
src/servers/src/lib.rs (1)

21-21: LGTM! Verify the correctness of the new import.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan. Ensure that this change is consistent with the rest of the codebase.

Verification successful

The new import statement for LogicalPlan is consistent across the codebase.

  • All instances of LogicalPlan are imported from datafusion_expr.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import for LogicalPlan.

# Test: Search for the usage of LogicalPlan. Expect: Only occurances of datafusion_expr::LogicalPlan.
rg --type rust -A 5 $'LogicalPlan'

Length of output: 188344

src/servers/src/query_handler/sql.rs (1)

21-21: LGTM! Verify the correctness of the new import.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan. Ensure that this change is consistent with the rest of the codebase.

Verification successful

The new import statement is correct and consistent with the rest of the codebase.

The import statement use datafusion_expr::LogicalPlan; is used consistently across the codebase, and no conflicting imports or usage of LogicalPlan from different modules were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import for LogicalPlan.

# Test: Search for the usage of LogicalPlan. Expect: Only occurances of datafusion_expr::LogicalPlan.
rg --type rust -A 5 $'LogicalPlan'

Length of output: 188344

src/operator/src/statement/tql.rs (1)

23-23: LGTM! Verify the correctness of the new import.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan. Ensure that this change is consistent with the rest of the codebase.

Verification successful

The new import statement for LogicalPlan is correct and consistent throughout the codebase.

  • All instances of LogicalPlan are using datafusion_expr::LogicalPlan.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import for LogicalPlan.

# Test: Search for the usage of LogicalPlan. Expect: Only occurances of datafusion_expr::LogicalPlan.
rg --type rust -A 5 $'LogicalPlan'

Length of output: 188344

src/operator/src/statement/copy_table_to.rs (2)

32-32: LGTM! Verify the correctness of the new import.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan. Ensure that this change is consistent with the rest of the codebase.

Verification successful

The new import statement for LogicalPlan is consistent across the codebase.

The import statement use datafusion_expr::LogicalPlan; is correctly used in all relevant instances.

  • Verified in multiple files with no conflicting imports.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import for LogicalPlan.

# Test: Search for the usage of LogicalPlan. Expect: Only occurances of datafusion_expr::LogicalPlan.
rg --type rust -A 5 $'LogicalPlan'

Length of output: 188344


132-132: Verify the correctness of the execute method call.

The execute method call has been updated to use LogicalPlan directly. Ensure that this change is correct and consistent with the rest of the codebase.

Verification successful

Verify the correctness of the execute method call.

The execute method with the signature execute(&self, plan: LogicalPlan, query_ctx: QueryContextRef) -> Result<Output> is correctly defined in the src/query/src/query_engine.rs and src/query/src/datafusion.rs files. The method call in the review comment aligns with these definitions, ensuring that the parameters LogicalPlan and query_ctx are correctly used.

  • Files with relevant execute method definitions:
    • src/query/src/query_engine.rs
    • src/query/src/datafusion.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the `execute` method call.

# Test: Search for the usage of the execute method. Expect: Only occurances of the new method call.
rg --type rust -A 5 $'execute'

Length of output: 299676


Script:

#!/bin/bash
# Locate the definition of the `execute` method to understand its parameters.
ast-grep --lang rust --pattern 'fn execute($_, $_) -> $_ { $$$ }'

Length of output: 13127


Script:

#!/bin/bash
# Refine the search to locate the `execute` method with `LogicalPlan` and `QueryContextRef` parameters.
ast-grep --lang rust --pattern 'fn execute(&self, plan: LogicalPlan, query_ctx: QueryContextRef) -> Result<Output> { $$$ }'

Length of output: 125


Script:

#!/bin/bash
# Broaden the search to locate the `execute` method with LogicalPlan and query_ctx in the context of query engines.
rg --type rust -A 5 'fn execute' | grep -C 5 'LogicalPlan'

Length of output: 2725

src/datanode/src/tests.rs (1)

28-28: Update import statement to use datafusion_expr::LogicalPlan.

The import statement has been updated to use LogicalPlan from datafusion_expr instead of query::plan. Ensure that this change is consistent with the rest of the codebase and that all references to LogicalPlan are correctly updated.

src/servers/tests/http/prom_store_test.rs (1)

28-28: Update import statement to use datafusion_expr::LogicalPlan.

The import statement has been updated to use LogicalPlan from datafusion_expr instead of query::plan. Ensure that this change is consistent with the rest of the codebase and that all references to LogicalPlan are correctly updated.

src/servers/tests/http/opentsdb_test.rs (1)

23-23: Update import statement to use datafusion_expr::LogicalPlan.

The import statement has been updated to use LogicalPlan from datafusion_expr instead of query::plan. Ensure that this change is consistent with the rest of the codebase and that all references to LogicalPlan are correctly updated.

src/servers/tests/mod.rs (1)

25-25: Update import statement to use datafusion_expr::LogicalPlan.

The import statement has been updated to use LogicalPlan from datafusion_expr instead of query::plan. Ensure that this change is consistent with the rest of the codebase and that all references to LogicalPlan are correctly updated.

src/cmd/src/cli/repl.rs (2)

39-39: LGTM!

The import statement change aligns with the PR objective.


183-183: LGTM! But verify the function usage in the codebase.

The code change is syntactically correct and aligns with the new import.

However, ensure that all function calls to LogicalPlan match the new usage.

src/servers/src/interceptor.rs (1)

25-25: LGTM!

The import statement change aligns with the PR objective.

src/flow/src/transform.rs (3)

26-26: LGTM!

The import statement change aligns with the PR objective.


137-137: LGTM! But verify the function usage in the codebase.

The code change is syntactically correct and aligns with the new import.

However, ensure that all function calls to LogicalPlan match the new usage.


204-204: LGTM! But verify the function usage in the codebase.

The code change is syntactically correct and aligns with the new import.

However, ensure that all function calls to LogicalPlan match the new usage.

Verification successful

Verification Successful: LogicalPlan Usage

The LogicalPlan usage is consistent with the new import from datafusion_expr across the codebase.

  • tests-integration/src/instance.rs
  • tests-integration/src/grpc.rs
  • src/query/src/dist_plan.rs
  • src/query/src/optimizer.rs
  • src/query/src/datafusion.rs
  • src/query/src/sql.rs
  • src/query/src/tests/query_engine_test.rs
  • src/query/src/range_select/planner.rs
  • src/query/src/range_select/plan_rewrite.rs
  • src/query/src/query_engine.rs
  • src/query/src/query_engine/state.rs
  • src/query/src/query_engine/context.rs
  • src/query/src/planner.rs
  • src/query/src/query_engine/default_serializer.rs
  • src/script/src/table.rs
  • src/query/src/promql/planner.rs
  • src/query/src/plan.rs
  • src/query/src/optimizer/type_conversion.rs
  • src/query/src/optimizer/order_hint.rs
  • src/query/src/logical_optimizer.rs
  • src/query/src/optimizer/count_wildcard.rs
  • src/query/src/range_select/plan.rs
  • src/query/src/dist_plan/merge_scan.rs
  • src/query/src/dist_plan/commutativity.rs
  • src/query/src/dist_plan/analyzer.rs
  • src/query/src/dist_plan/planner.rs
  • src/query/src/optimizer/string_normalization.rs
  • src/query/src/physical_planner.rs
  • src/servers/src/lib.rs
  • src/servers/tests/mod.rs
  • src/servers/src/prom_store.rs
  • src/servers/src/query_handler/sql.rs
  • src/servers/src/postgres/types.rs
  • src/servers/src/interceptor.rs
  • src/servers/tests/http/prom_store_test.rs
  • src/servers/tests/http/opentsdb_test.rs
  • src/servers/src/mysql/handler.rs
  • src/servers/src/http.rs
  • src/servers/tests/http/influxdb_test.rs
  • src/operator/src/error.rs
  • src/operator/src/statement.rs
  • src/operator/src/statement/copy_table_to.rs
  • src/operator/src/statement/ddl.rs
  • src/operator/src/statement/tql.rs
  • src/promql/src/extension_plan/instant_manipulate.rs
  • src/promql/src/extension_plan/series_divide.rs
  • src/promql/src/extension_plan/planner.rs
  • src/promql/src/extension_plan/empty_metric.rs
  • src/promql/src/extension_plan/scalar_calculate.rs
  • src/promql/src/extension_plan/normalize.rs
  • src/promql/src/extension_plan/range_manipulate.rs
  • src/operator/src/statement/copy_table_to.rs
  • src/operator/src/statement/ddl.rs
  • src/operator/src/statement/tql.rs
  • src/promql/src/extension_plan/union_distinct_on.rs
  • src/promql/src/extension_plan/histogram_fold.rs
  • src/pipeline/src/manager/table.rs
  • src/pipeline/src/manager/error.rs
  • src/flow/src/transform.rs
  • src/frontend/src/instance.rs
  • src/frontend/src/error.rs
  • src/frontend/src/instance/prom_store.rs
  • src/datanode/src/tests.rs
  • src/datanode/src/region_server.rs
  • src/datanode/src/error.rs
  • src/frontend/src/instance/grpc.rs
  • src/common/substrait/src/df_substrait.rs
  • src/catalog/src/table_source.rs
  • src/cmd/src/error.rs
  • src/common/query/src/test_util.rs
  • src/common/query/src/logical_plan.rs
  • src/cmd/src/cli/repl.rs
  • src/common/query/src/request.rs
  • src/common/meta/src/key/view_info.rs
  • src/client/src/database.rs
  • src/api/src/helper.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `LogicalPlan` match the new usage.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 $'LogicalPlan'

Length of output: 188344

src/servers/tests/http/influxdb_test.rs (1)

25-25: LGTM!

The import statement change aligns with the PR objective.

src/script/src/table.rs (2)

36-36: Import change approved.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan, aligning with the refactoring objectives.


227-227: Method call change approved.

The method calls to .execute() have been updated to use LogicalPlan directly, aligning with the refactoring objectives.

However, ensure that all function calls to execute with LogicalPlan are correctly updated across the codebase.

Also applies to: 282-282

Verification successful

Method call change approved.

The method calls to .execute() have been updated to use LogicalPlan directly, aligning with the refactoring objectives. The updates have been applied consistently across the codebase.

  • src/script/src/table.rs
  • src/pipeline/src/manager/table.rs
  • src/operator/src/statement/copy_table_to.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `execute` with `LogicalPlan` are correctly updated.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 $'.execute(LogicalPlan'

Length of output: 124


Script:

#!/bin/bash
# Description: Verify all function calls to `execute` with `LogicalPlan` are correctly updated.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 '\.execute\(LogicalPlan'

Length of output: 2023

tests-integration/src/instance.rs (1)

34-34: Import change approved.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan, aligning with the refactoring objectives.

src/pipeline/src/manager/table.rs (2)

37-37: Import change approved.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan, aligning with the refactoring objectives.


440-440: Method call change approved.

The method call to .execute() has been updated to use LogicalPlan directly, aligning with the refactoring objectives.

However, ensure that all function calls to execute with LogicalPlan are correctly updated across the codebase.

Verification successful

Method call change approved.

The method call to .execute() has been updated to use LogicalPlan directly, aligning with the refactoring objectives. All instances of this method call have been correctly updated across the codebase.

  • Verified files:
    • src/script/src/table.rs
    • src/pipeline/src/manager/table.rs
    • src/operator/src/statement/copy_table_to.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `execute` with `LogicalPlan` are correctly updated.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 $'.execute(LogicalPlan'

Length of output: 124


Script:

#!/bin/bash
# Description: Verify all function calls to `execute` with `LogicalPlan` are correctly updated.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 '.execute(LogicalPlan'

Length of output: 124


Script:

#!/bin/bash
# Description: Verify all function calls to `execute` with `LogicalPlan` are correctly updated.

# Test: Search for the function usage. Expect: Only occurrences of the new usage.
rg --type rust -A 5 '\.execute\(LogicalPlan'

Length of output: 2023

src/operator/src/statement.rs (1)

42-42: Import change approved.

The import statement for LogicalPlan has been updated to use datafusion_expr::LogicalPlan, aligning with the refactoring objectives.

src/frontend/src/instance.rs (1)

53-53: LGTM! The import statement change aligns with the PR objective.

The import statement for LogicalPlan has been updated to use Datafusion's LogicalPlan directly, which aligns with the refactoring goal.

src/servers/src/mysql/handler.rs (1)

35-35: LGTM! The import statement change aligns with the PR objective.

The import statement for LogicalPlan has been updated to use Datafusion's LogicalPlan directly, which aligns with the refactoring goal.

src/servers/src/prom_store.rs (1)

34-34: LGTM! The import statement change aligns with the PR objective.

The import statement for LogicalPlan has been updated to use Datafusion's LogicalPlan directly, which aligns with the refactoring goal.

tests-integration/src/grpc.rs (2)

36-36: Verify the correctness of the new import.

Ensure that the LogicalPlan from datafusion_expr is the correct import and that it is consistent with the rest of the codebase.

Verification successful

Verified the correctness of the new import.

The LogicalPlan from datafusion_expr is consistently used across the codebase, indicating that the new import is correct and aligned with the rest of the code.

  • tests-integration/src/instance.rs
  • tests-integration/src/grpc.rs
  • src/cmd/src/cli/repl.rs
  • src/servers/tests/mod.rs
  • src/script/src/table.rs
  • src/servers/tests/http/influxdb_test.rs
  • src/servers/tests/http/prom_store_test.rs
  • src/servers/tests/http/opentsdb_test.rs
  • src/servers/src/query_handler/sql.rs
  • src/servers/src/postgres/types.rs
  • src/servers/src/lib.rs
  • src/servers/src/interceptor.rs
  • src/servers/src/http.rs
  • src/servers/src/prom_store.rs
  • src/servers/src/mysql/handler.rs
  • src/query/src/plan.rs
  • src/query/src/optimizer.rs
  • src/query/src/query_engine/state.rs
  • src/query/src/range_select/plan_rewrite.rs
  • src/pipeline/src/manager/table.rs
  • src/operator/src/statement.rs
  • src/operator/src/statement/tql.rs
  • src/operator/src/statement/copy_table_to.rs
  • src/frontend/src/instance.rs
  • src/flow/src/transform.rs
  • src/datanode/src/tests.rs
  • src/common/substrait/src/df_substrait.rs
  • src/common/query/src/request.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import for `LogicalPlan`.

# Test: Search for the import statement. Expect: Only occurances of the new import.
rg --type rust -A 5 $'use datafusion_expr::LogicalPlan'

Length of output: 13047


542-542: Verify the correctness of the new way of accessing LogicalPlan.

Ensure that directly assigning LogicalPlan instead of pattern matching LogicalPlan::DfPlan(plan) is correct and does not introduce any issues.

src/servers/src/postgres/types.rs (1)

32-32: Import change approved.

The import statement change aligns with the PR objective of refactoring the LogicalPlan component to use Datafusion's LogicalPlan directly.

src/servers/src/http.rs (1)

960-960: Import change approved.

The import statement change aligns with the PR objective of refactoring the LogicalPlan component to use Datafusion's LogicalPlan directly.

src/query/src/range_select/plan_rewrite.rs (1)

621-621: Verify the correctness of the function with the new LogicalPlan.

The change from GreptimeLogicalPlan::DfPlan(plan) to let plan: LogicalPlan simplifies the pattern matching. Ensure that the function works correctly with the new LogicalPlan.

Verification successful

The function query_plan_compare works correctly with the new LogicalPlan.

The function query_plan_compare is used in multiple test cases within the file src/query/src/range_select/plan_rewrite.rs, covering a range of scenarios. This extensive usage demonstrates that the function operates correctly with the new LogicalPlan.

  • The function query_plan_compare is used in various test cases, ensuring its correctness.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the function `query_plan_compare` with the new `LogicalPlan`.

# Test: Search for the function usage. Expect: Correct usage of `LogicalPlan`.
rg --type rust -A 5 $'query_plan_compare'

Length of output: 13039

@killme2008
Copy link
Contributor

@sunheyi6 A conflict has to be resolved.

@sunheyi6
Copy link
Author

@sunheyi6 A conflict has to be resolved.

OK, I'll handle it right away.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f9a417c and e478eab.

Files selected for processing (3)
  • src/cmd/src/cli/repl.rs (2 hunks)
  • src/flow/src/transform.rs (4 hunks)
  • src/operator/src/statement/copy_table_to.rs (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/cmd/src/cli/repl.rs
  • src/flow/src/transform.rs
  • src/operator/src/statement/copy_table_to.rs

@evenyag
Copy link
Contributor

evenyag commented Jul 19, 2024

@sunheyi6
Copy link
Author

Please fix the compiler errors https://github.com/GreptimeTeam/greptimedb/actions/runs/10000323455/job/27646084014?pr=4384

ok,i will fix

@evenyag
Copy link
Contributor

evenyag commented Jul 19, 2024

https://github.com/GreptimeTeam/greptimedb/blob/main/CONTRIBUTING.md#before-pr
Please refer to the contributing guide to run all tests and the clippy check locally first. Also please make sure your code can compile.

@waynexia waynexia mentioned this pull request Sep 18, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants