MCPcopy Create free account
hub / github.com/apache/arrow / _get_column_indices

Method _get_column_indices

python/pyarrow/parquet/core.py:689–717  ·  view source on GitHub ↗
(self, column_names, use_pandas_metadata=False)

Source from the content-addressed store, hash-verified

687 batch_size=batch_size)
688
689 def _get_column_indices(self, column_names, use_pandas_metadata=False):
690 if column_names is None:
691 return None
692
693 indices = []
694
695 for name in column_names:
696 if name in self._nested_paths_by_prefix:
697 indices.extend(self._nested_paths_by_prefix[name])
698
699 if use_pandas_metadata:
700 file_keyvalues = self.metadata.metadata
701 common_keyvalues = (self.common_metadata.metadata
702 if self.common_metadata is not None
703 else None)
704
705 if file_keyvalues and b'pandas' in file_keyvalues:
706 index_columns = _get_pandas_index_columns(file_keyvalues)
707 elif common_keyvalues and b'pandas' in common_keyvalues:
708 index_columns = _get_pandas_index_columns(common_keyvalues)
709 else:
710 index_columns = []
711
712 if indices is not None and index_columns:
713 indices += [self.reader.column_name_idx(descr)
714 for descr in index_columns
715 if not isinstance(descr, dict)]
716
717 return indices
718
719
720_SPARK_DISALLOWED_CHARS = re.compile('[ ,;{}()\n\t=]')

Callers 5

read_row_groupMethod · 0.95
read_row_groupsMethod · 0.95
iter_batchesMethod · 0.95
readMethod · 0.95
scan_contentsMethod · 0.95

Calls 2

extendMethod · 0.80

Tested by

no test coverage detected