Skip to content

Commit

Permalink
Don't ISE during recompilation of queries that produce warnings
Browse files Browse the repository at this point in the history
The queries get recompiled without their full source buffer, which
some of the span machinery gets mad at.

Hack around it. (There are certainly better approaches.)
  • Loading branch information
msullivan committed Feb 21, 2025
1 parent 01d0498 commit 3b424fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion edb/common/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ def __getstate__(self):
return dic

def _calc_points(self):
# HACK: If we don't have an actual buffer (probably because we
# are recompiling after a schema change), just fake something
# long enough. Line numbers will be wrong but positions will
# still be right...
buffer = self.buffer.encode('utf-8') if self.buffer else b' ' * self.end
self._points = ql_parser.SourcePoint.from_offsets(
self.buffer.encode('utf-8'),
buffer,
[self.start, self.end]
)

Expand Down
2 changes: 1 addition & 1 deletion edb/server/compiler/rpc.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ cdef class SQLParamsSource:
return self._cached_key

def text(self):
return '<unknown>'
return ''

def serialize(self):
if self._serialized is not None:
Expand Down
2 changes: 1 addition & 1 deletion edb/server/dbview/dbview.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ cdef class Database:
try:
query_req = rpc.CompilationRequest.deserialize(
in_data,
"<unknown>",
"",
self.server.compilation_config_serializer,
)

Expand Down

0 comments on commit 3b424fb

Please sign in to comment.