Debugging in Databricks is plenty annoying as is. Letting us see line numbers should be a simple change that would make debugging much less frustrating. (Sometimes I've ended up pasting the contents of a cell into a text editor to find the line providing the error!)
Both line numbers and command numbers are now available. Under the VIEW menu you can show/hide them. Your preferences will be remembered. Command numbers can be clicked on, which gives you a permalink to that particular command. Such permalinks are great for sharing and pointing collaborators to specific commands in notebooks.
Simeon Simeonov commented
When we consider how line numbers in notebooks should behave, it helps to start by looking at when are line numbers from notebooks communicated back to users.
I know of three places where this happens right now: in error messages, in log files and in the Spark UI (as context for jobs). In these three locations the line numbers system is consistent: it's line number in the Scala console as notebook cells are evaluated in the equivalent of a Scala REPL session. The numbers are usually meaningless for notebook users right now, which makes debugging any notebook cell with more than a few lines of code very difficult. It also makes it harder to understand which job the Spark UI is referring to, especially when there are many cluster users.
Consider how easy it is to understand which line in a notebook this refers to:
Therefore, however the notebook line number feature is implemented, it should satisfy the requirement that it is easy to map a line number from the console to a line number in the notebook.
@ali in that context, neither of the choices you offer make sense, unless you modify Spark to rewrite all <console>:xxxx elements in the stack trace in notebooks, log files & the Spark UI.
AdminAli Ghodsi (Admin, Databricks) commented
Would you prefer the line numbers to reset at the beginning of every new cell? That is, Cell 1: 1,2,3 Cell 2: 4,5. Or would you prefer Cell 1: 1,2,3 Cell 2: 1,2?