Thread: project updates

project updates

From
Charles Cui
Date:
Hi mentors and hackers,

    Here is my current working status.
1. Complete the thrift_binary_in and thrift_binary_out functions, so that users can express their thrift struct using json. These two functions support both simple data struct and complex data structure like struct and map. 2. added test cases and document to cover thrift_binary_in and thrift_binary_out. 3. make the code compile-able from 9.4 to 11.0. 

One question though, for custom types, it seems rich operations are also very important besides storing and expressing using thrift type. What are the most important operators should I support? Any suggestions?
Here is the updated repo

Thanks Charles  

Re: project updates

From
Aleksander Alekseeev
Date:
Hello Charles,

>     Here is my current working status.
> 1. Complete the thrift_binary_in and thrift_binary_out functions, so
> that users can express their thrift struct using json. These two
> functions support both simple data struct and complex data structure
> like struct and map. 2. added test cases and document to cover
> thrift_binary_in and thrift_binary_out. 3. make the code compile-able
> from 9.4 to 11.0.

I see multiple warnings during compilation with 11.0, e.g:

```
pg_thrift.c:1120:72: warning: implicit declaration of function
‘JsonbGetDatum’; did you mean ‘JsonbPGetDatum’?
[-Wimplicit-function-declaration]

pg_thrift.c:1206:13: warning: the address of ‘is_big_endian’ will
always evaluate as ‘true’ [-Waddress]

pg_thrift.c:1227:18: warning: implicit declaration of function
‘PG_GETARG_JSONB’; did you mean ‘PG_GETARG_JSONB_P’?
[-Wimplicit-function-declaration]

pg_thrift.c:1227:18: warning: initialization of ‘Jsonb *’ {aka ‘struct
<anonymous> *’} from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
```

Also tests (make clean && make && make install && make installcheck)
don't pass.

> One question though, for custom types, it seems rich operations are
> also very important besides storing and expressing using thrift type.
> What are the most important operators should I support? Any
> suggestions? Here is the updated repo
> https://github.com/charles-cui/pg_thrift

I believe get field / set field are most common ones. Naturally there
are also enumerations, projections, you name it. You can check out list
of operation supported by JSONB (or a list of operations on dict's in
Python) to get a full picture.

--
Best regards,
Aleksander Alekseev


Re: project updates

From
Charles Cui
Date:


2018-07-20 2:18 GMT-07:00 Aleksander Alekseeev <a.alekseev@postgrespro.ru>:
Hello Charles,

>     Here is my current working status.
> 1. Complete the thrift_binary_in and thrift_binary_out functions, so
> that users can express their thrift struct using json. These two
> functions support both simple data struct and complex data structure
> like struct and map. 2. added test cases and document to cover
> thrift_binary_in and thrift_binary_out. 3. make the code compile-able
> from 9.4 to 11.0.

I see multiple warnings during compilation with 11.0, e.g:

```
pg_thrift.c:1120:72: warning: implicit declaration of function
‘JsonbGetDatum’; did you mean ‘JsonbPGetDatum’?
[-Wimplicit-function-declaration]

pg_thrift.c:1206:13: warning: the address of ‘is_big_endian’ will
always evaluate as ‘true’ [-Waddress]

pg_thrift.c:1227:18: warning: implicit declaration of function
‘PG_GETARG_JSONB’; did you mean ‘PG_GETARG_JSONB_P’?
[-Wimplicit-function-declaration]

pg_thrift.c:1227:18: warning: initialization of ‘Jsonb *’ {aka ‘struct
<anonymous> *’} from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
```

