You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by faisal moeen <fm...@gmail.com> on 2014/05/27 18:04:40 UTC

How to implement custom datatypes

Hi,

I am trying to implement custom spatio-temporal datatypes for Phoenix. How
can I do that?

Until now I have added my custom datatype "MYDT" to PDataType and specified
it to have a sqltype=123.
I chose this number because I am not sure what to add here. I can create a
table with this but when I insert something, its type is shown as NULL.

I am using HBase 0.94.18 with Phoenix 3.0.

Any help is appreciated.

Regards

-- 

Regards
Faisal Moeen

Re: How to implement custom datatypes

Posted by James Taylor <ja...@apache.org>.
Hi Faisal,
You'd need to copy/paste both the definition of DOUBLE and of DOUBLE_ARRAY,
as we calculate the element type of an array based on subtracting an offset
from the type ID. I believe it would work then.

Please file JIRAs for any/all of these enhancements, as these are all
valid/good requirements (i.e. to make it easier to add custom types). I
think the implementation of a STRUCT would solve this in the best way.

Thanks,
James


On Thu, May 29, 2014 at 3:09 PM, faisal moeen <fm...@gmail.com> wrote:

> Dear James,
>
> As per your advice, I have flattened some of my data types including
> Point, Line, MultiLine and iPoint. I have also implemented some custom
> functions like distance, intersection, val etc.
>
> For now I am not planning to implement new custom data types but I would
> like Phoenix to do type checking etc. For example, currently "distance"
> function takes two arguments of type "Line" which I have flattened to
> DOUBLE_ARRAY. The first element of this array describes if it is a line or
> some other datatype. If I copy & paste the existing DOUBLE_ARRAY type and
> rename it to LINE type, will this give me a new datatype which behaves
> exactly like DOUBLE_ARRAY.
>
> So the idea is that I create a new type LINE which is exactly the same as
> DOUBLE_ARRAY but this allows type checking of arguments and users can see
> the type of table column as LINE to know that it is not a normal
> DOUBLE_ARRAY.
>
> Is it easily possible?
>
> Regards
> Faisal Moeen
>
>
> On Thu, May 29, 2014 at 3:43 PM, faisal moeen <fm...@gmail.com> wrote:
>
>> Thanks Andrew. The algebra I am working on primarily handles moving
>> objects or in other words trajectories over time.
>>
>> I did not read the standard but as far as I know, the way time is
>> handled, is different. For example, version is a first class concept in SQL
>> 2011 but not in Guting's Alegebra. Guting's algebra gives us a more clear
>> model of changing objects with respect to time. This gives us more logical
>> understanding of how to ask different questions and how to write queries.I
>> won't be wrong is saying that guring's Algebra is ideal for modeling
>> objects that move both in space and time.
>>
>> Regards
>>
>>
>> On Wed, May 28, 2014 at 8:53 PM, Andrew Purtell <ap...@apache.org>
>> wrote:
>>
>>> That is a fascinating set of slides.
>>>
>>> How does the envisioned spatio-temporal algebra and syntax (or UDF)
>>> changes relate to SQL 2011 temporal concepts and syntax support? Or do
>>> they? Please see https://issues.apache.org/jira/browse/PHOENIX-967 .
>>>
>>>
>>> On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com>
>>> wrote:
>>>
>>>> Hi James,
>>>>
>>>> Some of my datatypes can use the existing sql types but most of them
>>>> require to have custom implementations. I plan to start with point & line.
>>>> Please find attached the explanation of some of the types. I prefer to have
>>>> its support at the server level because I also plan to implement a
>>>> spatio-temporal join later. In that case, the local join would be through a
>>>> co-processor so I will need the support of the types and operations at the
>>>> region servers.
>>>>
>>>> Regards
>>>>
>>>>
>>>> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>
>>>> wrote:
>>>>
>>>>> Hi Faisal,
>>>>> That sounds very interesting. What will be the structure of your
>>>>> custom data type? Would you be able to get away with using the existing
>>>>> fixed binary type and interpret the value at the application level? Or
>>>>> perhaps an array of one of our primitive types? In general, each PDataType
>>>>> maps to a SQL type (
>>>>> http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
>>>>> Thanks,
>>>>> James
>>>>>
>>>>>
>>>>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to implement custom spatio-temporal datatypes for
>>>>>> Phoenix. How can I do that?
>>>>>>
>>>>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>>>>> specified it to have a sqltype=123.
>>>>>> I chose this number because I am not sure what to add here. I can
>>>>>> create a table with this but when I insert something, its type is shown as
>>>>>> NULL.
>>>>>>
>>>>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>>>>
>>>>>> Any help is appreciated.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Regards
>>>>>> Faisal Moeen
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Regards
>>>> Faisal Moeen
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>>
>>>    - Andy
>>>
>>> Problems worthy of attack prove their worth by hitting back. - Piet Hein
>>> (via Tom White)
>>>
>>
>>
>>
>> --
>>
>> Regards
>> Faisal Moeen
>>
>
>
>
> --
>
> Regards
> Faisal Moeen
>

Re: How to implement custom datatypes

Posted by faisal moeen <fm...@gmail.com>.
Dear James,

As per your advice, I have flattened some of my data types including Point,
Line, MultiLine and iPoint. I have also implemented some custom functions
like distance, intersection, val etc.

For now I am not planning to implement new custom data types but I would
like Phoenix to do type checking etc. For example, currently "distance"
function takes two arguments of type "Line" which I have flattened to
DOUBLE_ARRAY. The first element of this array describes if it is a line or
some other datatype. If I copy & paste the existing DOUBLE_ARRAY type and
rename it to LINE type, will this give me a new datatype which behaves
exactly like DOUBLE_ARRAY.

So the idea is that I create a new type LINE which is exactly the same as
DOUBLE_ARRAY but this allows type checking of arguments and users can see
the type of table column as LINE to know that it is not a normal
DOUBLE_ARRAY.

Is it easily possible?

Regards
Faisal Moeen


On Thu, May 29, 2014 at 3:43 PM, faisal moeen <fm...@gmail.com> wrote:

> Thanks Andrew. The algebra I am working on primarily handles moving
> objects or in other words trajectories over time.
>
> I did not read the standard but as far as I know, the way time is handled,
> is different. For example, version is a first class concept in SQL 2011 but
> not in Guting's Alegebra. Guting's algebra gives us a more clear model of
> changing objects with respect to time. This gives us more logical
> understanding of how to ask different questions and how to write queries.I
> won't be wrong is saying that guring's Algebra is ideal for modeling
> objects that move both in space and time.
>
> Regards
>
>
> On Wed, May 28, 2014 at 8:53 PM, Andrew Purtell <ap...@apache.org>
> wrote:
>
>> That is a fascinating set of slides.
>>
>> How does the envisioned spatio-temporal algebra and syntax (or UDF)
>> changes relate to SQL 2011 temporal concepts and syntax support? Or do
>> they? Please see https://issues.apache.org/jira/browse/PHOENIX-967 .
>>
>>
>> On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com>
>> wrote:
>>
>>> Hi James,
>>>
>>> Some of my datatypes can use the existing sql types but most of them
>>> require to have custom implementations. I plan to start with point & line.
>>> Please find attached the explanation of some of the types. I prefer to have
>>> its support at the server level because I also plan to implement a
>>> spatio-temporal join later. In that case, the local join would be through a
>>> co-processor so I will need the support of the types and operations at the
>>> region servers.
>>>
>>> Regards
>>>
>>>
>>> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>
>>> wrote:
>>>
>>>> Hi Faisal,
>>>> That sounds very interesting. What will be the structure of your custom
>>>> data type? Would you be able to get away with using the existing fixed
>>>> binary type and interpret the value at the application level? Or perhaps an
>>>> array of one of our primitive types? In general, each PDataType maps to a
>>>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html
>>>> ).
>>>> Thanks,
>>>> James
>>>>
>>>>
>>>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>>>> How can I do that?
>>>>>
>>>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>>>> specified it to have a sqltype=123.
>>>>> I chose this number because I am not sure what to add here. I can
>>>>> create a table with this but when I insert something, its type is shown as
>>>>> NULL.
>>>>>
>>>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>>>
>>>>> Any help is appreciated.
>>>>>
>>>>> Regards
>>>>>
>>>>> --
>>>>>
>>>>> Regards
>>>>> Faisal Moeen
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Regards
>>> Faisal Moeen
>>>
>>
>>
>>
>> --
>> Best regards,
>>
>>    - Andy
>>
>> Problems worthy of attack prove their worth by hitting back. - Piet Hein
>> (via Tom White)
>>
>
>
>
> --
>
> Regards
> Faisal Moeen
>



