File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed
Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,23 @@ class CategoricalColumnStatistics(TypedDict):
4343
4444
4545def _merge_histograms (hist : list [float ], bin_edges : list [float ]) -> Histogram :
46- _map = {}
47- for v , bin_edge in zip (hist , bin_edges ):
48- _map [bin_edge ] = _map .get (bin_edge , 0 ) + v
49-
5046 _restored_values = []
51- _bin_edges = sorted (_map .keys ())
52- for _value in _bin_edges :
53- h = _map [_value ]
54- _restored_values .extend ([_value ] * int (h ))
47+ for i in range (len (hist )):
48+ _min = bin_edges [i ]
49+ _max = bin_edges [i + 1 ]
50+ _count = hist [i ]
51+ if _count == 0 :
52+ continue
53+ elif _count == 1 :
54+ if i == len (hist ) - 1 :
55+ _restored_values .append (_max )
56+ else :
57+ _restored_values .append (_min )
58+ else :
59+ _restored_values .append (_min )
60+ _gap = (_max - _min ) / (_count - 1 )
61+ _restored_values .extend ([_min + j * _gap for j in range (1 , _count - 1 )])
62+ _restored_values .append (_max )
5563
5664 return get_outlier_aware_hist (_restored_values )
5765
Original file line number Diff line number Diff line change @@ -138,9 +138,11 @@ def get_dataset_preview(
138138 raise HTTPException (status_code = 404 , detail = "Dataset not found" )
139139
140140 if cache .exists (f"preview:{ preview_id } :error" ):
141+ error = cache .get (f"preview:{ preview_id } :error" ).decode ()
142+ cache .delete (f"preview:{ preview_id } :error" )
141143 raise HTTPException (
142144 status_code = 500 ,
143- detail = cache . get ( f"preview: { preview_id } : error" ). decode () ,
145+ detail = error ,
144146 )
145147
146148 if not cache .exists (f"preview:{ preview_id } " ):
You can’t perform that action at this time.
0 commit comments