project-m36 icon indicating copy to clipboard operation
project-m36 copied to clipboard

AtomFunction max doesn't type check.

Open YuMingLiao opened this issue 5 years ago • 2 comments

Hi, I may found an issue when trying atom functions.

In tuorial, max is for int. in code, max is defined for IntegerAtom but it doesn't work for IntegerAtom as I expected.

TutorialD (master/main): :importexample date
TutorialD (master/main): :showexpr s
┌──────────┬────────┬───────────┬───────────────┐
│city::Text│s#::Text│sname::Text│status::Integer│
├──────────┼────────┼───────────┼───────────────┤
│"London"  │"S4"    │"Clark"    │20             │
│"Athens"  │"S5"    │"Adams"    │30             │
│"Paris"   │"S3"    │"Blake"    │30             │
│"Paris"   │"S2"    │"Jones"    │10             │
│"London"  │"S1"    │"Smith"    │20             │
└──────────┴────────┴───────────┴───────────────┘
TutorialD (master/main): :showexpr s where status = 30
┌──────────┬────────┬───────────┬───────────────┐
│city::Text│s#::Text│sname::Text│status::Integer│
├──────────┼────────┼───────────┼───────────────┤
│"Paris"   │"S3"    │"Blake"    │30             │
│"Athens"  │"S5"    │"Adams"    │30             │
└──────────┴────────┴───────────┴───────────────┘

TutorialD (master/main): :showexpr s where status = max (@status)
┌──────────┬────────┬───────────┬───────────────┐
│city::Text│s#::Text│sname::Text│status::Integer│
└──────────┴────────┴───────────┴───────────────┘

YuMingLiao avatar Jun 28 '19 02:06 YuMingLiao

Take a look at the test. Aggregate operators work on (nested) relations.

The type checker should be complaining in your example above, however.

agentm avatar Jun 28 '19 02:06 agentm

Oops. I misunderstood again. Thanks for the reminder.

YuMingLiao avatar Jun 28 '19 02:06 YuMingLiao