[ https://issues.apache.org/jira/browse/CALCITE-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15752954#comment-15752954 ]
Julian Hyde commented on CALCITE-1414: -------------------------------------- [~julian.feinauer], Looks good. A few comments: * Can you please rename it to {{RAND_INTEGER}}? This makes it consistent with {{RAND}} (which is in the ODBC spec and is therefore somewhat standard) but makes it clear that this is intended to produce integers, not doubles, and does not accept a seed argument. (Sorry to change my mind - I know I originally suggested naming it {{RANDOM}}.) * In {{SqlStdOperatorTable}} can you rename {{RANDOM_FUNCTION}} to {{RAND_INTEGER}} to be consistent with other fields, which are just the function name. * Can you add {{RAND_INTEGER\(numeric\)}} to reference.md. When you've fixed these, just add a commit to PR 339 and add a comment to this case; no need to create a new PR. > Add a RANDOM function > --------------------- > > Key: CALCITE-1414 > URL: https://issues.apache.org/jira/browse/CALCITE-1414 > Project: Calcite > Issue Type: Bug > Reporter: Julian Hyde > Assignee: Julian Hyde > Labels: newbie > > Add a RANDOM function. > It is not standard SQL, but most DBMSs have one, and it be useful. > It will also allow us to better test non-deterministic expressions. > I propose that: > * {{RANDOM\(n)}} returns an integer between 0 and n - 1 inclusive. > * There is no facility to specify a seed at this time. > * The random number generator is randomly seeded at query start time based on > (say) the method used by Java's {{new Random()}}; if you run the query twice, > you will (probably) not get the same results. > * If you call the function twice in the same row, it will (probably) return > different results. -- This message was sent by Atlassian JIRA (v6.3.4#6332)