-- 

Regards
Faisal Moeen

Re: How to implement custom datatypes

Posted by faisal moeen <fm...@gmail.com>.
Thanks Andrew. The algebra I am working on primarily handles moving objects
or in other words trajectories over time.

I did not read the standard but as far as I know, the way time is handled,
is different. For example, version is a first class concept in SQL 2011 but
not in Guting's Alegebra. Guting's algebra gives us a more clear model of
changing objects with respect to time. This gives us more logical
understanding of how to ask different questions and how to write queries.I
won't be wrong is saying that guring's Algebra is ideal for modeling
objects that move both in space and time.

Regards


On Wed, May 28, 2014 at 8:53 PM, Andrew Purtell <ap...@apache.org> wrote:

> That is a fascinating set of slides.
>
> How does the envisioned spatio-temporal algebra and syntax (or UDF)
> changes relate to SQL 2011 temporal concepts and syntax support? Or do
> they? Please see https://issues.apache.org/jira/browse/PHOENIX-967 .
>
>
> On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com> wrote:
>
>> Hi James,
>>
>> Some of my datatypes can use the existing sql types but most of them
>> require to have custom implementations. I plan to start with point & line.
>> Please find attached the explanation of some of the types. I prefer to have
>> its support at the server level because I also plan to implement a
>> spatio-temporal join later. In that case, the local join would be through a
>> co-processor so I will need the support of the types and operations at the
>> region servers.
>>
>> Regards
>>
>>
>> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>
>> wrote:
>>
>>> Hi Faisal,
>>> That sounds very interesting. What will be the structure of your custom
>>> data type? Would you be able to get away with using the existing fixed
>>> binary type and interpret the value at the application level? Or perhaps an
>>> array of one of our primitive types? In general, each PDataType maps to a
>>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
>>> Thanks,
>>> James
>>>
>>>
>>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>>> How can I do that?
>>>>
>>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>>> specified it to have a sqltype=123.
>>>> I chose this number because I am not sure what to add here. I can
>>>> create a table with this but when I insert something, its type is shown as
>>>> NULL.
>>>>
>>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>>
>>>> Any help is appreciated.
>>>>
>>>> Regards
>>>>
>>>> --
>>>>
>>>> Regards
>>>> Faisal Moeen
>>>>
>>>
>>>
>>
>>
>> --
>>
>> Regards
>> Faisal Moeen
>>
>
>
>
> --
> Best regards,
>
>    - Andy
>
> Problems worthy of attack prove their worth by hitting back. - Piet Hein
> (via Tom White)
>



