Thread: [GSoC] github repo and initial work

[GSoC] github repo and initial work

From
Charles Cui
Date:
Hi mentors and hackers,

   I have set up a github repo for the pg thrift plugin work, and here is the address (https://github.com/charles-cui/pg_thrift). And I have first version of binary protocol implemented, although it is still a very early stage. The current interface is to return value for simple data structure(byte, string, int32, int16, int64, bool) and return raw bytes for complex data structure(list, map, set, struct). As suggested by Aleksander, I can add json interfaces to use this plugin easily. Let me know if you guys have any comments on this.

Thanks, Charles. 

Re: [GSoC] github repo and initial work

From
Charles Cui
Date:
Hi guys, 

   As mentioned in the last email that the current interface is based on bytea. To make users easily insert any thrift data structure and show them, we may want 
to have user friendly (user readable) format for this plugin. I can think about 2 ways to do this. One is to provide to_thrift(json object) and to_json(thrift object) interfaces in the plugin. 
And the format in database table is still bytea. So, when you want to insert data into the table, users provide json/jsonb object, then call to_thrift() to covert to 
thrift bytes. When one want to read table content, using to_json() to covert thrift bytes to json. 
The second is to provide thrift type just like json or jsonb. When you create a table, postgres knows ::thrift keywords. 
I think method one should be easier to implement because it only limits to this plugin. Method two needs modify postgres kernel to register a new type, which may time consuming, 
but more natural. Any ideas on this?

Thanks, Charles


2018-05-21 21:27 GMT-07:00 Charles Cui <charles.cui1984@gmail.com>:
Hi mentors and hackers,

   I have set up a github repo for the pg thrift plugin work, and here is the address (https://github.com/charles-cui/pg_thrift). And I have first version of binary protocol implemented, although it is still a very early stage. The current interface is to return value for simple data structure(byte, string, int32, int16, int64, bool) and return raw bytes for complex data structure(list, map, set, struct). As suggested by Aleksander, I can add json interfaces to use this plugin easily. Let me know if you guys have any comments on this.

Thanks, Charles. 

Re: [GSoC] github repo and initial work

From
Aleksandr Parfenov
Date:
On Thu, 24 May 2018 18:25:28 -0700
Charles Cui <charles.cui1984@gmail.com> wrote:
> The second is to provide thrift type just like json or jsonb. When you
> create a table, postgres knows ::thrift keywords.
> I think method one should be easier to implement because it only
> limits to this plugin. Method two needs modify postgres kernel to
> register a new type, which may time consuming,
> but more natural. Any ideas on this?
> 
> Thanks, Charles

Hi Charles,

I prefer the second way with separate type. But I think it is good idea
to wait for an answer from your project mentor or someone other.

I'm not an expert in PostgreSQL user-defined types, but AFAIK, it
doesn't require changes in PostgreSQL core, since types can be created
in extensions. It doesn't require changes to grammar or something.
You can look at citext contrib as an example.

-- 
Aleksandr Parfenov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Re: [GSoC] github repo and initial work

From
Aleksander Alekseev
Date:
Hello Charles,

I suggest to begin with the second approach and add to_jsonb/from_jsonb
later. Both approaches are fine but it seems to me that most users would
expect a separate type thus it's more important.

--
Best regards,
Aleksander Alekseev

Attachment

Re: [GSoC] github repo and initial work

From
Charles Cui
Date:
Thanks for correcting me, will definitely study citext and see how a new type is registered in plugin. 


2018-05-24 23:23 GMT-07:00 Aleksandr Parfenov <a.parfenov@postgrespro.ru>:
On Thu, 24 May 2018 18:25:28 -0700
Charles Cui <charles.cui1984@gmail.com> wrote:
> The second is to provide thrift type just like json or jsonb. When you
> create a table, postgres knows ::thrift keywords.
> I think method one should be easier to implement because it only
> limits to this plugin. Method two needs modify postgres kernel to
> register a new type, which may time consuming,
> but more natural. Any ideas on this?
>
> Thanks, Charles

Hi Charles,

I prefer the second way with separate type. But I think it is good idea
to wait for an answer from your project mentor or someone other.

I'm not an expert in PostgreSQL user-defined types, but AFAIK, it
doesn't require changes in PostgreSQL core, since types can be created
in extensions. It doesn't require changes to grammar or something.
You can look at citext contrib as an example.

--
Aleksandr Parfenov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

Re: [GSoC] github repo and initial work

From
Charles Cui
Date:
Got it, will go for second method. Will let you guys know the progress.

2018-05-25 4:05 GMT-07:00 Aleksander Alekseev <a.alekseev@postgrespro.ru>:
Hello Charles,

I suggest to begin with the second approach and add to_jsonb/from_jsonb
later. Both approaches are fine but it seems to me that most users would
expect a separate type thus it's more important.

--
Best regards,
Aleksander Alekseev