Comments (6)
@melin 能给下触发数组越界bug的测试用例么?谢谢
from hive-third-functions.
数据量比较大,没有确定是那条数据,就换掉实现代码了
from hive-third-functions.
There are 2 bugs:
- 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)
- Value of
leftArrayElementTmp2
andrightArrayElementTmp2
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.
@minhoryang Thank you very much! It had been resolved!
from hive-third-functions.
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.
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)
- What is the difference between json_extract_scalar() and get_json_object()? HOT 1
- Install on remote
- UDFArrayIntersect代码逻辑有问题,会出现数组越界异常或者出现错误返回值。
- [BUG]when apply the udf, appears null pointer error HOT 2
- What is the syntax for json path? HOT 2
- UDFRe2JRegexpExtractAll参数个数判断和函数返回值不对 HOT 5
- some function cannot work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hive-third-functions.