Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1409

Make the "null" return in the gremlin console into something more understandable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Implemented
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.2.3
    • Component/s: console
    • Labels:

      Description

      A common question among new users is what is with the "null" return String in the console when there is a successful execution. An explanation is in the docs now (see note at bottom of http://tinkerpop.apache.org/docs/current/reference/#_mutating_the_graph section) but it would be nice to avoid it or make it more immediately understandable for new users.

      It's not a huge deal, but often comes up as a question from new users.

        Issue Links

          Activity

          Hide
          spmallette stephen mallette added a comment -

          It is a bit tucked away in the documentation. Perhaps we could add some detail to the console tutorial on this topic. I'm not sure what else we can do about "null" as a return. Past discussions haven't really turned up anything better that made sense, not to mention the madness we would place on existing users who are used to seeing that output.

          Show
          spmallette stephen mallette added a comment - It is a bit tucked away in the documentation. Perhaps we could add some detail to the console tutorial on this topic. I'm not sure what else we can do about "null" as a return. Past discussions haven't really turned up anything better that made sense, not to mention the madness we would place on existing users who are used to seeing that output.
          Hide
          okram Marko A. Rodriguez added a comment -

          I was thinking about it last night and thought that if the result is "null" we simply don't print anything.

          gremlin> aVoidFunction()
          gremlin> 1+2
          ==>3
          gremlin> null
          gremlin> [null, null]
          ==>null
          ==>null
          gremlin>
          
          Show
          okram Marko A. Rodriguez added a comment - I was thinking about it last night and thought that if the result is "null" we simply don't print anything. gremlin> aVoidFunction() gremlin> 1+2 ==>3 gremlin> null gremlin> [ null , null ] ==> null ==> null gremlin>
          Hide
          dmill Dylan Millikin added a comment -

          Not printing anything is a little ambiguous no?

          gremlin> 1+2
          ==>3
          gremlin> null
          gremlin> [null, null]
          ==>null
          ==>null
          gremlin> []
          gremlin>
          

          Does an empty set return null?

          Maybe there needs to be a distinction between an empty result set and a null result set. A successful execution should perhaps return an empty result set or a bool? (thinking out loud)

          Show
          dmill Dylan Millikin added a comment - Not printing anything is a little ambiguous no? gremlin> 1+2 ==>3 gremlin> null gremlin> [ null , null ] ==> null ==> null gremlin> [] gremlin> Does an empty set return null? Maybe there needs to be a distinction between an empty result set and a null result set. A successful execution should perhaps return an empty result set or a bool? (thinking out loud)
          Hide
          rdale Robert Dale added a comment -

          This was included in https://github.com/apache/tinkerpop/pull/384

          g> :set empty.result.indicator Nil
          g> null
          ==>Nil
          g> :set empty.result.indicator ""
          g> null
          ==>
          g> 
          
          Show
          rdale Robert Dale added a comment - This was included in https://github.com/apache/tinkerpop/pull/384 g> :set empty.result.indicator Nil g> null ==>Nil g> :set empty.result.indicator "" g> null ==> g>
          Hide
          spmallette stephen mallette added a comment -

          Could there have been a setting to allow for "no line" of some sort that didn't print a "==>"? like:

          gremlin> inputstream.close()
          gremlin>
          
          Show
          spmallette stephen mallette added a comment - Could there have been a setting to allow for "no line" of some sort that didn't print a "==>"? like: gremlin> inputstream.close() gremlin>
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user spmallette opened a pull request:

          https://github.com/apache/tinkerpop/pull/422

          TINKERPOP-1409 Print no result line if empty.result.indicator is empty string.

          https://issues.apache.org/jira/browse/TINKERPOP-1409

          This seems like a better use of the empty string setting than to actually just print an empty string line.

          ```text
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> graph.close()
          ==>null
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> :set empty.result.indicator ""
          gremlin> graph.close()
          gremlin>
          ```

          Pretty small change, but, I didn't CTR this in case someone didn't really like this behavior. If there are -1s I can just kill this and close the JIRA currently hanging out there as I only kept it open because I saw this dangling issue I wanted to implement.

          VOTE +1

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/apache/tinkerpop TINKERPOP-1409

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/tinkerpop/pull/422.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #422



          Show
          githubbot ASF GitHub Bot added a comment - GitHub user spmallette opened a pull request: https://github.com/apache/tinkerpop/pull/422 TINKERPOP-1409 Print no result line if empty.result.indicator is empty string. https://issues.apache.org/jira/browse/TINKERPOP-1409 This seems like a better use of the empty string setting than to actually just print an empty string line. ```text gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> graph.close() ==>null gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> :set empty.result.indicator "" gremlin> graph.close() gremlin> ``` Pretty small change, but, I didn't CTR this in case someone didn't really like this behavior. If there are -1s I can just kill this and close the JIRA currently hanging out there as I only kept it open because I saw this dangling issue I wanted to implement. VOTE +1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1409 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/422.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #422
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user dkuppitz commented on the issue:

          https://github.com/apache/tinkerpop/pull/422

          VOTE: +1

          Show
          githubbot ASF GitHub Bot added a comment - Github user dkuppitz commented on the issue: https://github.com/apache/tinkerpop/pull/422 VOTE: +1
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the issue:

          https://github.com/apache/tinkerpop/pull/422

          Cool. VOTE +1.

          Show
          githubbot ASF GitHub Bot added a comment - Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/422 Cool. VOTE +1.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user okram commented on the issue:

          https://github.com/apache/tinkerpop/pull/422

          Acctually, I think the parameterization should be `null.result.indicator` as you check `object == null` and thus, its not "empty," but `null`.

          Show
          githubbot ASF GitHub Bot added a comment - Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/422 Acctually, I think the parameterization should be `null.result.indicator` as you check `object == null` and thus, its not "empty," but `null`.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

          https://github.com/apache/tinkerpop/pull/422

          I ended up naming it `result.indicator.null` as "result." was the prefix for other similar preferences:

          ```text
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> graph.close()
          ==>null
          gremlin> :set result.indicator.null nil
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> graph.close()
          ==>nil
          gremlin> :set result.indicator.null ""
          gremlin> graph = TinkerGraph.open()
          ==>tinkergraph[vertices:0 edges:0]
          gremlin> graph.close()
          gremlin>
          ```

          Show
          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/422 I ended up naming it `result.indicator.null` as "result." was the prefix for other similar preferences: ```text gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> graph.close() ==>null gremlin> :set result.indicator.null nil gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> graph.close() ==>nil gremlin> :set result.indicator.null "" gremlin> graph = TinkerGraph.open() ==>tinkergraph [vertices:0 edges:0] gremlin> graph.close() gremlin> ```
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/tinkerpop/pull/422

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/422
          Hide
          spmallette stephen mallette added a comment -

          Most of this work went in on 3.2.2 - finished up tiny little bit for 3.2.3, but for purpose of fix version i'll just leave it at that.

          Show
          spmallette stephen mallette added a comment - Most of this work went in on 3.2.2 - finished up tiny little bit for 3.2.3, but for purpose of fix version i'll just leave it at that.
          Hide
          spmallette stephen mallette added a comment -

          Re-open to add the "breaking" label since a setting was renamed.

          Show
          spmallette stephen mallette added a comment - Re-open to add the "breaking" label since a setting was renamed.

            People

            • Assignee:
              spmallette stephen mallette
              Reporter:
              jeromatron Jeremy Hanna
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development