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

Method _get_column_indices

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

Source from the content-addressed store, hash-verified

678 batch_size=batch_size)
679
680 def _get_column_indices(self, column_names, use_pandas_metadata=False):
681 if column_names is None:
682 return None
683
684 indices = []
685
686 for name in column_names:
687 if name in self._nested_paths_by_prefix:
688 indices.extend(self._nested_paths_by_prefix[name])
689
690 if use_pandas_metadata:
691 file_keyvalues = self.metadata.metadata
692 common_keyvalues = (self.common_metadata.metadata
693 if self.common_metadata is not None
694 else None)
695
696 if file_keyvalues and b'pandas' in file_keyvalues:
697 index_columns = _get_pandas_index_columns(file_keyvalues)
698 elif common_keyvalues and b'pandas' in common_keyvalues:
699 index_columns = _get_pandas_index_columns(common_keyvalues)
700 else:
701 index_columns = []
702
703 if indices is not None and index_columns:
704 indices += [self.reader.column_name_idx(descr)
705 for descr in index_columns
706 if not isinstance(descr, dict)]
707
708 return indices
709
710
711_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