Skip to content

Commit 80f95b2

Browse files
committed
More fixes for comments
1 parent 855080d commit 80f95b2

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

modin/core/storage_formats/pandas/query_compiler_caster.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class QueryCompilerCasterCalculator:
4545
"""
4646

4747
def __init__(self):
48-
self._caster_costing_map = {}
49-
self._data_cls_map = {}
48+
self._compiler_class_to_cost = {}
49+
self._compiler_class_to_data_class = {}
5050
self._qc_list = []
5151
self._qc_cls_set = set()
5252
self._result_type = None
@@ -66,7 +66,9 @@ def add_query_compiler(self, query_compiler: BaseQueryCompiler):
6666
# instance
6767
qc_type = type(query_compiler)
6868
self._qc_list.append(query_compiler)
69-
self._data_cls_map[qc_type] = type(query_compiler._modin_frame)
69+
self._compiler_class_to_data_class[qc_type] = type(
70+
query_compiler._modin_frame
71+
)
7072
self._qc_cls_set.add(qc_type)
7173

7274
def calculate(self):
@@ -91,11 +93,11 @@ def calculate(self):
9193
if cost is not None:
9294
self._add_cost_data({qc_cls_to: cost})
9395
self._add_cost_data({type(qc_from): QCCoercionCost.COST_ZERO})
94-
if len(self._caster_costing_map) <= 0 and len(self._qc_cls_list) > 0:
96+
if len(self._compiler_class_to_cost) <= 0 and len(self._qc_cls_list) > 0:
9597
self._result_type = self._qc_cls_list[0]
9698
return self._result_type
97-
min_value = min(self._caster_costing_map.values())
98-
for key, value in self._caster_costing_map.items():
99+
min_value = min(self._compiler_class_to_cost.values())
100+
for key, value in self._compiler_class_to_cost.items():
99101
if min_value == value:
100102
self._result_type = key
101103
break
@@ -115,9 +117,9 @@ def _add_cost_data(self, costs: dict):
115117
if k in self._qc_cls_set:
116118
QCCoercionCost.validate_coersion_cost(v)
117119
# Adds the costs associated with all coercions to a type, k
118-
self._caster_costing_map[k] = (
119-
v + self._caster_costing_map[k]
120-
if k in self._caster_costing_map
120+
self._compiler_class_to_cost[k] = (
121+
v + self._compiler_class_to_cost[k]
122+
if k in self._compiler_class_to_cost
121123
else v
122124
)
123125

@@ -131,7 +133,7 @@ def result_data_cls(self):
131133
DataFrame object associated with the preferred query compiler.
132134
"""
133135
qc_type = self.calculate()
134-
return self._data_cls_map[qc_type]
136+
return self._compiler_class_to_data_class[qc_type]
135137

136138

137139
class QueryCompilerCaster:

0 commit comments

Comments
 (0)