Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@

import edu.caltech.ipac.firefly.data.TableServerRequest;
import edu.caltech.ipac.firefly.server.db.DbAdapter;
import edu.caltech.ipac.firefly.server.db.EmbeddedDbUtil;
import edu.caltech.ipac.firefly.server.util.QueryUtil;
import edu.caltech.ipac.firefly.server.util.StopWatch;
import edu.caltech.ipac.table.DataGroup;
import edu.caltech.ipac.table.DataGroupPart;
import edu.caltech.ipac.table.DataType;
import edu.caltech.ipac.util.AppProperties;
import edu.caltech.ipac.util.StringUtils;

import java.util.Arrays;

import static edu.caltech.ipac.firefly.server.query.HealpixProcessor.*;
import static edu.caltech.ipac.table.DataGroup.HEALPIX_IDX;
Expand Down Expand Up @@ -113,10 +112,10 @@ private void ensureHealpixExists( DbAdapter dbAdapter, TableServerRequest sreq,
if (!dbAdapter.hasTable(healpixTable)) {

// create healpix index at BASE_ORDER
DataType healpixCol = makeHealPixColumn();
StopWatch.getInstance().start("HealpixProcessor: create index");
dbAdapter.execUpdate("ALTER TABLE %s DROP COLUMN IF EXISTS %s".formatted(dataTable, HEALPIX_IDX)); // remove existing index
dbAdapter.execUpdate("ALTER TABLE %s ADD COLUMN %s LONG".formatted(dataTable, HEALPIX_IDX));
dbAdapter.execUpdate("UPDATE %s SET %s = deg2pix(%s, %s, %s)".formatted(dataTable, HEALPIX_IDX, BASE_ORDER, ra, dec));
dbAdapter.execUpdate("ALTER TABLE %s DROP COLUMN IF EXISTS %s".formatted(dataTable, healpixCol.getKeyName())); // remove existing index
EmbeddedDbUtil.addColumn(dbAdapter, healpixCol, "deg2pix(%s, %s, %s)".formatted(BASE_ORDER, ra, dec), null, dataTable, null);
StopWatch.getInstance().printLog("HealpixProcessor: create index");

// create healpix map at BASE_ORDER
Expand All @@ -127,4 +126,10 @@ private void ensureHealpixExists( DbAdapter dbAdapter, TableServerRequest sreq,
}
}

private static DataType makeHealPixColumn() {
DataType dt = new DataType(HEALPIX_IDX, Long.class);
dt.setVisibility(DataType.Visibility.hidden);
return dt;
}

}
8 changes: 7 additions & 1 deletion src/firefly/js/tables/reducer/TableUiReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,11 @@ function adjustColInfo({uiData, tableModel, columns, previous}) {
}

function hasSameCnames(tableModel, columns=[]) {
return getAllColumns(tableModel).map((c) => c.name).join() === columns.map((c) => c.name).join();
const tm = getAllColumns(tableModel)
.filter((c) => c.visibility !== 'hidden')
.map((c) => c.name).join();
const cols = columns
.filter((c) => c.visibility !== 'hidden')
.map((c) => c.name).join();
return tm === cols;
}