@@ -45,8 +45,8 @@ class QueryCompilerCasterCalculator:
45
45
"""
46
46
47
47
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 = {}
50
50
self ._qc_list = []
51
51
self ._qc_cls_set = set ()
52
52
self ._result_type = None
@@ -66,7 +66,9 @@ def add_query_compiler(self, query_compiler: BaseQueryCompiler):
66
66
# instance
67
67
qc_type = type (query_compiler )
68
68
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
+ )
70
72
self ._qc_cls_set .add (qc_type )
71
73
72
74
def calculate (self ):
@@ -91,11 +93,11 @@ def calculate(self):
91
93
if cost is not None :
92
94
self ._add_cost_data ({qc_cls_to : cost })
93
95
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 :
95
97
self ._result_type = self ._qc_cls_list [0 ]
96
98
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 ():
99
101
if min_value == value :
100
102
self ._result_type = key
101
103
break
@@ -115,9 +117,9 @@ def _add_cost_data(self, costs: dict):
115
117
if k in self ._qc_cls_set :
116
118
QCCoercionCost .validate_coersion_cost (v )
117
119
# 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
121
123
else v
122
124
)
123
125
@@ -131,7 +133,7 @@ def result_data_cls(self):
131
133
DataFrame object associated with the preferred query compiler.
132
134
"""
133
135
qc_type = self .calculate ()
134
- return self ._data_cls_map [qc_type ]
136
+ return self ._compiler_class_to_data_class [qc_type ]
135
137
136
138
137
139
class QueryCompilerCaster :
0 commit comments