File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -126,11 +126,17 @@ _getrow(relation::Relation) = getfield(relation, :_getrow)
126126# `Tuple` of values. This function "lowers" symbols from type space to values
127127# in the corresponding position in the tuple.
128128function _make_getrow (relkey, columns)
129+ if columns == [[]]
130+ # Special case for when the relation is `true` in rel (only contains `()`):
131+ # This means that the relation is _only specialized values_, so we can just return
132+ # the specialized values from the relkey directly.
133+ return row -> _relname_to_symbol .(Tuple (relkey))
134+ end
129135 col = 1
130136 getters = []
131137 for item in relkey
132138 if startswith (item, " :" ) # symbol
133- let sym = Symbol (item[ 2 : end ] )
139+ let sym = _relname_to_symbol (item)
134140 push! (getters, _ -> sym)
135141 end
136142 else
@@ -140,10 +146,11 @@ function _make_getrow(relkey, columns)
140146 col += 1
141147 end
142148 end
143- @assert col == length (columns) + 1
149+ @assert col == length (columns) + 1 " for $relkey : $col != $( length (columns) + 1 ) "
144150 @assert length (getters) == length (relkey)
145151 return row -> Tuple (getter (row) for getter in getters)
146152end
153+ _relname_to_symbol (relname:: String ) = Symbol (relname[2 : end ])
147154
148155Base. eltype (:: Relation ) = RelRow
149156Base. getindex (relation:: Relation , key:: Int ) = getrow (relation, key)
You can’t perform that action at this time.
0 commit comments