parameters: (f, helper, header, metadata, skip_nulls=False,
                     selfmade=False)
return_statement: return definition_levels, repetition_levels, values[:nval]
docstring: Read a data page: definitions, repetitions, values (in order)
  
      Only values are guaranteed to exist, e.g., for a top-level, required
      field.
docstring_summary: Read a data page: definitions, repetitions, values (in order)
docstring_tokens: Read a data page : definitions repetitions values ( in order )
function: def read_data_page(f, helper, header, metadata, skip_nulls=False,
                     selfmade=False):
      """Read a data page: definitions, repetitions, values (in order)
  
      Only values are guaranteed to exist, e.g., for a top-level, required
      field.
      """
      daph = header.data_page_header
      raw_bytes = _read_page(f, header, metadata)
      io_obj = encoding.Numpy8(np.frombuffer(byte_buffer(raw_bytes),
                                             dtype=np.uint8))
  
      repetition_levels = read_rep(io_obj, daph, helper, metadata)
  
      if skip_nulls and not helper.is_required(metadata.path_in_schema):
          num_nulls = 0
          definition_levels = None
          skip_definition_bytes(io_obj, daph.num_values)
      else:
          definition_levels, num_nulls = read_def(io_obj, daph, helper, metadata)
  
      nval = daph.num_values - num_nulls
      if daph.encoding == parquet_thrift.Encoding.PLAIN:
          width = helper.schema_element(metadata.path_in_schema).type_length
          values = encoding.read_plain(raw_bytes[io_obj.loc:],
                                       metadata.type,
                                       int(daph.num_values - num_nulls),
                                       width=width)
      elif daph.encoding in [parquet_thrift.Encoding.PLAIN_DICTIONARY,
                             parquet_thrift.Encoding.RLE]:
          # bit_width is stored as single byte.
          if daph.encoding == parquet_thrift.Encoding.RLE:
              bit_width = helper.schema_element(
                      metadata.path_in_schema).type_length
          else:
              bit_width = io_obj.read_byte()
          if bit_width in [8, 16, 32] and selfmade:
              num = (encoding.read_unsigned_var_int(io_obj) >> 1) * 8
              values = io_obj.read(num * bit_width // 8).view('int%i' % bit_width)
          elif bit_width:
              values = encoding.Numpy32(np.empty(daph.num_values-num_nulls+7,
                                                 dtype=np.int32))
              # length is simply "all data left in this page"
              encoding.read_rle_bit_packed_hybrid(
                          io_obj, bit_width, io_obj.len-io_obj.loc, o=values)
              values = values.data[:nval]
          else:
              values = np.zeros(nval, dtype=np.int8)
      else:
          raise NotImplementedError('Encoding %s' % daph.encoding)
      return definition_levels, repetition_levels, values[:nval]
function_tokens: def read_data_page ( f , helper , header , metadata , skip_nulls = False , selfmade = False ) : daph = header . data_page_header raw_bytes = _read_page ( f , header , metadata ) io_obj = encoding . Numpy8 ( np . frombuffer ( byte_buffer ( raw_bytes ) , dtype = np . uint8 ) ) repetition_levels = read_rep ( io_obj , daph , helper , metadata ) if skip_nulls and not helper . is_required ( metadata . path_in_schema ) : num_nulls = 0 definition_levels = None skip_definition_bytes ( io_obj , daph . num_values ) else : definition_levels , num_nulls = read_def ( io_obj , daph , helper , metadata ) nval = daph . num_values - num_nulls if daph . encoding == parquet_thrift . Encoding . PLAIN : width = helper . schema_element ( metadata . path_in_schema ) . type_length values = encoding . read_plain ( raw_bytes [ io_obj . loc : ] , metadata . type , int ( daph . num_values - num_nulls ) , width = width ) elif daph . encoding in [ parquet_thrift . Encoding . PLAIN_DICTIONARY , parquet_thrift . Encoding . RLE ] : # bit_width is stored as single byte. if daph . encoding == parquet_thrift . Encoding . RLE : bit_width = helper . schema_element ( metadata . path_in_schema ) . type_length else : bit_width = io_obj . read_byte ( ) if bit_width in [ 8 , 16 , 32 ] and selfmade : num = ( encoding . read_unsigned_var_int ( io_obj ) >> 1 ) * 8 values = io_obj . read ( num * bit_width // 8 ) . view ( 'int%i' % bit_width ) elif bit_width : values = encoding . Numpy32 ( np . empty ( daph . num_values - num_nulls + 7 , dtype = np . int32 ) ) # length is simply "all data left in this page" encoding . read_rle_bit_packed_hybrid ( io_obj , bit_width , io_obj . len - io_obj . loc , o = values ) values = values . data [ : nval ] else : values = np . zeros ( nval , dtype = np . int8 ) else : raise NotImplementedError ( 'Encoding %s' % daph . encoding ) return definition_levels , repetition_levels , values [ : nval ]