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

Xurenhe commented on DRILL-8194:
--------------------------------

PR: https://github.com/apache/drill/pull/2522/files

> Function of REPLACE throws IndexOutOfBoundsException, if text's length is 
> more than previously applied
> ------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-8194
>                 URL: https://issues.apache.org/jira/browse/DRILL-8194
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Xurenhe
>            Priority: Major
>
> Function of *REPLACE* throws IndexOutOfBoundsException, if text's length is 
> more than previously applied.
> TEST-CASE:
> {code:java}
> // TestStringFunctions#testReplaceOutBuffer
> @Test
> public void testReplaceOutBuffer() throws Exception {
>   String originValue = RandomStringUtils.randomAlphabetic(8192).toLowerCase() 
> + "12345";
>   String expectValue = originValue.replace("12345", "67890");
>   String sql = "select replace(c1, '12345', '67890') as col from (values('" + 
> originValue + "')) as t(c1)";
>   testBuilder()
>     .sqlQuery(sql)
>     .ordered()
>     .baselineColumns("col")
>     .baselineValues(expectValue)
>     .go();
> } {code}
> Error-Stack:
> {code:java}
> java.lang.Exception: org.apache.drill.common.exceptions.UserRemoteException: 
> SYSTEM ERROR: IndexOutOfBoundsException: DrillBuf[143], udle: [107 0..8192], 
> index: 8192, length: 1 (expected: range(0, 8192))
> ledger[114] allocator: frag:0:0), isOwning: true, size: 8192, references: 1, 
> life: 61488788902200..0, allocatorManager: [106, life: 61488788791129..0] 
> holds 1 buffers. 
>     DrillBuf[143], udle: [107 0..8192]
>    event log for: DrillBuf[143]
>      61488788929532 create()
>           at org.apache.drill.common.StackTrace.<init>(StackTrace.java:33)
>           at 
> org.apache.drill.common.HistoricalLog$Event.<init>(HistoricalLog.java:39)
>           at 
> org.apache.drill.common.HistoricalLog.recordEvent(HistoricalLog.java:95)
>           at io.netty.buffer.DrillBuf.<init>(DrillBuf.java:89)
>           at 
> org.apache.drill.exec.memory.AllocationManager$BufferLedger.newDrillBuf(AllocationManager.java:384)
>           at 
> org.apache.drill.exec.memory.BaseAllocator.bufferWithoutReservation(BaseAllocator.java:261)
>           at 
> org.apache.drill.exec.memory.BaseAllocator.buffer(BaseAllocator.java:242)
>           at 
> org.apache.drill.exec.ops.BufferManagerImpl.getManagedBuffer(BufferManagerImpl.java:63)
>           at 
> org.apache.drill.exec.ops.BufferManagerImpl.replace(BufferManagerImpl.java:53)
>           at io.netty.buffer.DrillBuf.reallocIfNeeded(DrillBuf.java:101)
>           at 
> org.apache.drill.exec.test.generated.ProjectorGen0.doSetup(ProjectorGen0.java:139)
>           at 
> org.apache.drill.exec.physical.impl.project.ProjectorTemplate.setup(ProjectorTemplate.java:107)
>           at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchemaFromInput(ProjectRecordBatch.java:289)
>           at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema(ProjectRecordBatch.java:265)
>           at 
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext(AbstractUnaryRecordBatch.java:92)
>           at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:85)
>           at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:170)
>           at 
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:237)
>           at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:103)
>           at 
> org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:81)
>           at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:93) 
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to