links-lang / links

Links: Linking Theory to Practice for the Web
http://www.links-lang.org
Other
332 stars 42 forks source link

temporal tables and distinct/dedup #1121

Open vcgalpin opened 2 years ago

vcgalpin commented 2 years ago

(Unsurprisingly) temporal tables and distinct/dedup don't play nicely together

links> query mixing { for (x <- distinct(malaria_stage2interaction_temporal)) [x] };
Unification error: Temporal table specifications Current and Transaction do not match.
<stdin>:1: Type error: The function
    `distinct'
has type
    `(TableHandle ((|a::Base),(|b::Base),(|c::Base))) {}-> [(|a::Base)]'
while the arguments passed to it have types
    `TemporalTable(Transaction,(interaction_id:Int,malaria_stage_id:Int),(interaction_id:Int,malaria_stage_id:Int),(interaction_id:Int,malaria_stage_id:Int))'
and the currently allowed effects are
    `'
In expression: distinct(malaria_stage2interaction_temporal).
links> length(query mixing { dedup(for (x <-t- malaria_stage2interaction) [x]) });
Unification error: Temporal table specifications Current and Transaction do not match.
<stdin>:1: Type error: The body of a table generator must have type `TemporalTable(Transaction,(|a::Base),(|b::Base),(|c::Base))', but the expression
    `malaria_stage2interaction'
has type
    `TemporalTable(Current,(interaction_id:Int,malaria_stage_id:Int),(interaction_id:Int,malaria_stage_id:Int),(interaction_id:Int,malaria_stage_id:Int))'
In expression: for (x <-t- malaria_stage2interaction) [x].
SimonJF commented 2 years ago

Hi Vashti, I wouldn't say this is a bug at present:

Unification error: Temporal table specifications Current and Transaction do not match.

This arises because the typechecker demands that the deduplication functionality requires a current-time table rather than a temporal one, so I'd say at present it's working as intended. That said, good to mark it as a feature request.