Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyiceberg/expressions/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _(result: ParseResults) -> Reference:
return Reference(".".join(result.column))


boolean = one_of(["true", "false"], caseless=True).set_results_name("boolean")
boolean = one_of(["true", "false"], caseless=True)
string = sgl_quoted_string.set_results_name("raw_quoted_string")
decimal = common.real().set_results_name("decimal")
integer = common.signed_integer().set_results_name("integer")
Expand All @@ -115,7 +115,7 @@ def _(result: ParseResults) -> Reference:

@boolean.set_parse_action
def _(result: ParseResults) -> Literal[bool]:
if strtobool(result.boolean):
if strtobool(result[0]):
return BooleanLiteral(True)
else:
return BooleanLiteral(False)
Expand Down
35 changes: 35 additions & 0 deletions tests/expressions/test_pyparsing_warning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import importlib

import pyparsing as pp

import pyiceberg.expressions.parser as parser
import pyiceberg.table as table


def test_table_import_has_no_ungrouped_named_tokens_warning() -> None:
diagnostic = pp.Diagnostics.warn_ungrouped_named_tokens_in_collection
was_enabled = pp.__diag__.warn_ungrouped_named_tokens_in_collection

pp.enable_diag(diagnostic)
try:
importlib.reload(parser)
importlib.reload(table)
finally:
if not was_enabled:
pp.disable_diag(diagnostic)