Also tests (make clean && make && make install && make installcheck)
don't pass.
I have tested compiled passed for 9.4, 9.5, 9.6, 10 and 11 (https://travis-ci.org/charles-cui/pg_thrift/builds/404741899
and make install && make installcheck passed for 9.4
The tests are not run for other versions because my mac is 9.4 postgresql. 
Also for CI testing, the current travis scripts has some problems for version other than 9.4. 
I will try to upgrade my postgresql and see whether I can make it. 

> One question though, for custom types, it seems rich operations are
> also very important besides storing and expressing using thrift type.
> What are the most important operators should I support? Any
> suggestions? Here is the updated repo
> https://github.com/charles-cui/pg_thrift

I believe get field / set field are most common ones. Naturally there
are also enumerations, projections, you name it. You can check out list
of operation supported by JSONB (or a list of operations on dict's in
Python) to get a full picture.

Good idea, thanks 

--
Best regards,
Aleksander Alekseev

Re: project updates

From
David Fetter
Date:
On Sat, Jul 21, 2018 at 12:00:48PM -0700, Charles Cui wrote:
> 2018-07-20 2:18 GMT-07:00 Aleksander Alekseeev <a.alekseev@postgrespro.ru>:
> 
> > Hello Charles,
> >
> > >     Here is my current working status.
> > > 1. Complete the thrift_binary_in and thrift_binary_out functions, so
> > > that users can express their thrift struct using json. These two
> > > functions support both simple data struct and complex data structure
> > > like struct and map. 2. added test cases and document to cover
> > > thrift_binary_in and thrift_binary_out. 3. make the code compile-able
> > > from 9.4 to 11.0.
> >
> > I see multiple warnings during compilation with 11.0, e.g:
> >
> > ```
> > pg_thrift.c:1120:72: warning: implicit declaration of function
> > ‘JsonbGetDatum’; did you mean ‘JsonbPGetDatum’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1206:13: warning: the address of ‘is_big_endian’ will
> > always evaluate as ‘true’ [-Waddress]
> >
> > pg_thrift.c:1227:18: warning: implicit declaration of function
> > ‘PG_GETARG_JSONB’; did you mean ‘PG_GETARG_JSONB_P’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1227:18: warning: initialization of ‘Jsonb *’ {aka ‘struct
> > <anonymous> *’} from ‘int’ makes pointer from integer without a cast
> > [-Wint-conversion]
> > ```
> >
> > Also tests (make clean && make && make install && make installcheck)
> > don't pass.
> >
> I have tested compiled passed for 9.4, 9.5, 9.6, 10 and 11 (
> https://travis-ci.org/charles-cui/pg_thrift/builds/404741899)
> and make install && make installcheck passed for 9.4
> The tests are not run for other versions because my mac is 9.4 postgresql.

You can have several versions of PostgreSQL on your mac at once.  Are
you using homebrew?

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


Re: project updates

From
Charles Cui
Date:
yes, using home brew, will try that.

On Jul 21, 2018 12:33 PM, "David Fetter" <david@fetter.org> wrote:
On Sat, Jul 21, 2018 at 12:00:48PM -0700, Charles Cui wrote:
> 2018-07-20 2:18 GMT-07:00 Aleksander Alekseeev <a.alekseev@postgrespro.ru>:
>
> > Hello Charles,
> >
> > >     Here is my current working status.
> > > 1. Complete the thrift_binary_in and thrift_binary_out functions, so
> > > that users can express their thrift struct using json. These two
> > > functions support both simple data struct and complex data structure
> > > like struct and map. 2. added test cases and document to cover
> > > thrift_binary_in and thrift_binary_out. 3. make the code compile-able
> > > from 9.4 to 11.0.
> >
> > I see multiple warnings during compilation with 11.0, e.g:
> >
> > ```
> > pg_thrift.c:1120:72: warning: implicit declaration of function
> > ‘JsonbGetDatum’; did you mean ‘JsonbPGetDatum’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1206:13: warning: the address of ‘is_big_endian’ will
> > always evaluate as ‘true’ [-Waddress]
> >
> > pg_thrift.c:1227:18: warning: implicit declaration of function
> > ‘PG_GETARG_JSONB’; did you mean ‘PG_GETARG_JSONB_P’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1227:18: warning: initialization of ‘Jsonb *’ {aka ‘struct
> > <anonymous> *’} from ‘int’ makes pointer from integer without a cast
> > [-Wint-conversion]
> > ```
> >
> > Also tests (make clean && make && make install && make installcheck)
> > don't pass.
> >
> I have tested compiled passed for 9.4, 9.5, 9.6, 10 and 11 (
> https://travis-ci.org/charles-cui/pg_thrift/builds/404741899)
> and make install && make installcheck passed for 9.4
> The tests are not run for other versions because my mac is 9.4 postgresql.

You can have several versions of PostgreSQL on your mac at once.  Are
you using homebrew?

Best,
David.

--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Re: project updates

From
Charles Cui
Date:
Having tried David's method to install 10.4 and 11 on my mac and turns out 
worked for me. The compiling issue posted by Aleksander is because 
some json helpers changed function name and is not backward compatible with 9.4 and 10. Using #if macro resolves the problem, 
Aleksander, do you want to test again? 

2018-07-21 13:08 GMT-07:00 Charles Cui <charles.cui1984@gmail.com>:
yes, using home brew, will try that.

On Jul 21, 2018 12:33 PM, "David Fetter" <david@fetter.org> wrote:
On Sat, Jul 21, 2018 at 12:00:48PM -0700, Charles Cui wrote:
> 2018-07-20 2:18 GMT-07:00 Aleksander Alekseeev <a.alekseev@postgrespro.ru>:
>
> > Hello Charles,
> >
> > >     Here is my current working status.
> > > 1. Complete the thrift_binary_in and thrift_binary_out functions, so
> > > that users can express their thrift struct using json. These two
> > > functions support both simple data struct and complex data structure
> > > like struct and map. 2. added test cases and document to cover
> > > thrift_binary_in and thrift_binary_out. 3. make the code compile-able
> > > from 9.4 to 11.0.
> >
> > I see multiple warnings during compilation with 11.0, e.g:
> >
> > ```
> > pg_thrift.c:1120:72: warning: implicit declaration of function
> > ‘JsonbGetDatum’; did you mean ‘JsonbPGetDatum’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1206:13: warning: the address of ‘is_big_endian’ will
> > always evaluate as ‘true’ [-Waddress]
> >
> > pg_thrift.c:1227:18: warning: implicit declaration of function
> > ‘PG_GETARG_JSONB’; did you mean ‘PG_GETARG_JSONB_P’?
> > [-Wimplicit-function-declaration]
> >
> > pg_thrift.c:1227:18: warning: initialization of ‘Jsonb *’ {aka ‘struct
> > <anonymous> *’} from ‘int’ makes pointer from integer without a cast
> > [-Wint-conversion]
> > ```
> >
> > Also tests (make clean && make && make install && make installcheck)
> > don't pass.
> >
> I have tested compiled passed for 9.4, 9.5, 9.6, 10 and 11 (
> https://travis-ci.org/charles-cui/pg_thrift/builds/404741899)
> and make install && make installcheck passed for 9.4
> The tests are not run for other versions because my mac is 9.4 postgresql.

You can have several versions of PostgreSQL on your mac at once.  Are
you using homebrew?

Best,
David.

--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


Re: project updates

From
Aleksander Alekseeev
Date:
Hello Charles,

> Having tried David's method to install 10.4 and 11 on my mac and
> turns out worked for me. The compiling issue posted by Aleksander is
> because some json helpers changed function name and is not backward
> compatible with 9.4 and 10. Using #if macro resolves the problem,
> Here is the commit to solve this.
> https://github.com/charles-cui/pg_thrift/commit/dd5b8ad17ab47e3c977943dd2d69e5abad34c6ad
> Aleksander, do you want to test again?

It's much better now, thank you! :)

-- 
Best regards,
Aleksander Alekseev