You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Eric Evans (JIRA)" <ji...@apache.org> on 2010/04/02 03:13:27 UTC

[jira] Created: (AVRO-494) the genavro format should support defaults

the genavro format should support defaults
------------------------------------------

                 Key: AVRO-494
                 URL: https://issues.apache.org/jira/browse/AVRO-494
             Project: Avro
          Issue Type: Improvement
          Components: java
    Affects Versions: 1.3.2
            Reporter: Eric Evans
            Priority: Minor


It would be great if the genavro format also supported assigning default values.

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


[jira] Commented: (AVRO-494) the genavro format should support defaults

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12853923#action_12853923 ] 

Hudson commented on AVRO-494:
-----------------------------

Integrated in Cassandra #399 (See [http://hudson.zones.apache.org/hudson/job/Cassandra/399/])
    genavro schema file (not to be used until )

Patch by eevans


> the genavro format should support defaults
> ------------------------------------------
>
>                 Key: AVRO-494
>                 URL: https://issues.apache.org/jira/browse/AVRO-494
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Eric Evans
>            Priority: Minor
>
> It would be great if the genavro format also supported assigning default values.

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


[jira] Updated: (AVRO-494) the genavro format should support defaults

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Evans updated AVRO-494:
----------------------------

    Attachment: v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt

> the genavro format should support defaults
> ------------------------------------------
>
>                 Key: AVRO-494
>                 URL: https://issues.apache.org/jira/browse/AVRO-494
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Eric Evans
>            Priority: Minor
>         Attachments: v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt
>
>
> It would be great if the genavro format also supported assigning default values.

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


[jira] Commented: (AVRO-494) the genavro format should support defaults

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854584#action_12854584 ] 

Doug Cutting commented on AVRO-494:
-----------------------------------

> it's actually adding them as properties to the attributes type object.

If we want to use attributes, then we'd need to special-case the type attributes "order" and "default", which would mean that you couldn't also have a type attribute named "order" or "default".

Another syntax to consider for default values might be something like:

string foo = "foo";

Ordering might be done with keywords in the record field definitition, like:

decreasing string foo = "foo";
unordered string bar = "bar";

As for including JSON, I think we need to add grammar rules for Json to the parser.  Todd, is that what you tried?



> the genavro format should support defaults
> ------------------------------------------
>
>                 Key: AVRO-494
>                 URL: https://issues.apache.org/jira/browse/AVRO-494
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Eric Evans
>            Priority: Minor
>         Attachments: v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt
>
>
> It would be great if the genavro format also supported assigning default values.

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


[jira] Commented: (AVRO-494) the genavro format should support defaults

Posted by "Todd Lipcon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854336#action_12854336 ] 

Todd Lipcon commented on AVRO-494:
----------------------------------

I spent a few hours trying to figure out how to use Jackson and JavaCC together in such a way that I could put inline JSON in certain places in genavro. Unfortunately it turned out to be really rather difficult because of lookahead, etc. Any JavaCC or Jackson gurus out there?

> the genavro format should support defaults
> ------------------------------------------
>
>                 Key: AVRO-494
>                 URL: https://issues.apache.org/jira/browse/AVRO-494
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Eric Evans
>            Priority: Minor
>         Attachments: v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt
>
>
> It would be great if the genavro format also supported assigning default values.

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


[jira] Commented: (AVRO-494) the genavro format should support defaults

Posted by "Eric Evans (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12854312#action_12854312 ] 

Eric Evans commented on AVRO-494:
---------------------------------

The parser was written to handle arbitrary attributes using the @identifer annotation, but this isn't working as expected; it's actually adding them as properties to the attributes type object.

So in other words you end up with:

{noformat}
{name: aname, type: {type: string, order: ignore}}
{noformat}

... instead of:

{noformat}
{name: aname, type: string, order: ignore}
{noformat}

The patch attached here parses the attributes for default and order into JsonNode and Field.Order instances respectively and passes them into the Field constructor. There is probably a better way. For example, this requires you to supply an attribute that parses as valid JSON. For example:

{noformat}
record FooRecord {
  @default(false)
  boolean yesno;

  @default(100)
  int number;
  
  /* Fails; parses to the bareword ignore */
  @order("ignore")
  string badstring;

  /* Succeeds; parses to "ignore" */
  @order("\"ignore\"")
  string goodstring;
}
{noformat}

Thoughts?

> the genavro format should support defaults
> ------------------------------------------
>
>                 Key: AVRO-494
>                 URL: https://issues.apache.org/jira/browse/AVRO-494
>             Project: Avro
>          Issue Type: Improvement
>          Components: java
>    Affects Versions: 1.3.2
>            Reporter: Eric Evans
>            Priority: Minor
>         Attachments: v1-0001-AVRO-494.-teach-genavro-about-defaults-and-fix-order.txt
>
>
> It would be great if the genavro format also supported assigning default values.

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