Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain ConstColumn #115

Open
d6y opened this issue Apr 12, 2016 · 1 comment
Open

Explain ConstColumn #115

d6y opened this issue Apr 12, 2016 · 1 comment

Comments

@d6y
Copy link
Contributor

d6y commented Apr 12, 2016

When should I use a ConstColumn and when a Rep?

E.g., when compiling a paged query, the drop needs to be a ConstColumn. If it's a Rep the error is drop cannot be applied to aRep[Long]`.

def paged(name: Rep[String], offset: ConstColumn[Long], limit: ConstColumn[Long]) =
    this.filter(_.name === name).drop(offset).take(limit)
@d6y d6y added this to the Icebox milestone Apr 12, 2016
@d6y
Copy link
Contributor Author

d6y commented Apr 12, 2016

ScalaDoc for ConstColumn:

A scalar value that is known at the client side at the time a query is executed. This is either a constant value (LiteralColumn) or a scalar parameter.

The simple answer is that take (and drop) are only defined in terms of Int, Long and ConstColumn[Long]. And I can use ConstColumn[String] for the name of that paged method.

However, I feel I'm missing something deeper here. We don't seem to say what Rep[T] is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant