
import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


a__		:   Tuple            =       1_0_0_0_0_0_0_0_0_0_0_0
a__		:   List[str]            =       1_0_0_0_0

a__		:   Optional[int]            =       os.path.split(__file__)
a__		:   Tuple            =       os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))





def        snake_case							(		UpperCAmelCase      ,  UpperCAmelCase	)->			datasets.Dataset:







      """simple docstring"""
      __A       	=			pa.Table.from_pydict({'col': [0] * chunk_size}	)
      __A       	=			pa.concat_tables([table] * (num_examples // chunk_size)	)
      return datasets.Dataset(UpperCAmelCase      ,  fingerprint='table_100B'	)


@dataclass
class  UpperCamelCase__  :
 UpperCAmelCase__    :    int
 UpperCAmelCase__    :    int
 UpperCAmelCase__    :    int
 UpperCAmelCase__    :    int






 def 	lowercase_						(			self  :Union[str, Any]			)				->			Union[str, Any]:







       '''simple docstring'''



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






 def __iter__(			self  :List[Any]			)				->			Dict:







       '''simple docstring'''



       return iter(self._sampled_values			)






 def __len__(			self  :Optional[int]			)				->			Union[str, Any]:







       '''simple docstring'''



       return self.size





@get_duration
def        snake_case							(		UpperCAmelCase	)->			Optional[int]:







      """simple docstring"""
      __A       	=			dataset[0]





@get_duration
def        snake_case							(		UpperCAmelCase	)->			Optional[Any]:







      """simple docstring"""
      __A       	=			dataset[-1]





@get_duration
def        snake_case							(		UpperCAmelCase	)->			str:







      """simple docstring"""
      __A       	=			dataset[range(len(UpperCAmelCase	) // 2      ,  len(UpperCAmelCase	) // 2 + 1_0_2_4	)]





@get_duration
def        snake_case							(		UpperCAmelCase	)->			Union[str, Any]:







      """simple docstring"""
      __A       	=			dataset[RandIter(0      ,  len(UpperCAmelCase	)      ,  1_0_2_4      ,  seed=4_2	)]





def        snake_case							(		)->			Tuple:







      """simple docstring"""
      __A       	=			{'num examples': SPEED_TEST_N_EXAMPLES}
      __A       	=			(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
      print('generating dataset'	)
      __A       	=			generate_100B_dataset(num_examples=UpperCAmelCase      ,  chunk_size=UpperCAmelCase	)
      print('Functions'	)
      for func in functions:
            print(func.__name__	)
            __A       	=			func(UpperCAmelCase	)

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


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








'''simple docstring'''





def        snake_case							(		UpperCAmelCase	)->			int:







      """simple docstring"""
      return int(UpperCAmelCase	) if x - int(UpperCAmelCase	) <= 0 else int(UpperCAmelCase	) + 1


if __name__ == "__main__":
 import doctest

 doctest.testmod()