-- 

Regards
Faisal Moeen

Re: How to implement custom datatypes

Posted by Andrew Purtell <ap...@apache.org>.
That is a fascinating set of slides.

How does the envisioned spatio-temporal algebra and syntax (or UDF) changes
relate to SQL 2011 temporal concepts and syntax support? Or do they? Please
see https://issues.apache.org/jira/browse/PHOENIX-967 .


On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com> wrote:

> Hi James,
>
> Some of my datatypes can use the existing sql types but most of them
> require to have custom implementations. I plan to start with point & line.
> Please find attached the explanation of some of the types. I prefer to have
> its support at the server level because I also plan to implement a
> spatio-temporal join later. In that case, the local join would be through a
> co-processor so I will need the support of the types and operations at the
> region servers.
>
> Regards
>
>
> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>wrote:
>
>> Hi Faisal,
>> That sounds very interesting. What will be the structure of your custom
>> data type? Would you be able to get away with using the existing fixed
>> binary type and interpret the value at the application level? Or perhaps an
>> array of one of our primitive types? In general, each PDataType maps to a
>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
>> Thanks,
>> James
>>
>>
>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>> How can I do that?
>>>
>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>> specified it to have a sqltype=123.
>>> I chose this number because I am not sure what to add here. I can create
>>> a table with this but when I insert something, its type is shown as NULL.
>>>
>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>
>>> Any help is appreciated.
>>>
>>> Regards
>>>
>>> --
>>>
>>> Regards
>>> Faisal Moeen
>>>
>>
>>
>
>
> --
>
> Regards
> Faisal Moeen
>



