spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "H Lu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SPARK-23928) High-order function: shuffle(x) → array
Date Fri, 18 May 2018 18:44:01 GMT

    [ https://issues.apache.org/jira/browse/SPARK-23928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16481024#comment-16481024
] 

H Lu edited comment on SPARK-23928 at 5/18/18 6:43 PM:
-------------------------------------------------------

Dear Watchers ([~mn-mikke]  [~kiszk] [~viirya]),

Can someone help me with the code here? I would like to use Random. But when running tests,
got the error:

Caused by: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 45,
Column 15: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java',
Line 45, Column 15: Unknown variable or type "Random"

I already importe scala.util.Random. I am not yet an expert on CodeGen. So any comments would
be appreciated! 
{code:java}
s"""
|for (int k = $length - 1; k >= 1; k--) {
| int l = Random.nextInt(k + 1); 
| $swapAssigments 
|}
""".stripMargin
{code}


was (Author: hzlu):
Dear Watchers ([~mn-mikke]  [~kiszk]),

Can someone help me with the code here? I would like to use Random. But when running tests,
got the error:

Caused by: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 45,
Column 15: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java',
Line 45, Column 15: Unknown variable or type "Random"

I already importe scala.util.Random. I am not yet an expert on CodeGen. So any comments would
be appreciated! 
{code:java}
s"""
|for (int k = $length - 1; k >= 1; k--) {
| int l = Random.nextInt(k + 1); 
| $swapAssigments 
|}
""".stripMargin
{code}

> High-order function: shuffle(x) → array
> ---------------------------------------
>
>                 Key: SPARK-23928
>                 URL: https://issues.apache.org/jira/browse/SPARK-23928
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 2.3.0
>            Reporter: Xiao Li
>            Priority: Major
>
> Ref: https://prestodb.io/docs/current/functions/array.html
> Generate a random permutation of the given array x.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message