Git Product home page Git Product logo

gpdb-roaringbitmap's People

Contributors

gaoyao avatar zeromax007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpdb-roaringbitmap's Issues

roaringbitmap.c:551:5: error: implicit declaration of function 'AggCheckCallContext' [-Werror=implicit-function-declaration]

I used your code with GP version 4.3.7.15, the registration of sql function for roaring bitmap operation is always failed.

I found the pgsql extern function of AggCheckCallContext is missing from C header file fmgr.h,
then I switched to the newest version of GP 5.0.0-beta.4, and all looks good.

Leave a note here to save the time for anyone who visits this looking for roaring bitmap in greenplum.

rb_and_agg 计算同样的bitmap,却出现不同结果的问题

Greenplum 版本:PostgreSQL 9.4.24 (Greenplum Database 6.2.1 build commit:d90ac1a1b983b913b3950430d4d9e47ee8827fd4) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec 12 2019 18:35:48


问题描述

有两个一样的脚本。其中一个脚本直接计算bitmap,另外一个脚本计算表内的bitmap。两个bitmap一致。但是使用 rb_and_agg 计算时,会出现不一样的结果。

脚本1:

select rb_to_array(rb_and_agg(bitmap))               as result,
       count(1)                                      as total,
       string_agg(rb_to_array(bitmap)::varchar, ',') as str
from (values (rb_build('{1,2,3}')), (rb_build('{2,3,4}'))) t(bitmap);

结果为:

field value
result {2,3}
total 2
str {1,2,3},{2,3,4}

正常。注释掉count(1) as totalstring_agg(rb_to_array(bitmap)::varchar, ',') as str后,执行均正常得到and_agg计算结果。


脚本2:

select rb_to_array(rb_and_agg(bitmap))               as result,
       string_agg(rb_to_array(bitmap)::varchar, ',') as str
from (select bitmap from t_tmp where id in (4, 5) order by id) a;

其中表t_tmp内容为:

id rb_to_array(bitmap)
4 {1,2,3}
5 {2,3,4}

脚本2执行结果为:

result str
{2,3} {1,2,3},{2,3,4}

此处正常。但是当把脚本2中的string_agg(rb_to_array(bitmap)::varchar, ',') as str注释后,将得到以下不正确的结果

result
{}

附录

表创建语句:

CREATE TABLE t_tmp
(
    id     integer,
    bitmap roaringbitmap
);
INSERT INTO t_tmp SELECT 4, rb_build('{1,2,3}');
INSERT INTO t_tmp SELECT 5, rb_build('{2,3,4}');

roaringbitmap contain negative integer cause issue

SQL:
CREATE TABLE t1 (id integer, bitmap roaringbitmap);

INSERT INTO t1 SELECT 3,RB_BUILD(ARRAY[1,2,3]);
INSERT INTO t1 SELECT 4,RB_BUILD(ARRAY[3,4,5]);
INSERT INTO t1 SELECT 5,RB_BUILD(ARRAY[-3,4,5]);

select id, rb_maximum(bitmap) from t1 where id in (3,4,5);
id | rb_maximum
----+------------
3 | 3
4 | 5
5 | -3

I think it should be
select id, rb_maximum(bitmap) from t1 where id in (3,4,5);
id | rb_maximum
----+------------
3 | 3
4 | 5
5 | 5

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.