agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

add prettyprinter #272

Closed YuMingLiao closed 3 years ago

YuMingLiao commented 3 years ago

I guess project-m36 could use it. Inclusion dependency is translated in this commit. It is more readable now.

agentm commented 3 years ago

Thanks for the patch! Very cool! I would also like to use this for :showplan in tutd.

YuMingLiao commented 3 years ago

Glad I could help!

What is :showplan for? it seems related to DatabaseContextExpression. No document for it.

agentm commented 3 years ago

It shows the execution plan for a given database state change (without executing the plan).

agentm commented 3 years ago

Thanks for the patch!

YuMingLiao commented 3 years ago

Thanks!

caveats: I just tried and It cannot correctly show constraints from funcdep command. It needs a way to print UnionAttributeNames but I haven't implemented it. I don't know how to print AttributeNamesBase in all cases.

For example: is it like.. {a} union {b} == {a, b} {a} union {all but b} {a} union {all from s} {a} intersect ({a} union {b}) ?

agentm commented 3 years ago

Shoot- I forgot about functional dependencies. You're right that, currently, there is no TutorialD syntax for these operators, so we will need to decide on which syntax makes sense.

agentm commented 3 years ago

I decided on this syntax:

x:=s{intersection of {all but sname} {sname}}
y:=s{union of {all but sname} {sname}}

which is similar to all but syntax. Added and tested with funcdeps in 028a0e4f6e7aa05f317177dfbd183477c3bed806.