tspurway / hustle

A column oriented, embarrassingly distributed relational event database.
Other
240 stars 36 forks source link

'in' operator #9

Closed tspurway closed 10 years ago

tspurway commented 10 years ago

The Column currently doesn't support the in operator, which would allow you to easily test the column against a collection of values. You currently have to do this with the | operator.

Ideally, we would have a Column Expression like:

table.column in ['hello', 'there', 'you', 'guys']

however, in Python, this is actually implemented by overriding the in operator on the list class, which is not something we want to do. We want to override operators only on the Column class.

In the fine tradition of overloading bitwise operators for operations in our DSL, I would suggest overloading the << operator on the Column class thusly:

table.column << ['hello', 'there', 'you', 'guys']
ncloudioj commented 10 years ago

Add a "contains" function for Column that handles following cases:

With this feature, Hustle can handle nested select queries,

select(t.c1, t.c2, where = (t.c3.contains( select(t1.c3, where=(t1.c5 == 'foo') ))))
ncloudioj commented 10 years ago

Added this feature in the develop branch commit 10de07ec533d1268131889496f2efd9ef2b5430e