def _export_table(dataset, column_names=None, byteorder="<STR_LIT:=>", shuffle=False, selection=False, progress=None, virtual=True, sort=None, ascending=True):
column_names = column_names or dataset.get_column_names(virtual=virtual, strings=True)<EOL>for name in column_names:<EOL><INDENT>if name not in dataset.columns:<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL><DEDENT><DEDENT>N = len(dataset) if not selection else dataset.selected_length(selection)<EOL>if N == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if shuffle and sort:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if shuffle:<EOL><INDENT>random_index_column = "<STR_LIT>"<EOL>while random_index_column in dataset.get_column_names():<EOL><INDENT>random_index_column += "<STR_LIT>"<EOL><DEDENT><DEDENT>partial_shuffle = shuffle and len(dataset) != N<EOL>order_array = None<EOL>if partial_shuffle:<EOL><INDENT>shuffle_array_full = np.random.choice(len(dataset), len(dataset), replace=False)<EOL>shuffle_array = shuffle_array_full[shuffle_array_full < N]<EOL>del shuffle_array_full<EOL>order_array = shuffle_array<EOL><DEDENT>elif shuffle:<EOL><INDENT>shuffle_array = np.random.choice(N, N, replace=False)<EOL>order_array = shuffle_array<EOL><DEDENT>if sort:<EOL><INDENT>if selection:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>logger.info("<STR_LIT>")<EOL>indices = np.argsort(dataset.evaluate(sort))<EOL>order_array = indices if ascending else indices[::-<NUM_LIT:1>]<EOL>logger.info("<STR_LIT>")<EOL><DEDENT>if selection:<EOL><INDENT>full_mask = dataset.evaluate_selection_mask(selection)<EOL><DEDENT>else:<EOL><INDENT>full_mask = None<EOL><DEDENT>arrow_arrays = []<EOL>for column_name in column_names:<EOL><INDENT>mask = full_mask<EOL>if selection:<EOL><INDENT>values = dataset.evaluate(column_name, filtered=False)<EOL>values = values[mask]<EOL><DEDENT>else:<EOL><INDENT>values = dataset.evaluate(column_name)<EOL>if shuffle or sort:<EOL><INDENT>indices = order_array<EOL>values = values[indices]<EOL><DEDENT><DEDENT>arrow_arrays.append(arrow_array_from_numpy_array(values))<EOL><DEDENT>if shuffle:<EOL><INDENT>arrow_arrays.append(arrow_array_from_numpy_array(order_array))<EOL>column_names = column_names + [random_index_column]<EOL><DEDENT>table = pa.Table.from_arrays(arrow_arrays, column_names)<EOL>return table<EOL>
:param DatasetLocal dataset: dataset to export
:param str path: path for file
:param lis[str] column_names: list of column names to export or None for all columns
:param str byteorder: = for native, < for little endian and > for big endian
:param bool shuffle: export rows in random order
:param bool selection: export selection or not
:param progress: progress callback that gets a progress fraction as argument and should return True to continue,
        or a default progress bar when progress=True
:param: bool virtual: When True, export virtual columns
:return: