brimdata / super

A novel data lake based on super-structured data
https://zed.brimdata.io/
BSD 3-Clause "New" or "Revised" License
1.38k stars 64 forks source link

Warn if a constant appears where a field reference is expected #5274

Open philrz opened 1 month ago

philrz commented 1 month ago

tl;dr

A community user attempted sort 'Source Zone','Destination Zone' thinking this was the right way to specify field names that contained spaces. Their sort had no effect and the tooling provided no warning or error, but perhaps it could have.

Details

At the time this issue is being filed, Zed is at commit 21b7168.

The user's original screenshot from a community Slack thread:

image

Ideally they'd have read the field dereference docs or used Zui's right-click sorting shortcuts and hence known to instead write sort this['Source Zone'],this['Destination Zone']. However, knowing that users often don't read the docs, I was left wondering if the tooling could have delivered some kind of feedback to help point them in the right direction.

In a group discussion, @mccanne pointed out that in the user's query 'Source Zone' and 'Destination Zone' are constants, so since sort expects references to field names or expressions that reference field names, it would be technically possible for the tools to recognize that only plain constants were provided and inform the user that this is probably not what they intended. This would hopefully inspire them to check the docs.