links icon indicating copy to clipboard operation
links copied to clipboard

temporal tables and distinct/dedup

Open vcgalpin opened this issue 3 years ago • 1 comments

(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].

vcgalpin avatar Mar 29 '22 15:03 vcgalpin

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.

SimonJF avatar Mar 29 '22 15:03 SimonJF