From b299cddda1a844267e06f5ffea6906ff61bb9366 Mon Sep 17 00:00:00 2001 From: Julien Date: Tue, 14 May 2019 11:09:52 +0200 Subject: [PATCH] Issue 76: preserve column order from the columns option --- .../com/astrolabsoftware/sparkfits/FitsHduBintable.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/astrolabsoftware/sparkfits/FitsHduBintable.scala b/src/main/scala/com/astrolabsoftware/sparkfits/FitsHduBintable.scala index 9cb710c..3f75bc0 100644 --- a/src/main/scala/com/astrolabsoftware/sparkfits/FitsHduBintable.scala +++ b/src/main/scala/com/astrolabsoftware/sparkfits/FitsHduBintable.scala @@ -46,8 +46,12 @@ object FitsHduBintable { colNames.values.toList.asInstanceOf[List[String]] } - val colPositions = selectedColNames.map( - x => getColumnPos(keyValues, x)).toList.sorted + val colPositions = if (selectedColumns != null) { + selectedColNames.map(x => getColumnPos(keyValues, x)).toList + } else { + selectedColNames.map(x => getColumnPos(keyValues, x)).toList.sorted + } + val rowTypes = getColTypes(keyValues)