agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
895 stars 48 forks source link

AtomFunction max doesn't type check. #242

Open YuMingLiao opened 5 years ago

YuMingLiao commented 5 years ago

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│
└──────────┴────────┴───────────┴───────────────┘
agentm commented 5 years ago

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

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

YuMingLiao commented 5 years ago

Oops. I misunderstood again. Thanks for the reminder.