Giter VIP home page Giter VIP logo

Comments (6)

aaronshan avatar aaronshan commented on July 24, 2024

@melin 能给下触发数组越界bug的测试用例么?谢谢

from hive-third-functions.

melin avatar melin commented on July 24, 2024

数据量比较大,没有确定是那条数据,就换掉实现代码了

from hive-third-functions.

minhoryang avatar minhoryang commented on July 24, 2024

There are 2 bugs:

  1. If the duplicate value is located at the end of first array and the same value is stored multiple times in second array, leftPositions[++leftCurrentPosition] raises ArrayIndexOutOfBoundsException.

select array_intersect(array(0,1,2,3,4,5), array(1,1,2,2,5,5))
select array_intersect(array(0,1,2,3,4,4), array(1,1,2,2,3,4))

java.lang.ArrayIndexOutOfBoundsException: 
      at cc.shanruifeng.functions.array.UDFArrayIntersect.evaluate(UDFArrayIntersect.java:147)

You can test this with INITIAL_SIZE = 1 (just set it smaller than input length)

  1. Value of leftArrayElementTmp2 and rightArrayElementTmp2 never changed even position changes. So ignoring rest of the values without comparing.

select array_intersect(array(0,1,2,3,4,5), array(1,1,2,2,5,5))
expected: <[1, 2, 5]>, but was: <[1]>

from hive-third-functions.

aaronshan avatar aaronshan commented on July 24, 2024

@minhoryang Thank you very much! It had been resolved!

from hive-third-functions.

cceazj avatar cceazj commented on July 24, 2024

https://github.com/aaronshan/hive-third-functions/blame/f98fef86d328882c85ea40b69b14375d90d44201/src/main/java/com/github/aaronshan/functions/array/UDFArrayIntersect.java#L160
代码compare方法逻辑错误:位置数组写死了leftPositions。参数中应增加int[] positions,传递进来leftPositions或者rightPositions,相应方法调用处也需一并修改

from hive-third-functions.

aaronshan avatar aaronshan commented on July 24, 2024

https://github.com/aaronshan/hive-third-functions/blame/f98fef86d328882c85ea40b69b14375d90d44201/src/main/java/com/github/aaronshan/functions/array/UDFArrayIntersect.java#L160 代码compare方法逻辑错误:位置数组写死了leftPositions。参数中应增加int[] positions,传递进来leftPositions或者rightPositions,相应方法调用处也需一并修改

@cceazj 能帮忙修复并提个PR吗?

from hive-third-functions.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.