Skip to content

Misleading/invalid documentation on SessionContext::sql and SessionConfig::create_logical_plan #7272

Closed

Description

@UlfarErl

The comments for these two functions refer to each other, and the comment for SessionContext::sql indicates that create_logical_plan can be used to avoid DDL / DML statements etc. However, create_logical_plan doesn't restrict such statements (in particular, it is used by SessionContext::sql itself).

https://github.com/apache/arrow-datafusion/blob/00627785718d9d98998021bf44585f32c33af3ea/datafusion/core/src/execution/context.rs#L351C11-L351C11
https://github.com/apache/arrow-datafusion/blob/00627785718d9d98998021bf44585f32c33af3ea/datafusion/core/src/execution/context.rs#L1777

Activity

  1. UlfarErl commented on Aug 12, 2023

    @UlfarErl
    Author

    @alamb I spotted this when looking for a read-only LogicalPlan interface, just like the one you were aiming for in issue #4720 (and your PR #4721). Those were closed without any apparent plan for such an interface. It would be great to document (even if planned for the future).

  2. alamb commented on Aug 13, 2023

    @alamb
    Contributor

    Thanks @UlfarErl -- I agree the comments and API could be improved -- I'll try and improve them this week

    The key for "read only" is to not call SessionContext::execute_logical_plan -- so do

    SessionContext::create_logical_plan

    And then

    session_context.state().create_physical_plan
    

    I agree this is not clear from the docs.

  3. self-assigned this
    on Aug 13, 2023
  4. alamb commented on Aug 18, 2023

    @alamb
    Contributor

    Hi @UlfarErl -- I made a PR to update the documentation here #7327

    While working on it, it became clear the API is somewhat confusing (as you have already pointed out) #7328 -- PR to fix: #7333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions