FAQ
Variable names generated by Record I/O should not clash with user fields
------------------------------------------------------------------------

Key: HADOOP-1994
URL: https://issues.apache.org/jira/browse/HADOOP-1994
Project: Hadoop
Issue Type: Bug
Reporter: Vivek Ratan
Assignee: Vivek Ratan


The code (Java and C++) spit out by the Record I/O compiler contains variables. We need to make sure these variable names don't clash with names used by users in the DDL, otherwise the generated code will not compile. Variable names such as 'a', 'peer', etc, are used. We need better names. For example, if I have a DDL of the form
{code}
class s1 {
int a;
boolean peer;
int a_;
}
{code}

Both the Java and C++ code will not compile.



--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

  • Vivek Ratan (JIRA) at Oct 4, 2007 at 10:34 am
    [ https://issues.apache.org/jira/browse/HADOOP-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532379 ]

    Vivek Ratan commented on HADOOP-1994:
    -------------------------------------

    One simple and effective solution is to prefix generated variable names with a special string which users are unlikely to use. I've made changes (which show up in the patch for HADOOP-1883), where we prefix variables with "__rio__". As long as DDL users do not define field names that begin with "__rio__" (which is unlikely), our code's fine. This string can easily be changed if required (it's a const setting).
    Variable names generated by Record I/O should not clash with user fields
    ------------------------------------------------------------------------

    Key: HADOOP-1994
    URL: https://issues.apache.org/jira/browse/HADOOP-1994
    Project: Hadoop
    Issue Type: Bug
    Reporter: Vivek Ratan
    Assignee: Vivek Ratan

    The code (Java and C++) spit out by the Record I/O compiler contains variables. We need to make sure these variable names don't clash with names used by users in the DDL, otherwise the generated code will not compile. Variable names such as 'a', 'peer', etc, are used. We need better names. For example, if I have a DDL of the form
    {code}
    class s1 {
    int a;
    boolean peer;
    int a_;
    }
    {code}
    Both the Java and C++ code will not compile.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Vivek Ratan (JIRA) at Oct 4, 2007 at 10:50 am
    [ https://issues.apache.org/jira/browse/HADOOP-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532383 ]

    Vivek Ratan commented on HADOOP-1994:
    -------------------------------------

    That should be "rio" (for Record I/O) with one underscore before and one underscore after.
    Variable names generated by Record I/O should not clash with user fields
    ------------------------------------------------------------------------

    Key: HADOOP-1994
    URL: https://issues.apache.org/jira/browse/HADOOP-1994
    Project: Hadoop
    Issue Type: Bug
    Reporter: Vivek Ratan
    Assignee: Vivek Ratan

    The code (Java and C++) spit out by the Record I/O compiler contains variables. We need to make sure these variable names don't clash with names used by users in the DDL, otherwise the generated code will not compile. Variable names such as 'a', 'peer', etc, are used. We need better names. For example, if I have a DDL of the form
    {code}
    class s1 {
    int a;
    boolean peer;
    int a_;
    }
    {code}
    Both the Java and C++ code will not compile.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Owen O'Malley (JIRA) at Oct 4, 2007 at 5:03 pm
    [ https://issues.apache.org/jira/browse/HADOOP-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532481 ]

    Owen O'Malley commented on HADOOP-1994:
    ---------------------------------------

    This is a good idea, but I'd vote for something very simple as the prefix. Namely "_". We should also enforce that user fields do not start with the prefix.
    Variable names generated by Record I/O should not clash with user fields
    ------------------------------------------------------------------------

    Key: HADOOP-1994
    URL: https://issues.apache.org/jira/browse/HADOOP-1994
    Project: Hadoop
    Issue Type: Bug
    Reporter: Vivek Ratan
    Assignee: Vivek Ratan

    The code (Java and C++) spit out by the Record I/O compiler contains variables. We need to make sure these variable names don't clash with names used by users in the DDL, otherwise the generated code will not compile. Variable names such as 'a', 'peer', etc, are used. We need better names. For example, if I have a DDL of the form
    {code}
    class s1 {
    int a;
    boolean peer;
    int a_;
    }
    {code}
    Both the Java and C++ code will not compile.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Vivek Ratan (JIRA) at Oct 5, 2007 at 5:45 am
    [ https://issues.apache.org/jira/browse/HADOOP-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532574 ]

    Vivek Ratan commented on HADOOP-1994:
    -------------------------------------

    I think a prefix more complicated than an underscore is better. The prefix is used in generated code, which presumably the user will never want to go through if everything works well. So readability of code is not a big issue. Why, then, restrict the user to not using fields starting with an underscore? It seems like too harsh a restriction. It's much better to tell them to not have fields starting with <underscore>rio<underscore> than just an underscore.

    Regarding enforcing, I think that's a good idea. We can have the DDL complier do that.
    Variable names generated by Record I/O should not clash with user fields
    ------------------------------------------------------------------------

    Key: HADOOP-1994
    URL: https://issues.apache.org/jira/browse/HADOOP-1994
    Project: Hadoop
    Issue Type: Bug
    Reporter: Vivek Ratan
    Assignee: Vivek Ratan

    The code (Java and C++) spit out by the Record I/O compiler contains variables. We need to make sure these variable names don't clash with names used by users in the DDL, otherwise the generated code will not compile. Variable names such as 'a', 'peer', etc, are used. We need better names. For example, if I have a DDL of the form
    {code}
    class s1 {
    int a;
    boolean peer;
    int a_;
    }
    {code}
    Both the Java and C++ code will not compile.
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-dev @
categorieshadoop
postedOct 4, '07 at 10:32a
activeOct 5, '07 at 5:45a
posts5
users1
websitehadoop.apache.org...
irc#hadoop

1 user in discussion

Vivek Ratan (JIRA): 5 posts

People

Translate

site design / logo © 2022 Grokbase