-- 
Best regards,

   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein
(via Tom White)

Re: How to implement custom datatypes

Posted by James Taylor <ja...@apache.org>.
Phoenix has support for ARRAY types.

For data types, for efficiency Phoenix tries to operate on them in their
binary form. If you're going to use them in the row key, there are rules
that they have to follow: namely that the byte representation sorts in the
natural sort order. If the server has to serialize and deserialize them all
the time, performance will be poor.

I think you'll likely run into issues by trying to create your own data
types rather than focusing on the problem you really want to solve. I'd
just use primitive types and drop down to BINARY if you come up with a good
binary representation of spatio datatype. Then once you get more
information around schema and row key design, benchmarking, built-in
functions, etc. you can look at how to improve your programming model by
implementing STRUCTs in Phoenix or introducing official new data types.

If you go with your own data type, use null in place of  new LongCodec().
Only primitive types have codecs - they're provide a way to
serialize/deserialize without creating Java objects. Then you'd need to
implement the serialization of Instant through the toBytes() method and the
deserialization through the toObject() method of your new PDataType enum.

Thanks,
James


On Tue, May 27, 2014 at 10:41 AM, faisal moeen <fm...@gmail.com> wrote:

> Hi James,
>
> I could flatten the datatypes using arrays but I guess its not supported
> by phoenix yet. How would you suggest to represent a 2d line with existing
> datatypes.
>
> If I go down the existing way, what are the pros and cons. If I define my
> datatype like this:
>
> MYDT("MYDT", 123, Instant.class, new LongCodec()) {}
>
> Won't it give me an object of "Instant" at the client?
>
> Regards
> Faisal Moeen
>
>
> On Tue, May 27, 2014 at 7:10 PM, James Taylor <ja...@apache.org>wrote:
>
>> Hi Faisal,
>> Thanks for sharing that document - it's very interesting. Sounds like a
>> good use case for a STRUCT (
>> https://issues.apache.org/jira/browse/PHOENIX-477), but we don't have
>> support for that yet.
>>
>> You could continue down the path you're going by implementing your own
>> data type, but none of the SQL tooling would know how to interpret your
>> type. Have you considered flattening your data model into primitives? It's
>> not as elegant, but instead of passing a struct through to your built-in
>> functions, you could for example pass in the primitives (or arrays). This
>> might be sufficient for understanding the best HBase schema design and
>> benchmarking over various row key designs.
>>
>> Regards,
>> James
>>
>>
>> On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com>wrote:
>>
>>> Hi James,
>>>
>>> Some of my datatypes can use the existing sql types but most of them
>>> require to have custom implementations. I plan to start with point & line.
>>> Please find attached the explanation of some of the types. I prefer to have
>>> its support at the server level because I also plan to implement a
>>> spatio-temporal join later. In that case, the local join would be through a
>>> co-processor so I will need the support of the types and operations at the
>>> region servers.
>>>
>>> Regards
>>>
>>>
>>> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>wrote:
>>>
>>>> Hi Faisal,
>>>> That sounds very interesting. What will be the structure of your custom
>>>> data type? Would you be able to get away with using the existing fixed
>>>> binary type and interpret the value at the application level? Or perhaps an
>>>> array of one of our primitive types? In general, each PDataType maps to a
>>>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html
>>>> ).
>>>> Thanks,
>>>> James
>>>>
>>>>
>>>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>>>> How can I do that?
>>>>>
>>>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>>>> specified it to have a sqltype=123.
>>>>> I chose this number because I am not sure what to add here. I can
>>>>> create a table with this but when I insert something, its type is shown as
>>>>> NULL.
>>>>>
>>>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>>>
>>>>> Any help is appreciated.
>>>>>
>>>>> Regards
>>>>>
>>>>> --
>>>>>
>>>>> Regards
>>>>> Faisal Moeen
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Regards
>>> Faisal Moeen
>>>
>>
>>
>
>
> --
>
> Regards
> Faisal Moeen
>

