



"""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


_UpperCamelCase:					str     				=	1_0_0_0_0_0_0_0_0_0_0_0
_UpperCamelCase:					str     				=	1_0_0_0_0

_UpperCamelCase				,       _UpperCamelCase:					Optional[Any]     				=	os.path.split(__file__)
_UpperCamelCase:					Dict     				=	os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))


def 	lowercase__  (      _UpperCAmelCase						,   _UpperCAmelCase					)  ->      datasets.Dataset:






      '''simple docstring'''


      lowercase	:   Optional[int]											= pa.Table.from_pydict({'col': [0] * chunk_size}					)
      lowercase	:   List[str]											= pa.concat_tables([table] * (num_examples // chunk_size)					)
      return datasets.Dataset(_UpperCAmelCase						,   fingerprint='table_100B'					)


@dataclass
class 	a__		:
   _lowerCamelCase       				=					42
   _lowerCamelCase       				=					42
   _lowerCamelCase       				=					42
   _lowerCamelCase       				=					42


   def 							lowercase					(				self   :				Union[str, Any]      )     ->							Tuple:
         lowercase	:   Optional[int]											= np.random.default_rng(self.seed      )
         lowercase	:   Optional[Any]											= rng.integers(low=self.low,  high=self.high,  size=self.size      ).tolist()


   def __iter__(				self   :				str      )     ->							List[Any]:
         return iter(self._sampled_values      )






   def __len__(				self   :				Tuple      )     ->							Union[str, Any]:
         return self.size




@get_duration
def 	lowercase__  (      _UpperCAmelCase					)  ->      int:






      '''simple docstring'''


      lowercase	:   Tuple											= dataset[0]


@get_duration
def 	lowercase__  (      _UpperCAmelCase					)  ->      Optional[Any]:






      '''simple docstring'''


      lowercase	:   Any											= dataset[-1]


@get_duration
def 	lowercase__  (      _UpperCAmelCase					)  ->      Optional[int]:






      '''simple docstring'''


      lowercase	:   Optional[int]											= dataset[range(len(_UpperCAmelCase					) // 2						,   len(_UpperCAmelCase					) // 2 + 10_24					)]


@get_duration
def 	lowercase__  (      _UpperCAmelCase					)  ->      List[Any]:






      '''simple docstring'''


      lowercase	:   List[Any]											= dataset[RandIter(0						,   len(_UpperCAmelCase					)						,   10_24						,   seed=42					)]


def 	lowercase__  (      )  ->      Dict:






      '''simple docstring'''


      lowercase	:   Tuple											= {'num examples': SPEED_TEST_N_EXAMPLES}
      lowercase	:   str											= (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
      print('generating dataset'					)
      lowercase	:   Optional[Any]											= generate_100B_dataset(num_examples=_UpperCAmelCase						,   chunk_size=_UpperCAmelCase					)
      print('Functions'					)
      for func in functions:
            print(func.__name__					)
            lowercase	:   Optional[int]											= 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 	lowercase__  (      )  ->      Any:






      '''simple docstring'''


      lowercase	:   Dict											= 1

      while True:
            if (
                sorted(str(_UpperCAmelCase					)					)
                == sorted(str(2 * i					)					)
                == sorted(str(3 * i					)					)
                == sorted(str(4 * i					)					)
                == sorted(str(5 * i					)					)
                == sorted(str(6 * i					)					)
            ):
                  return i

            i += 1


if __name__ == "__main__":
     print(solution())
