@Override public Object execute(FunctionParameters parameters) { Object[] childExe = executeChildFormulae(parameters, true); if (childExe == null) { return Functions.EXECUTION_ERROR; } ODLTableReadOnly table = getForeignTable(parameters); if (table == null) { return null; } long[] list = table.find(otherTablePrimaryKeyColumn, childExe[0]); int nr = list.length; ArrayList<ODLGeom> geoms = new ArrayList<>(nr); for (int i = 0; i < nr; i++) { long id = list[i]; Object otherVal = table.getValueById(id, otherTableReturnKeyColummn); if (otherVal != null) { ODLGeom geom = (ODLGeom) ColumnValueProcessor.convertToMe(ODLColumnType.GEOM, otherVal); if (geom == null) { return Functions.EXECUTION_ERROR; } geoms.add(geom); } } String espg = (String) ColumnValueProcessor.convertToMe(ODLColumnType.STRING, childExe[1]); return new GeomUnion().union(geoms, espg); }
public int getRowNb() { if (rowNbIfKnown != -1) { return rowNbIfKnown; } ODLTableReadOnly table = getDefaultTable(); if (table != null) { int n = table.getRowCount(); for (int i = 0; i < n && rowId != -1; i++) { if (table.getRowId(i) == rowId) { return i; } } } throw new RuntimeException("Row number is not available."); }