hydradatabase/hydra

[Bug] aggregate of certain generated columns causes segfault

wuputah opened this issue · 1 comments

This is new in 1.0.0-rc only after running ALTER EXTENSION columnar UPDATE.

create table t4 (i1 integer);
insert into t4 select generate_series(1, 1000000);
select sum(length(i1::text)) from t4;

This causes segfault of the connection.

Backtrace indicates:

#0  0x00007fe743d938fa in __libc_pread64 (fd=32, buf=0x7fe539794b80,
    count=8192, offset=40960) at ../sysdeps/unix/sysv/linux/pread64.c:25
#1  0x00005570ae12b606 in FileRead ()
#2  0x00005570ae15ad54 in mdread ()
#3  0x00005570ae12686a in ?? ()
#4  0x00005570ae1274e8 in ReadBufferExtended ()
#5  0x00007fe7410b1f7a in ReadFromBlock (rel=0x7fe534243288, blockno=5,
    offset=24, buf=0x5570b07c09e2 "", len=8168, force=<optimized out>)
    at ./hydra/columnar/src/backend/columnar/columnar_storage.c:691
#6  0x00007fe7410b20a4 in ColumnarStorageRead (amount=23109,
    data=0x5570b07bf368 "...[truncated]..."...,
    logicalOffset=35086, rel=0x7fe534243288)
    at ./hydra/columnar/src/backend/columnar/columnar_storage.c:496
#7  ColumnarStorageRead (rel=0x7fe534243288, logicalOffset=35086,
    data=0x5570b07bf368 "...[truncated]..."...,
    amount=23109)
    at ./hydra/columnar/src/backend/columnar/columnar_storage.c:473
#8  0x00007fe7410b3b3a in LoadColumnBuffers (
    attributeForm=<error reading variable: Cannot access memory at address 0x7fff40d20338>,
    stripeOffset=<error reading variable: Cannot access memory at address 0x7fff40d20340>, chunkCount=<optimized out>, chunkSkipNodeArray=<optimized out>,
    relation=<error reading variable: Cannot access memory at address 0x7fff40d20330>)
    at ./hydra/columnar/src/backend/columnar/columnar_reader.c:1322
#9  LoadFilteredStripeBuffers (snapshot=0x5570b06fc908,
    chunkGroupsFiltered=<error reading variable: Cannot access memory at address 0x7fff40d20308>, whereClauseVars=<optimized out>,
    whereClauseList=<optimized out>, projectedColumnList=<optimized out>,
    tupleDescriptor=<optimized out>,
    stripeMetadata=<error reading variable: Cannot access memory at address 0x7fff40d20320>, relation=<optimized out>)
    at ./hydra/columnar/src/backend/columnar/columnar_reader.c:1249
#10 BeginStripeRead (
    stripeMetadata=<error reading variable: Cannot access memory at address 0x7fff40d20320>, rel=<optimized out>, tupleDesc=<optimized out>,
    projectedColumnList=<optimized out>, whereClauseList=<optimized out>,
    whereClauseVars=<optimized out>, stripeReadContext=0x5570b07a91d0,
    snapshot=0x5570b06fc908)
    at ./hydra/columnar/src/backend/columnar/columnar_reader.c:757
#11 0x00007fe7410b4c97 in ColumnarReadNextVector (
    readState=<error reading variable: Cannot access memory at address 0x7fff40d20358>, columnValues=0x5570b0774ca0,
    columnNulls=<error reading variable: Cannot access memory at address 0x7fff40d203c0>,
    rowNumber=<error reading variable: Cannot access memory at address 0x7fff40d203e8>,
    newVectorSize=<error reading variable: Cannot access memory at address 0x7fff40d20370>)
    at ./hydra/columnar/src/backend/columnar/columnar_reader.c:1963

it may have something to do with the change of type, e.g. sum(integer1 + integer2) works fine.