While you are writing your complex SQL queries directly in ruby, Sequel is building a sort of simple abstract syntax tree, which it compiles or literalizes when it comes time to generate the SQL.
Displayed here is an only slightly simplified abstract syntax tree for the allowed object.
Knowing about SQL at an object level instead of at a string level allows Sequel to have quite powerful introspection powers.