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

Method _get_column_indices

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

Source from the content-addressed store, hash-verified

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