Skip to content

Commit d7076a8

Browse files
committed
CLN: Remove debugging code
1 parent 9d4d6ee commit d7076a8

4 files changed

Lines changed: 26 additions & 18 deletions

File tree

dataframe_sql/parsing/sql_parser.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,6 @@ def handle_non_token_non_tree(query_info: QueryInfo, token, token_pos):
12291229
# TODO Get rid of collecting this alias information since its part of the
12301230
# column object
12311231
if token.alias:
1232-
print(query_info.aliases)
12331232
query_info.aliases[token.name] = token.alias
12341233

12351234
if isinstance(token, Expression):
@@ -1409,7 +1408,6 @@ def handle_columns(
14091408
:param internal_transformer: Transformer to transform the where clauses
14101409
:return:
14111410
"""
1412-
print(columns)
14131411
where_value = None
14141412
where_plan = ":"
14151413
if where_expr is not None:
@@ -1444,7 +1442,6 @@ def handle_columns(
14441442
else:
14451443
final_names.append(column.name)
14461444

1447-
print(final_names)
14481445
if where_value is not None:
14491446
new_frame = first_frame.loc[where_value, column_names]
14501447
else:

dataframe_sql/sql_objects.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,21 +246,27 @@ def __repr__(self):
246246

247247
def __or__(self, other):
248248
if not isinstance(other, Value):
249-
raise Exception(f"Operator | is not supported between type {type(other)} "
250-
f"and type ValueWithPlan")
251-
252-
return ValueWithPlan(self.get_value() | other.get_value(),
253-
f"{self.get_plan_representation()} | "
254-
f"{other.get_plan_representation()}")
249+
raise Exception(
250+
f"Operator | is not supported between type {type(other)} "
251+
f"and type ValueWithPlan"
252+
)
253+
254+
return ValueWithPlan(
255+
self.get_value() | other.get_value(),
256+
f"{self.get_plan_representation()} | " f"{other.get_plan_representation()}",
257+
)
255258

256259
def __and__(self, other):
257260
if not isinstance(other, Value):
258-
raise Exception(f"Operator && is not supported between type {type(other)} "
259-
f"and type ValueWithPlan")
260-
261-
ValueWithPlan(self.get_value() & other.get_value(),
262-
f"{self.get_plan_representation()} & "
263-
f"{other.get_plan_representation()}")
261+
raise Exception(
262+
f"Operator && is not supported between type {type(other)} "
263+
f"and type ValueWithPlan"
264+
)
265+
266+
ValueWithPlan(
267+
self.get_value() & other.get_value(),
268+
f"{self.get_plan_representation()} & " f"{other.get_plan_representation()}",
269+
)
264270

265271
def get_plan_representation(self) -> str:
266272
return self.execution_plan

dataframe_sql/sql_select_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def __init__(self, sql: str, show_exececution_plan: bool = False):
123123
def parse_sql(self):
124124
try:
125125
tree = self.parser.parse(self.sql)
126-
print(tree.pretty())
127126

128127
table_info = TableInfo()
129128

dataframe_sql/tests/pandas_sql_functionality_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ def test_math_order_of_operations_with_parens():
14291429

14301430
tm.assert_frame_equal(pandas_frame, my_frame)
14311431

1432+
14321433
def test_boolean_order_of_operations_with_parens():
14331434
"""
14341435
Test boolean order of operations with parentheses
@@ -1440,13 +1441,18 @@ def test_boolean_order_of_operations_with_parens():
14401441
"(month = 'nov' and day = 'tue')"
14411442
)
14421443

1444+
pandas_frame = FOREST_FIRES.copy()
1445+
pandas_frame = pandas_frame[((pandas_frame['month'] == 'oct') &
1446+
(pandas_frame['day'] == 'fri')) |
1447+
((pandas_frame['month'] == 'nov') &
1448+
(pandas_frame['day'] == 'tue'))].reset_index(drop=True)
14431449

1444-
1450+
tm.assert_frame_equal(pandas_frame, my_frame)
14451451

14461452

14471453
if __name__ == "__main__":
14481454
register_env_tables()
14491455

1450-
test_right_joins()
1456+
test_boolean_order_of_operations_with_parens()
14511457

14521458
remove_env_tables()

0 commit comments

Comments
 (0)