Skip to content

Commit 570ae48

Browse files
committed
Use -out.add only for calculated columns, do not use -out when -out.all or equivalent is used
1 parent a0c72ad commit 570ae48

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

astroquery/vizier/core.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -549,16 +549,13 @@ def _args_to_payload(self, *args, **kwargs):
549549
# keyword names that can mean 'all'
550550
alls = ['all', '**']
551551
if any(x in columns for x in alls):
552+
columns_all = True
552553
for x in alls:
553554
if x in columns:
554555
columns.remove(x)
555556
body['-out.all'] = None
556-
# keyword name that means default columns
557-
if '*' in columns:
558-
columns.remove('*')
559-
columns_default = True
560557
else:
561-
columns_default = False
558+
columns_all = False
562559

563560
# process: columns - identify sorting requests
564561
columns_out = []
@@ -573,17 +570,23 @@ def _args_to_payload(self, *args, **kwargs):
573570
else:
574571
columns_out += [column]
575572

576-
if columns_default:
577-
body['-out'] = '*'
578-
else:
579-
if columns_out:
573+
# calculated keyword names that start with an underscore
574+
columns_calc = []
575+
for column in columns_out:
576+
if column[0] == '_':
577+
columns_calc.append(column)
578+
for column in columns_calc:
579+
columns_out.remove(column)
580+
581+
if columns_out and not columns_all:
580582
body['-out'] = ','.join(columns_out)
581583

582-
if columns_out:
583-
body['-out.add'] = ','.join(columns_out)
584+
if columns_calc:
585+
body['-out.add'] = ','.join(columns_calc)
584586

585587
if len(sorts_out) > 0:
586588
body['-sort'] = ','.join(sorts_out)
589+
587590
# process: maximum rows returned
588591
row_limit = kwargs.get('row_limit') or self.ROW_LIMIT
589592
if row_limit < 0:

0 commit comments

Comments
 (0)