parquet-java icon indicating copy to clipboard operation
parquet-java copied to clipboard

PARQUET-1925: Introduce Velocity Template Engine to Parquet Generator

Open belugabehr opened this issue 5 years ago • 6 comments

Make sure you have checked all steps below.

Jira

  • [X] My PR addresses the following Parquet Jira issues and references them in the PR title. For example, "PARQUET-1234: My Parquet PR"
    • https://issues.apache.org/jira/browse/PARQUET-XXX
    • In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.

Tests

  • [X] My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • [X] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • [X] In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain Javadoc that explain what it does

belugabehr avatar Oct 15 '20 16:10 belugabehr

I like this very much. Would it be possible to have a test to check the output of the template?

Great! I started working on some of the more complex templates, but I didn't want to invest too much time before getting some buy-in on this effort.

I was manually generating and compiling the output for testing. I'll see if I can write a unit test.

belugabehr avatar Oct 22 '20 14:10 belugabehr

OK. I added a unit test. I don't love the test, but it's something (and better than nothing). I'm also not sure how good of an example it will be for future tests in this 'generator' project.

I ran into a host of issues trying to test this. It's probably best to, in the future, change Version to implement an interface and then use normal getters instead of static fields. Since this class is compiled without any interface, there is nothing to import into the test at compile time in order to cast it to something I can then easily test against.

belugabehr avatar Oct 22 '20 15:10 belugabehr

@Fokko @gszadovszky What are your thoughts on this and moving it forward?

belugabehr avatar Nov 03 '20 16:11 belugabehr

It looks good to me. We already have the unit test VersionTest to validate Version. Writing this additional test for the code generation made me more confident accepting this change. I am not an expert of velocity but looks much better than our original code so I would appreciate your work going forward.

gszadovszky avatar Nov 09 '20 16:11 gszadovszky

@belugabehr, are you planning to work further in this PR or shall I merge it as is?

gszadovszky avatar Nov 12 '20 16:11 gszadovszky

@belugabehr As @gszadovszky asked, do you plan to work on this further?

shangxinli avatar Nov 12 '21 17:11 shangxinli