Khurram Faraaz created DRILL-4755: ------------------------------------- Summary: StringIndexOutOfBoundsException seen with CONVERT_FROM function Key: DRILL-4755 URL: https://issues.apache.org/jira/browse/DRILL-4755 Project: Apache Drill Issue Type: Bug Components: Query Planning & Optimization Affects Versions: 1.7.0 Reporter: Khurram Faraaz
StringIndexOutOfBoundsException seen with CONVERT_FROM function Drill git commit ID : 6286c0a4 {noformat} 0: jdbc:drill:schema=dfs.tmp> select CONVERT_FROM(binary_string(columns[0]),'INTEGER') from `binStrDuplcs.csv`; Error: SYSTEM ERROR: StringIndexOutOfBoundsException: String index out of range: -5 [Error Id: 7e8fd49d-c6ac-40ac-849e-cf59145ed5dd on centos-01.qa.lab:31010] (org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: String index out of range: -5 org.apache.drill.exec.work.foreman.Foreman.run():271 java.util.concurrent.ThreadPoolExecutor.runWorker():1142 java.util.concurrent.ThreadPoolExecutor$Worker.run():617 java.lang.Thread.run():745 Caused By (java.lang.StringIndexOutOfBoundsException) String index out of range: -5 java.lang.String.substring():1931 org.apache.drill.exec.planner.logical.PreProcessLogicalRel.getConvertFunctionException():244 org.apache.drill.exec.planner.logical.PreProcessLogicalRel.visit():148 org.apache.calcite.rel.logical.LogicalProject.accept():132 org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.preprocessNode():634 org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert():196 org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan():164 org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan():94 org.apache.drill.exec.work.foreman.Foreman.runSQL():978 org.apache.drill.exec.work.foreman.Foreman.run():257 java.util.concurrent.ThreadPoolExecutor.runWorker():1142 java.util.concurrent.ThreadPoolExecutor$Worker.run():617 java.lang.Thread.run():745 (state=,code=0) {noformat} Stack trace from drillbit.log {noformat} 2016-06-27 05:31:02,515 [288f45e9-44ad-bc5e-3247-3e0ec4dc68e0:foreman] INFO o.a.drill.exec.work.foreman.Foreman - Query text for query id 288f45e9-44ad-bc5e-3247-3e0ec4dc68e0: select CONVERT_FROM(binary_string(columns[0]),'INTEGER') from `binStrDuplcs.csv` 2016-06-27 05:31:02,558 [288f45e9-44ad-bc5e-3247-3e0ec4dc68e0:foreman] ERROR o.a.drill.exec.work.foreman.Foreman - SYSTEM ERROR: StringIndexOutOfBoundsException: String index out of range: -5 [Error Id: 7e8fd49d-c6ac-40ac-849e-cf59145ed5dd on centos-01.qa.lab:31010] org.apache.drill.common.exceptions.UserException: SYSTEM ERROR: StringIndexOutOfBoundsException: String index out of range: -5 [Error Id: 7e8fd49d-c6ac-40ac-849e-cf59145ed5dd on centos-01.qa.lab:31010] at org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543) ~[drill-common-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.work.foreman.Foreman$ForemanResult.close(Foreman.java:791) [drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.work.foreman.Foreman.moveToState(Foreman.java:901) [drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:271) [drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91] Caused by: org.apache.drill.exec.work.foreman.ForemanException: Unexpected exception during fragment initialization: String index out of range: -5 ... 4 common frames omitted Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -5 at java.lang.String.substring(String.java:1931) ~[na:1.8.0_91] at org.apache.drill.exec.planner.logical.PreProcessLogicalRel.getConvertFunctionException(PreProcessLogicalRel.java:244) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.planner.logical.PreProcessLogicalRel.visit(PreProcessLogicalRel.java:148) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.calcite.rel.logical.LogicalProject.accept(LogicalProject.java:132) ~[calcite-core-1.4.0-drill-r11.jar:1.4.0-drill-r11] at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.preprocessNode(DefaultSqlHandler.java:634) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:196) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:164) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:94) ~[drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:978) [drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:257) [drill-java-exec-1.7.0-SNAPSHOT.jar:1.7.0-SNAPSHOT] ... 3 common frames omitted {noformat} Data used in test {noformat} [root@centos-01 ~]# cat binStrDuplcs.csv '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' '\\x99\\x8c\\x2f\\x77' {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)