-
Notifications
You must be signed in to change notification settings - Fork 1
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
[wip] new FP-like intermediate representation #10
base: master
Are you sure you want to change the base?
Conversation
I don't set out to write a code generator in the Format function of PlanNode, but it appears that's what's happened. Next step? Transform this into another intermediate representation which is executed by a VM?
messed up Not sure how far to go with this
there's about to be a lot of stuff to pretty print y'all
check in basic types, values, and expressions
not actually deserializing and returning an object yet
- add concept of type vars - new function for matching types There are a few panics though, so I'm afraid it's fragile.
things are getting wonky.
once we have a parser, can just parse these
i.e. still return usable traces even in the presence of errors
also add support to the test harness for Map nodes in the trace tree
plus clean up shell's use of channels a bit
by namespacing tables under a "tables" record
no joins yet
they still don't execute correctly because we don't create a new iterator for each scan yet.
now, a lambda which does a scan can be invoked multiple times, and the scan will start from the beginning each time.
|
||
case incomingMsg := <-conn.IncomingMessages: | ||
channel := conn.Channels[incomingMsg.StatementID] | ||
conn.webSocketConn.WriteMessage(websocket.TextMessage, []byte(request.Statement)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of conn.webSocketConn.WriteMessage
is not checked (from errcheck
)
err := conn.WebSocketConn.ReadJSON(&parsedMessage) | ||
parsedMessage := &BasicChannelMessage{} | ||
_, rawMsg, err := conn.webSocketConn.ReadMessage() | ||
json.Unmarshal(rawMsg, parsedMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of json.Unmarshal
is not checked (from errcheck
)
fc.funcName, idx, argType.Format(), param.Typ.Format(), | ||
) | ||
} | ||
bindings.extend(argBindings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of bindings.extend
is not checked (from errcheck
)
if !matches { | ||
return false, nil | ||
} | ||
bindings.extend(paramBindings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of bindings.extend
is not checked (from errcheck
)
if !paramsMatch { | ||
return false, nil | ||
} | ||
bindings.extend(paramBindings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of bindings.extend
is not checked (from errcheck
)
|
||
// schema columns iterator | ||
|
||
type SchemaColumnsIterator struct { | ||
type schemaColumnsIterator struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U1000: type schemaColumnsIterator
is unused (from unused
)
for _, table := range db.Schema.Tables { | ||
for _, column := range table.Columns { | ||
columnDoc := column.ToRecord(table.Name, db) | ||
func newColumnsIterator(db *Database) (*schemaColumnsIterator, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U1000: func newColumnsIterator
is unused (from unused
)
|
||
// record listeners iterator | ||
|
||
type RecordListenersIterator struct { | ||
type recordListenersIterator struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U1000: type recordListenersIterator
is unused (from unused
)
func newRecordListenersIterator(db *Database) (*RecordListenersIterator, error) { | ||
listenersTable := db.Schema.Tables["__record_listeners__"] | ||
listeners := make([]*Record, 0) | ||
func newRecordListenersIterator(db *Database) (*recordListenersIterator, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U1000: func newRecordListenersIterator
is unused (from unused
)
var o1 interface{} | ||
var o2 interface{} | ||
|
||
var err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S1021: should merge variable declaration with assignment on next line (from gosimple
)
Queries are planned into expressions in a small functional programming language,
e.g. the TreeSQL query
becomes
…which is then executed to generate the result. Hopefully this will serve as a basis for expanding the set of queries TreeSQL can execute, and be a good place to do index selection, etc.
Still working on the language basics and figuring out how to incrementalize this XD