You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by gi...@apache.org on 2026/09/24 19:28:22 UTC
(iceberg-python) 01/01: perf(table): import the expression parser lazily (#4012)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-4012-a46cbdf09a77bf893d05c3e49caf6b72b3c24d57
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
commit f7dcc3d92ccd87532f6332028e68b11b09446be3
Author: Kuldeep Yadav <ku...@gmail.com>
AuthorDate: Thu Sep 24 19:15:54 2026 +0000
perf(table): import the expression parser lazily (#4012)
Import the expression parser lazily in pyiceberg.table
The parser is only used by _parse_row_filter for string row filters,
but importing it at module level pulls in pyparsing (and unittest,
argparse and difflib through pyparsing.testing) on every
`import pyiceberg.table` and `load_catalog`.
---
pyiceberg/table/__init__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pyiceberg/table/__init__.py b/pyiceberg/table/__init__.py
index 0caba0e5d..2c5c26800 100644
--- a/pyiceberg/table/__init__.py
+++ b/pyiceberg/table/__init__.py
@@ -33,7 +33,6 @@ from typing import TYPE_CHECKING, Any, TypeVar
from pydantic import Field
-import pyiceberg.expressions.parser as parser
from pyiceberg.exceptions import CommitFailedException, ValidationException
from pyiceberg.expressions import AlwaysFalse, AlwaysTrue, And, BooleanExpression, EqualTo, IsNull, Or, Reference
from pyiceberg.expressions.visitors import (
@@ -2042,6 +2041,8 @@ def _parse_row_filter(expr: str | BooleanExpression) -> BooleanExpression:
Returns: An unbound BooleanExpression.
"""
+ from pyiceberg.expressions import parser
+
return parser.parse(expr) if isinstance(expr, str) else expr