Skip to content

Conversation

@labkey-matthewb
Copy link
Contributor

Rationale

Support for filter/sort on columns in parent sample/dataclass

Under experimental feature flag for the moment.

Related Pull Requests

Changes

Copy link
Contributor

@labkey-susanh labkey-susanh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems reasonable enough, but there's something wrong in here because the Data Class columns are not added as lookups and display only the rowId values.



/* Do incremental update to existing cached data. There is no provision for deleting rows. */
public void upsert()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used by ClosureQueryHelper.incrementalRecompute(). MQH doesn't directly expose the names of names of the tables it's managing, so this seemed right.

String[] cteParts = StringUtils.splitByWholeSeparator(cte,"/*FROM*/");
assert cteParts.length == 2;

return new SQLFragment(cteParts[0]).append(from).append(cteParts[1]).append(select);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you might need some spaces around the from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the text in the SQL string constants above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 146, it looks like this:

.append(cteParts[0]).append(" ").append(from).append(" ").append(cteParts[1])

So, either the extra space appends aren't needed above, or they would be needed here, or I'm not reading this correctly. Not a big deal if they're extra above, but I get bitten by these missing spaces too many times.

Copy link
Contributor

@labkey-susanh labkey-susanh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely working better now for data classes. I've not tested extensively, though.


if (null != _ss && AppProps.getInstance().isExperimentalFeatureEnabled(ExperimentModule.EXPERIMENTAL_LINEAGE_PARENT_LOOKUP))
{
MutableColumnInfo lineageLookup = ClosureQueryHelper.createLineageLookupColumnInfo("Ancestor Lookups Placeholder", this, _rootTable.getColumn("rowid"), _ss);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just call this "Ancestors" or "Ancestor Lookups".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or "Lineage Lookups". I figured the spec was the right place to make a decision, but that if I put a "reasonable" thing in the code it would be sticky.

@labkey-matthewb labkey-matthewb merged commit e1de7d4 into develop Mar 22, 2022
@labkey-matthewb labkey-matthewb deleted the fb_lineage_closure_lookup_prototype branch March 22, 2022 20:29
Copy link
Contributor

@labkey-martyp labkey-martyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. A little different than what I understood from the spec, but matches more my understanding of the use case.

Seems like this could help with Sample Finder resolving lookups as well?

A couple inline comments to think about.

""", MAX_LINEAGE_LOOKUP_DEPTH);

static String pgMaterialClosureSql = """
SELECT Start_, CASE WHEN COUNT(*) = 1 THEN MIN(rowId) ELSE -1 * COUNT(*) END AS rowId, targetId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this gives a count of rows when not 1:1. I imagine in some cases we'll want to provide some feedback why a value isn't showing up in a column that is not 1:1. Any thoughts how to propagate that up in the query? Looks like this will just be part of the join and won't match anything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the negative row count shows up in columns that are just selecting the material or dataclass instead of a value in the material or dataclass. Might be useful for providing user feedback in UIs, but if not providing an error in the actual response, maybe at least in a future fb provide a comment or explanation for anyone looking to use this


enum TableType
{
SampleType("Materials", SchemaKey.fromParts("exp","materials") )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice if we could alias these eventually (samples, sources, registry,...), especially if we're going to make these available in-app eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants