[
https://issues.apache.org/jira/browse/SPARK-43802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Binford updated SPARK-43802:
---------------------------------
Description:
to_binary with hex and base64 generate invalid codegen:
{{spark.range(5).selectExpr('to_binary(base64(cast(id as binary)),
"BASE64")').show()}}
results in
{{Caused by: org.codehaus.commons.compiler.CompileException: File
'generated.java', Line 47, Column 1: failed to compile:
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 47,
Column 1: Unknown variable or type "BASE64"}}
because this is the generated code:
/* 107 */ if
(!org.apache.spark.sql.catalyst.expressions.UnBase64.isValidBase64(project_value_1))
{
/* 108 */ throw QueryExecutionErrors.invalidInputInConversionError(
/* 109 */ ((org.apache.spark.sql.types.BinaryType$) references[1]
/* to */),
/* 110 */ project_value_1,
/* 111 */ BASE64,
/* 112 */ "try_to_binary");
/* 113 */ }
was:
to_binary with hex and base64 generate invalid codegen:
{{spark.range(5).selectExpr('to_binary(base64(cast(id as binary)),
"BASE64")').show()}}
results in
{{Caused by: org.codehaus.commons.compiler.CompileException: File
'generated.java', Line 47, Column 1: failed to compile:
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 47,
Column 1: Unknown variable or type "BASE64"}}
because this is the generated code:
{{ }}{{{}/* 107 */ if
(!org.apache.spark.sql.catalyst.expressions.UnBase64.isValidBase64(project_value_1))
{{}}}{{{}/* 108 */ throw
QueryExecutionErrors.invalidInputInConversionError({}}}{{{}/* 109 */
((org.apache.spark.sql.types.BinaryType$) references[1] /* to */),{}}}{{{}/*
110 */ project_value_1,{}}}{{{}/* 111 */
BASE64,{}}}{{{}/* 112 */ "try_to_binary");{}}}{{{}/* 113 */
}{}}}
> unbase64 and unhex codegen are invalid with failOnError
> -------------------------------------------------------
>
> Key: SPARK-43802
> URL: https://issues.apache.org/jira/browse/SPARK-43802
> Project: Spark
> Issue Type: New Feature
> Components: SQL
> Affects Versions: 3.4.0
> Reporter: Adam Binford
> Priority: Major
>
> to_binary with hex and base64 generate invalid codegen:
> {{spark.range(5).selectExpr('to_binary(base64(cast(id as binary)),
> "BASE64")').show()}}
> results in
> {{Caused by: org.codehaus.commons.compiler.CompileException: File
> 'generated.java', Line 47, Column 1: failed to compile:
> org.codehaus.commons.compiler.CompileException: File 'generated.java', Line
> 47, Column 1: Unknown variable or type "BASE64"}}
> because this is the generated code:
> /* 107 */ if
> (!org.apache.spark.sql.catalyst.expressions.UnBase64.isValidBase64(project_value_1))
> {
> /* 108 */ throw QueryExecutionErrors.invalidInputInConversionError(
> /* 109 */ ((org.apache.spark.sql.types.BinaryType$) references[1]
> /* to */),
> /* 110 */ project_value_1,
> /* 111 */ BASE64,
> /* 112 */ "try_to_binary");
> /* 113 */ }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]