You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nathan Marz (JIRA)" <ji...@apache.org> on 2008/11/04 04:21:44 UTC
[jira] Created: (THRIFT-191) Add ability to get a field name from a
field id
Add ability to get a field name from a field id
-----------------------------------------------
Key: THRIFT-191
URL: https://issues.apache.org/jira/browse/THRIFT-191
Project: Thrift
Issue Type: New Feature
Components: Compiler (Java)
Reporter: Nathan Marz
Priority: Minor
It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
struct Foo {
1: optional i32 number;
}
I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Kozikowski reassigned THRIFT-191:
---------------------------------------
Assignee: Piotr Kozikowski
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Nathan Marz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654917#action_12654917 ]
Nathan Marz commented on THRIFT-191:
------------------------------------
I agree, a static map of meta-data would be ideal. This would allow for iterating over the field's as well, and allow for additional meta-data (besides the field name) to be accessible.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654945#action_12654945 ]
Bryan Duxbury commented on THRIFT-191:
--------------------------------------
It sounds like a map of field id to metadata structure is probably a good idea. We can stick the upcoming annotation data in there as well.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656891#action_12656891 ]
Bryan Duxbury commented on THRIFT-191:
--------------------------------------
I applied this patch and tested it out. It works really well. I think we're ready for commit.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch, thrift-191v2.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656069#action_12656069 ]
Bryan Duxbury commented on THRIFT-191:
--------------------------------------
I like the map declaration, but I think that the MetaData class should live outside of the generated code. It's not actually a class that will vary by structure, so it should just live in c.f.thrift.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-191) Add ability to get a field name from a
field id
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury updated THRIFT-191:
---------------------------------
Patch Info: [Patch Available]
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch, thrift-191v2.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "Mark Slee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645084#action_12645084 ]
Mark Slee commented on THRIFT-191:
----------------------------------
Sounds reasonable. We had something like this implemented in PHP at one point. I think the best way to do this is as a static map of meta-data in the class.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (THRIFT-191) Add ability to get a field name from
a field id
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Reiss resolved THRIFT-191.
--------------------------------
Resolution: Fixed
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch, thrift-191v2.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-191) Add ability to get a field name from a
field id
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Kozikowski updated THRIFT-191:
------------------------------------
Attachment: thrift-191.patch
Here is a first patch. For the time being the metadata structure only contains the field name and is an inner class just like Isset, but unlike Isset this one will be the same for all classes, so may be it should be placed somewhere else. Let me know your thoughts.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (THRIFT-191) Add ability to get a field name from a
field id
Posted by "Piotr Kozikowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Piotr Kozikowski updated THRIFT-191:
------------------------------------
Attachment: thrift-191v2.patch
Here is second version of the patch that moves the MetaData class from the generated code to package com.facebook.thrift.
> Add ability to get a field name from a field id
> -----------------------------------------------
>
> Key: THRIFT-191
> URL: https://issues.apache.org/jira/browse/THRIFT-191
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Assignee: Piotr Kozikowski
> Priority: Minor
> Attachments: thrift-191.patch, thrift-191v2.patch
>
>
> It would be nice to be able to get a field name for a field id. For instance, if I have the following struct:
> struct Foo {
> 1: optional i32 number;
> }
> I should be able to say something like "Foo.getFieldNameForFieldId(1)" and get back the string "number". The use case for this is for debugging/logging.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.