Re: How to implement custom datatypes

Posted by faisal moeen <fm...@gmail.com>.
Hi James,

I could flatten the datatypes using arrays but I guess its not supported by
phoenix yet. How would you suggest to represent a 2d line with existing
datatypes.

If I go down the existing way, what are the pros and cons. If I define my
datatype like this:

MYDT("MYDT", 123, Instant.class, new LongCodec()) {}

Won't it give me an object of "Instant" at the client?

Regards
Faisal Moeen


On Tue, May 27, 2014 at 7:10 PM, James Taylor <ja...@apache.org>wrote:

> Hi Faisal,
> Thanks for sharing that document - it's very interesting. Sounds like a
> good use case for a STRUCT (
> https://issues.apache.org/jira/browse/PHOENIX-477), but we don't have
> support for that yet.
>
> You could continue down the path you're going by implementing your own
> data type, but none of the SQL tooling would know how to interpret your
> type. Have you considered flattening your data model into primitives? It's
> not as elegant, but instead of passing a struct through to your built-in
> functions, you could for example pass in the primitives (or arrays). This
> might be sufficient for understanding the best HBase schema design and
> benchmarking over various row key designs.
>
> Regards,
> James
>
>
> On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com> wrote:
>
>> Hi James,
>>
>> Some of my datatypes can use the existing sql types but most of them
>> require to have custom implementations. I plan to start with point & line.
>> Please find attached the explanation of some of the types. I prefer to have
>> its support at the server level because I also plan to implement a
>> spatio-temporal join later. In that case, the local join would be through a
>> co-processor so I will need the support of the types and operations at the
>> region servers.
>>
>> Regards
>>
>>
>> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>wrote:
>>
>>> Hi Faisal,
>>> That sounds very interesting. What will be the structure of your custom
>>> data type? Would you be able to get away with using the existing fixed
>>> binary type and interpret the value at the application level? Or perhaps an
>>> array of one of our primitive types? In general, each PDataType maps to a
>>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
>>> Thanks,
>>> James
>>>
>>>
>>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>>> How can I do that?
>>>>
>>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>>> specified it to have a sqltype=123.
>>>> I chose this number because I am not sure what to add here. I can
>>>> create a table with this but when I insert something, its type is shown as
>>>> NULL.
>>>>
>>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>>
>>>> Any help is appreciated.
>>>>
>>>> Regards
>>>>
>>>> --
>>>>
>>>> Regards
>>>> Faisal Moeen
>>>>
>>>
>>>
>>
>>
>> --
>>
>> Regards
>> Faisal Moeen
>>
>
>


-- 

Regards
Faisal Moeen

Re: How to implement custom datatypes

Posted by James Taylor <ja...@apache.org>.
Hi Faisal,
Thanks for sharing that document - it's very interesting. Sounds like a
good use case for a STRUCT (
https://issues.apache.org/jira/browse/PHOENIX-477), but we don't have
support for that yet.

You could continue down the path you're going by implementing your own data
type, but none of the SQL tooling would know how to interpret your type.
Have you considered flattening your data model into primitives? It's not as
elegant, but instead of passing a struct through to your built-in
functions, you could for example pass in the primitives (or arrays). This
might be sufficient for understanding the best HBase schema design and
benchmarking over various row key designs.

Regards,
James


On Tue, May 27, 2014 at 9:41 AM, faisal moeen <fm...@gmail.com> wrote:

> Hi James,
>
> Some of my datatypes can use the existing sql types but most of them
> require to have custom implementations. I plan to start with point & line.
> Please find attached the explanation of some of the types. I prefer to have
> its support at the server level because I also plan to implement a
> spatio-temporal join later. In that case, the local join would be through a
> co-processor so I will need the support of the types and operations at the
> region servers.
>
> Regards
>
>
> On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>wrote:
>
>> Hi Faisal,
>> That sounds very interesting. What will be the structure of your custom
>> data type? Would you be able to get away with using the existing fixed
>> binary type and interpret the value at the application level? Or perhaps an
>> array of one of our primitive types? In general, each PDataType maps to a
>> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
>> Thanks,
>> James
>>
>>
>> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>>> How can I do that?
>>>
>>> Until now I have added my custom datatype "MYDT" to PDataType and
>>> specified it to have a sqltype=123.
>>> I chose this number because I am not sure what to add here. I can create
>>> a table with this but when I insert something, its type is shown as NULL.
>>>
>>> I am using HBase 0.94.18 with Phoenix 3.0.
>>>
>>> Any help is appreciated.
>>>
>>> Regards
>>>
>>> --
>>>
>>> Regards
>>> Faisal Moeen
>>>
>>
>>
>
>
> --
>
> Regards
> Faisal Moeen
>

Re: How to implement custom datatypes

Posted by faisal moeen <fm...@gmail.com>.
Hi James,

Some of my datatypes can use the existing sql types but most of them
require to have custom implementations. I plan to start with point & line.
Please find attached the explanation of some of the types. I prefer to have
its support at the server level because I also plan to implement a
spatio-temporal join later. In that case, the local join would be through a
co-processor so I will need the support of the types and operations at the
region servers.

Regards


On Tue, May 27, 2014 at 6:30 PM, James Taylor <ja...@apache.org>wrote:

> Hi Faisal,
> That sounds very interesting. What will be the structure of your custom
> data type? Would you be able to get away with using the existing fixed
> binary type and interpret the value at the application level? Or perhaps an
> array of one of our primitive types? In general, each PDataType maps to a
> SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
> Thanks,
> James
>
>
> On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com> wrote:
>
>> Hi,
>>
>> I am trying to implement custom spatio-temporal datatypes for Phoenix.
>> How can I do that?
>>
>> Until now I have added my custom datatype "MYDT" to PDataType and
>> specified it to have a sqltype=123.
>> I chose this number because I am not sure what to add here. I can create
>> a table with this but when I insert something, its type is shown as NULL.
>>
>> I am using HBase 0.94.18 with Phoenix 3.0.
>>
>> Any help is appreciated.
>>
>> Regards
>>
>> --
>>
>> Regards
>> Faisal Moeen
>>
>
>


-- 

Regards
Faisal Moeen

Re: How to implement custom datatypes

Posted by James Taylor <ja...@apache.org>.
Hi Faisal,
That sounds very interesting. What will be the structure of your custom
data type? Would you be able to get away with using the existing fixed
binary type and interpret the value at the application level? Or perhaps an
array of one of our primitive types? In general, each PDataType maps to a
SQL type (http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html).
Thanks,
James


On Tue, May 27, 2014 at 9:04 AM, faisal moeen <fm...@gmail.com> wrote:

> Hi,
>
> I am trying to implement custom spatio-temporal datatypes for Phoenix. How
> can I do that?
>
> Until now I have added my custom datatype "MYDT" to PDataType and
> specified it to have a sqltype=123.
> I chose this number because I am not sure what to add here. I can create a
> table with this but when I insert something, its type is shown as NULL.
>
> I am using HBase 0.94.18 with Phoenix 3.0.
>
> Any help is appreciated.
>
> Regards
>
> --
>
> Regards
> Faisal Moeen
>