[jira] [Commented] (HIVE-25338) AIOBE in conv UDF if input is empty
[ https://issues.apache.org/jira/browse/HIVE-25338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17385974#comment-17385974 ] Naresh P R commented on HIVE-25338: --- Thanks for the review & merge [~maheshk114] > AIOBE in conv UDF if input is empty > --- > > Key: HIVE-25338 > URL: https://issues.apache.org/jira/browse/HIVE-25338 > Project: Hive > Issue Type: Bug >Reporter: Naresh P R >Assignee: Naresh P R >Priority: Major > Labels: pull-request-available > Time Spent: 50m > Remaining Estimate: 0h > > Repro > {code:java} > create table test (a string); > insert into test values (""); > select conv(a,16,10) from test;{code} > Exception trace: > {code:java} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 > at org.apache.hadoop.hive.ql.udf.UDFConv.evaluate(UDFConv.java:160){code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (HIVE-25338) AIOBE in conv UDF if input is empty
[ https://issues.apache.org/jira/browse/HIVE-25338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17385252#comment-17385252 ] Naresh P R commented on HIVE-25338: --- Thanks for the analysis [~zabetak] I updated PR to return null for empty input. > AIOBE in conv UDF if input is empty > --- > > Key: HIVE-25338 > URL: https://issues.apache.org/jira/browse/HIVE-25338 > Project: Hive > Issue Type: Bug >Reporter: Naresh P R >Assignee: Naresh P R >Priority: Major > Labels: pull-request-available > Time Spent: 40m > Remaining Estimate: 0h > > Repro > {code:java} > create table test (a string); > insert into test values (""); > select conv(a,16,10) from test;{code} > Exception trace: > {code:java} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 > at org.apache.hadoop.hive.ql.udf.UDFConv.evaluate(UDFConv.java:160){code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (HIVE-25338) AIOBE in conv UDF if input is empty
[ https://issues.apache.org/jira/browse/HIVE-25338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17384268#comment-17384268 ] Stamatis Zampetakis commented on HIVE-25338: [~nareshpr] After having a second look in the PR I kind of change my mind. The CONV function is mostly known from MySQL and I think the implementation so far tends to stay as close to the MySQL version as possible. I did a quick test in MySQL (version 8.0) and it returns the following results: {noformat} mysql> SELECT CONV('',10,2); +---+ | CONV('',10,2) | +---+ | NULL | +---+ mysql> SELECT CONV('4?:+',10,2); +---+ | CONV('4?:+',10,2) | +---+ | 100 | +---+ mysql> SELECT CONV('1?:+0',10,2); ++ | CONV('1?:+0',10,2) | ++ | 1 | ++ mysql> SELECT CONV('*10?:+2',10,2); +--+ | CONV('*10?:+2',10,2) | +--+ | 0| +--+ 1 row in set, 1 warning (0.00 sec) Warning (Code 1292): Truncated incorrect DECIMAL value: '*10?:+2' {noformat} So for empty string it returns NULL and for invalid literals it tries to kind of parse the literal till it finds an illegal character. Based on the above I would suggest to return NULL for empty string as you had it initially. Sorry for the back and forth. > AIOBE in conv UDF if input is empty > --- > > Key: HIVE-25338 > URL: https://issues.apache.org/jira/browse/HIVE-25338 > Project: Hive > Issue Type: Bug >Reporter: Naresh P R >Assignee: Naresh P R >Priority: Major > Labels: pull-request-available > Time Spent: 40m > Remaining Estimate: 0h > > Repro > {code:java} > create table test (a string); > insert into test values (""); > select conv(a,16,10) from test;{code} > Exception trace: > {code:java} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 > at org.apache.hadoop.hive.ql.udf.UDFConv.evaluate(UDFConv.java:160){code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (HIVE-25338) AIOBE in conv UDF if input is empty
[ https://issues.apache.org/jira/browse/HIVE-25338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17382178#comment-17382178 ] Naresh P R commented on HIVE-25338: --- [~zabetak] We return 0 for invalid input. I can return the same for empty input as well. > AIOBE in conv UDF if input is empty > --- > > Key: HIVE-25338 > URL: https://issues.apache.org/jira/browse/HIVE-25338 > Project: Hive > Issue Type: Bug >Reporter: Naresh P R >Assignee: Naresh P R >Priority: Major > Labels: pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > Repro > {code:java} > create table test (a string); > insert into test values (""); > select conv(a,16,10) from test;{code} > Exception trace: > {code:java} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 > at org.apache.hadoop.hive.ql.udf.UDFConv.evaluate(UDFConv.java:160){code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (HIVE-25338) AIOBE in conv UDF if input is empty
[ https://issues.apache.org/jira/browse/HIVE-25338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17382099#comment-17382099 ] Stamatis Zampetakis commented on HIVE-25338: What do we return when input is not a number? Do we throw? If that'ts the case maybe we should throw as well. > AIOBE in conv UDF if input is empty > --- > > Key: HIVE-25338 > URL: https://issues.apache.org/jira/browse/HIVE-25338 > Project: Hive > Issue Type: Bug >Reporter: Naresh P R >Assignee: Naresh P R >Priority: Major > Labels: pull-request-available > Time Spent: 10m > Remaining Estimate: 0h > > Repro > {code:java} > create table test (a string); > insert into test values (""); > select conv(a,16,10) from test;{code} > Exception trace: > {code:java} > Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 > at org.apache.hadoop.hive.ql.udf.UDFConv.evaluate(UDFConv.java:160){code} -- This message was sent by Atlassian Jira (v8.3.4#803005)