FIXED - task 432: cross() failing - flush join cache table when column changes
http://code.google.com/p/google-refine/issues/detail?id=432 git-svn-id: http://google-refine.googlecode.com/svn/trunk@2539 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
9b54a8f29e
commit
83dce305cb
@ -62,8 +62,7 @@ public class Cross implements Function {
|
|||||||
toColumnName != null && toColumnName instanceof String) {
|
toColumnName != null && toColumnName instanceof String) {
|
||||||
|
|
||||||
ProjectJoin join = ProjectManager.singleton.getInterProjectModel().getJoin(
|
ProjectJoin join = ProjectManager.singleton.getInterProjectModel().getJoin(
|
||||||
ProjectManager.singleton.getProjectMetadata(
|
ProjectManager.singleton.getProjectMetadata(((Project) bindings.get("project")).id).getName(),
|
||||||
((Project) bindings.get("project")).id).getName(),
|
|
||||||
((WrappedCell) wrappedCell).columnName,
|
((WrappedCell) wrappedCell).columnName,
|
||||||
(String) toProjectName,
|
(String) toProjectName,
|
||||||
(String) toColumnName
|
(String) toColumnName
|
||||||
|
@ -42,6 +42,7 @@ import org.json.JSONException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONWriter;
|
import org.json.JSONWriter;
|
||||||
|
|
||||||
|
import com.google.refine.InterProjectModel;
|
||||||
import com.google.refine.Jsonizable;
|
import com.google.refine.Jsonizable;
|
||||||
import com.google.refine.model.recon.ReconConfig;
|
import com.google.refine.model.recon.ReconConfig;
|
||||||
import com.google.refine.util.ParsingUtilities;
|
import com.google.refine.util.ParsingUtilities;
|
||||||
@ -111,6 +112,14 @@ public class Column implements Jsonizable {
|
|||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all cached precomputed values.
|
||||||
|
* <p>
|
||||||
|
* If you are modifying something that requires this to be called, you
|
||||||
|
* probably also need to call
|
||||||
|
* {@link InterProjectModel#flushJoinsInvolvingProjectColumn(long, String)}.
|
||||||
|
* e.g. ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, column.getName())
|
||||||
|
*/
|
||||||
public void clearPrecomputes() {
|
public void clearPrecomputes() {
|
||||||
if (_precomputes != null) {
|
if (_precomputes != null) {
|
||||||
_precomputes.clear();
|
_precomputes.clear();
|
||||||
|
@ -106,6 +106,7 @@ public class Project {
|
|||||||
logger.warn("Error signaling overlay model before disposing", e);
|
logger.warn("Error signaling overlay model before disposing", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProject(this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLastSave(){
|
public Date getLastSave(){
|
||||||
|
@ -38,8 +38,10 @@ import java.io.LineNumberReader;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.util.Pool;
|
import com.google.refine.util.Pool;
|
||||||
|
|
||||||
@ -60,14 +62,18 @@ public class CellChange implements Change {
|
|||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
project.rows.get(row).setCell(cellIndex, newCell);
|
project.rows.get(row).setCell(cellIndex, newCell);
|
||||||
|
|
||||||
project.columnModel.getColumnByCellIndex(cellIndex).clearPrecomputes();
|
Column column = project.columnModel.getColumnByCellIndex(cellIndex);
|
||||||
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, column.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void revert(Project project) {
|
public void revert(Project project) {
|
||||||
project.rows.get(row).setCell(cellIndex, oldCell);
|
project.rows.get(row).setCell(cellIndex, oldCell);
|
||||||
|
|
||||||
project.columnModel.getColumnByCellIndex(cellIndex).clearPrecomputes();
|
Column column = project.columnModel.getColumnByCellIndex(cellIndex);
|
||||||
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, column.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,6 +38,7 @@ import java.io.LineNumberReader;
|
|||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
import com.google.refine.util.Pool;
|
import com.google.refine.util.Pool;
|
||||||
@ -54,6 +55,7 @@ public class ColumnRenameChange extends ColumnChange {
|
|||||||
@Override
|
@Override
|
||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
synchronized (project) {
|
synchronized (project) {
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _oldColumnName);
|
||||||
project.columnModel.getColumnByName(_oldColumnName).setName(_newColumnName);
|
project.columnModel.getColumnByName(_oldColumnName).setName(_newColumnName);
|
||||||
project.columnModel.update();
|
project.columnModel.update();
|
||||||
}
|
}
|
||||||
@ -62,6 +64,7 @@ public class ColumnRenameChange extends ColumnChange {
|
|||||||
@Override
|
@Override
|
||||||
public void revert(Project project) {
|
public void revert(Project project) {
|
||||||
synchronized (project) {
|
synchronized (project) {
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _newColumnName);
|
||||||
project.columnModel.getColumnByName(_newColumnName).setName(_oldColumnName);
|
project.columnModel.getColumnByName(_newColumnName).setName(_oldColumnName);
|
||||||
project.columnModel.update();
|
project.columnModel.update();
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ import java.util.Properties;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
|
|
||||||
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
@ -126,6 +127,7 @@ public class ColumnSplitChange implements Change {
|
|||||||
project.columnModel.allocateNewCellIndex();
|
project.columnModel.allocateNewCellIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _columnName);
|
||||||
_column = project.columnModel.getColumnByName(_columnName);
|
_column = project.columnModel.getColumnByName(_columnName);
|
||||||
_columnIndex = project.columnModel.getColumnIndexByName(_columnName);
|
_columnIndex = project.columnModel.getColumnIndexByName(_columnName);
|
||||||
|
|
||||||
@ -240,6 +242,7 @@ public class ColumnSplitChange implements Change {
|
|||||||
|
|
||||||
for (int i = 0; i < _columnNames.size(); i++) {
|
for (int i = 0; i < _columnNames.size(); i++) {
|
||||||
project.columnModel.columns.remove(_columnIndex + 1);
|
project.columnModel.columns.remove(_columnIndex + 1);
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _columnNames.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
project.columnModel.columnGroups.clear();
|
project.columnModel.columnGroups.clear();
|
||||||
|
@ -39,6 +39,7 @@ import java.io.Writer;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -93,6 +94,7 @@ public class MassCellChange implements Change {
|
|||||||
if (_commonColumnName != null) {
|
if (_commonColumnName != null) {
|
||||||
Column column = project.columnModel.getColumnByName(_commonColumnName);
|
Column column = project.columnModel.getColumnByName(_commonColumnName);
|
||||||
column.clearPrecomputes();
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _commonColumnName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_updateRowContextDependencies) {
|
if (_updateRowContextDependencies) {
|
||||||
@ -113,6 +115,7 @@ public class MassCellChange implements Change {
|
|||||||
if (_commonColumnName != null) {
|
if (_commonColumnName != null) {
|
||||||
Column column = project.columnModel.getColumnByName(_commonColumnName);
|
Column column = project.columnModel.getColumnByName(_commonColumnName);
|
||||||
column.clearPrecomputes();
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _commonColumnName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_updateRowContextDependencies) {
|
if (_updateRowContextDependencies) {
|
||||||
|
@ -42,6 +42,7 @@ import java.io.Writer;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import com.google.refine.ProjectManager;
|
||||||
import com.google.refine.history.Change;
|
import com.google.refine.history.Change;
|
||||||
import com.google.refine.model.Column;
|
import com.google.refine.model.Column;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -108,6 +109,7 @@ public class ReconChange extends MassCellChange {
|
|||||||
column.setReconStats(_newReconStats);
|
column.setReconStats(_newReconStats);
|
||||||
|
|
||||||
column.clearPrecomputes();
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _commonColumnName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +123,7 @@ public class ReconChange extends MassCellChange {
|
|||||||
column.setReconStats(_oldReconStats);
|
column.setReconStats(_oldReconStats);
|
||||||
|
|
||||||
column.clearPrecomputes();
|
column.clearPrecomputes();
|
||||||
|
ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProjectColumn(project.id, _commonColumnName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user