timsaucer commented on code in PR #750: URL: https://github.com/apache/datafusion-python/pull/750#discussion_r1675856084
########## python/datafusion/substrait.py: ########## @@ -15,9 +15,156 @@ # specific language governing permissions and limitations # under the License. +from __future__ import annotations -from ._internal import substrait +from ._internal import substrait as substrait_internal +from typing import TYPE_CHECKING -def __getattr__(name): - return getattr(substrait, name) +if TYPE_CHECKING: + from datafusion.context import SessionContext + from datafusion._internal import LogicalPlan + + +class plan: + def __init__(self, plan: substrait_internal.plan) -> None: + self.plan_internal = plan + + def encode(self) -> bytes: + """Encode the plan to bytes. + + Returns + ------- + bytes + Encoded plan. + """ + return self.plan_internal.encode() + + +class serde: + @staticmethod + def serialize(sql: str, ctx: SessionContext, path: str) -> None: Review Comment: Updated to accept path. Not yet resolving this comment until unit test is added. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org