You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.
In IndexDriver implementation, we have to deal with sql.Expression interface (serialize it in Create and deserialize in Load). Deserialize an interface in go is not really possible, so here are couple of proposals how to make sql.Expression type more flexible to work with:
Add (Un)Marshal functions, so everyone who implements the interface will have to know how to serialize it to []byte and how to deserialize it from []byte.
Create ExpressionRegistry and all concrete implementations will have to register Expression type with unique name in global registry. And downstream this information to components like IndexDriver where information about concrete implementation is needed.
Attach some kind of hash reference to every sql.Expression implementation and in components like IndexDriver, sql.Index, ... use only hash reference strings instead of expression objects.
Right now sql.Expression interface is:
// Expression is a combination of one or more SQL expressions.typeExpressioninterface {
Resolvable
fmt.Stringer// Type returns the expression type.Type() Type// IsNullable returns whether the expression can be null.IsNullable() bool// Eval evaluates the given row and returns a result.Eval(*Context, Row) (interface{}, error)
// TransformUp transforms the expression and all its children with the// given transform function.TransformUp(TransformExprFunc) (Expression, error)
// Children returns the children expressions of this expression.Children() []Expression
}
For instance in Pilosa driver apart from (de)serialize it in Load, Create we also iterate through all expression in Save (because we treat them as column names) and map them to Pilosa frame names. To make it possible we just convert them to string just calling String() function:
So for index driver it would be better if expressions were just a slice of strings.
This task should be accomplished before we start continue working on: #174
The text was updated successfully, but these errors were encountered:
Maybe encoding/gob can help in some way, but it requires to register a type. Here I've played a little bit with deserialising interface: https://play.golang.org/p/bVT60uj3aXw
In
IndexDriver
implementation, we have to deal withsql.Expression
interface (serialize it inCreate
and deserialize inLoad
). Deserialize an interface in go is not really possible, so here are couple of proposals how to makesql.Expression
type more flexible to work with:[]byte
and how to deserialize it from[]byte
.ExpressionRegistry
and all concrete implementations will have to registerExpression
type with unique name in global registry. And downstream this information to components likeIndexDriver
where information about concrete implementation is needed.sql.Expression
implementation and in components likeIndexDriver
,sql.Index
, ... use only hash reference strings instead of expression objects.Right now
sql.Expression
interface is:For instance in Pilosa driver apart from (de)serialize it in
Load, Create
we also iterate through all expression inSave
(because we treat them as column names) and map them to Pilosa frame names. To make it possible we just convert them tostring
just callingString()
function:So for index driver it would be better if expressions were just a slice of strings.
This task should be accomplished before we start continue working on: #174
The text was updated successfully, but these errors were encountered: