
'''simple docstring'''



import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


__A       =      100_000_000_000
__A       =      10_000

__A      ,    __A       =      os.path.split(__file__)
__A       =      os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))





def 	_A						(							lowercase__						,						lowercase__		):
						lowercase__								=    pa.Table.from_pydict({"""col""": [0] * chunk_size}		)
						lowercase__								=    pa.concat_tables([table] * (num_examples // chunk_size)		)
						return datasets.Dataset(lowercase__						,						fingerprint="""table_100B"""		)





@dataclass
class      A							:
			lowerCamelCase							:							int
			lowerCamelCase							:							int
			lowerCamelCase							:							int
			lowerCamelCase							:							int



			def A__	(   self    )     ->						int:




									'''simple docstring'''



									lowercase__								=    np.random.default_rng(self.seed    )
									lowercase__								=    rng.integers(low=self.low    ,       high=self.high    ,       size=self.size    ).tolist()



			def __iter__(   self    )     ->						List[str]:




									'''simple docstring'''



									return iter(self._sampled_values    )



			def __len__(   self    )     ->						List[str]:




									'''simple docstring'''



									return self.size





@get_duration
def 	_A						(							lowercase__		):
						lowercase__								=    dataset[0]





@get_duration
def 	_A						(							lowercase__		):
						lowercase__								=    dataset[-1]





@get_duration
def 	_A						(							lowercase__		):
						lowercase__								=    dataset[range(len(lowercase__		) // 2						,						len(lowercase__		) // 2 + 1024		)]





@get_duration
def 	_A						(							lowercase__		):
						lowercase__								=    dataset[RandIter(0						,						len(lowercase__		)						,						1024						,						seed=42		)]





def 	_A						(							):
						lowercase__								=    {"""num examples""": SPEED_TEST_N_EXAMPLES}
						lowercase__								=    (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
						print("""generating dataset"""		)
						lowercase__								=    generate_100B_dataset(num_examples=lowercase__						,						chunk_size=lowercase__		)
						print("""Functions"""		)
						for func in functions:
												print(func.__name__		)
												lowercase__								=    func(lowercase__		)

						with open(lowercase__						,						"""wb"""		) as f:
												f.write(json.dumps(lowercase__		).encode("""utf-8"""		)		)


if __name__ == "__main__":  # useful to run the profiler
				benchmark_table_100B()








'''simple docstring'''



def 	_A						(							lowercase__		):
						if not isinstance(lowercase__						,						lowercase__		):
												raise ValueError("""Input series is not valid, valid series - [1, 2/3, 2]"""		)
						if len(lowercase__		) == 0:
												raise ValueError("""Input list must be a non empty list"""		)
						if len(lowercase__		) == 1 and series[0] != 0:
												return True
						lowercase__								=    []
						lowercase__								=    len(lowercase__		)
						for i in range(0						,						lowercase__		):
												if series[i] == 0:
																		raise ValueError("""Input series cannot have 0 as an element"""		)
												rec_series.append(1 / series[i]		)
						lowercase__								=    rec_series[1] - rec_series[0]
						for index in range(2						,						lowercase__		):
												if rec_series[index] - rec_series[index - 1] != common_diff:
																		return False
						return True





def 	_A						(							lowercase__		):
						if not isinstance(lowercase__						,						lowercase__		):
												raise ValueError("""Input series is not valid, valid series - [2, 4, 6]"""		)
						if len(lowercase__		) == 0:
												raise ValueError("""Input list must be a non empty list"""		)
						lowercase__								=    0
						for val in series:
												answer += 1 / val
						return len(lowercase__		) / answer


if __name__ == "__main__":
				import doctest

				doctest.testmod()






