[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555881#action_12555881 ] Erik Hatcher commented on SOLR-449: --- I've looked around for constants for those too, and asked around to several Ruby experts, and sure enough no such constants exist for Infinity or NaN. But come on, Hoss, don't throw in the towel on Ruby just for that - there are plenty of other great features of Ruby to more than make up for this weird omission of those constants. There are methods on Float that allow you to ask if something is infinite or not a number. Hoss's point about outputting code is not that far-fetched and is actually along the lines of what I proposed in SOLR-358 - having a special Ruby response writer mode that output something interpretable by solr-ruby that took care of all data type / ordering issues. For now the divide-by-zero hack is fine I suppose. python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555686#action_12555686 ] Hoss Man commented on SOLR-449: --- when the description says omit i think you mean emit right? I don't know squat about Ruby, but the docs seem to suggest that... {noformat}NaN{noformat} ...is the proper way to express not a number as a float literal... http://ruby-doc.org/core/classes/Float.html#M000244 python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555690#action_12555690 ] Mike Klaas commented on SOLR-449: - Yes, emit Using an online ruby interpreter, NaN and Infinity aren't literals. But I can produce them using (0.0/0.0) and (1.0/1e-3000), so I'll throw that into the patch too. python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555695#action_12555695 ] Yonik Seeley commented on SOLR-449: --- Rather than rely on an overflow for infinity, one can divide by zero, right? irb(main):022:0 1.0/0.0 = Infinity irb(main):023:0 irb(main):024:0* -1.0/0.0 = -Infinity python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555697#action_12555697 ] Mike Klaas commented on SOLR-449: - so you can! I tried the integer version (1/0), which complains bitterly. python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555740#action_12555740 ] Hoss Man commented on SOLR-449: --- Yonik's comment lead me to discover that irb is the interactive ruby shell (who knew!) which lead me to spend 20 minutes banging my head against my desk (and google) attempting to find literals or constants that express NaN or Infinity. I can not fathom the existence a language written in this millennium that understands the concept of NaN but has no literal way for you to express NaN without doing a computation. I would say i've lost all respect for Ruby, but since i didn't really know enough about ruby to respest it before, let me just say i've lost the ability to gain respect for Ruby in the future. I can't believe i'm saying this, but: would it be worth while for the RubyResponseWriter to output code that declares variables for NaN, Infinite and -Infinite and only does those 3 computations once, instead of each time they occur? (i'm assuming that if one document has a NaN value for a field value, then other docs will probably have a NaN value). python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SOLR-449) python (and presumably ruby) writer can generate NaN
[ https://issues.apache.org/jira/browse/SOLR-449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12555743#action_12555743 ] Mike Klaas commented on SOLR-449: - I don't think that declaring a viable approach. At least in python, it would create a series of statements rather than a single expression, which would make parsing more difficult (using exec instead of eval(), etc). Ruby might behave similarly. I'm not sure that repeating the computation is a justifiable worry though: even floating point division is blazingly fast compared to anything ruby will try to do. Also, I'm not sure if it is possible to store a NaN or infinity in a document field, is it? I'm too lazy to check if Float.parseFloat(NaN) does the right thing in java. It came up for me because of a bug in a custom queryscorer that gamely attempted a division by zero. I've checked in a the fix that we discussed for python and ruby--I'll leave the issue open in case our resident rubyista has a better solution. python (and presumably ruby) writer can generate NaN Key: SOLR-449 URL: https://issues.apache.org/jira/browse/SOLR-449 Project: Solr Issue Type: Bug Affects Versions: 1.3 Reporter: Mike Klaas Assignee: Mike Klaas Priority: Trivial Attachments: nan.patch The JSON response writer can omit NaN as float literal; this is fine for JSON but breaks eval() in python (not sure if this is a problem in ruby). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.