Grokbase Groups Pig dev November 2011
FAQ
Expose version information more cleanly
---------------------------------------

Key: PIG-2380
URL: https://issues.apache.org/jira/browse/PIG-2380
Project: Pig
Issue Type: Improvement
Reporter: Jonathan Coveney
Assignee: Jonathan Coveney
Priority: Minor
Fix For: 0.11
Attachments: PIG2380.patch

Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version).

Example:
{code}
import org.apache.pig.Main;

public class Thing {
public static void main(String[] args) {
System.out.println(Main.getMajorVersion());
System.out.println(Main.getMinorVersion());
System.out.println(Main.getPatchVersion());
System.out.println(Main.getSvnRevision());
System.out.println(Main.getBuildTime());
}
}
{code}

will return

{code}

11

1202387
Nov 15 2011, 15:37:14

{code}

which comprises

{code}
Apache Pig version 0.11.0-SNAPSHOT (r1202387)
compiled Nov 15 2011, 15:37:14
{code}

I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

Search Discussions

  • Jonathan Coveney (Updated) (JIRA) at Nov 17, 2011 at 5:19 am
    [ https://issues.apache.org/jira/browse/PIG-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Jonathan Coveney updated PIG-2380:
    ----------------------------------

    Attachment: PIG2380.patch
    Expose version information more cleanly
    ---------------------------------------

    Key: PIG-2380
    URL: https://issues.apache.org/jira/browse/PIG-2380
    Project: Pig
    Issue Type: Improvement
    Reporter: Jonathan Coveney
    Assignee: Jonathan Coveney
    Priority: Minor
    Fix For: 0.11

    Attachments: PIG2380.patch


    Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version).
    Example:
    {code}
    import org.apache.pig.Main;
    public class Thing {
    public static void main(String[] args) {
    System.out.println(Main.getMajorVersion());
    System.out.println(Main.getMinorVersion());
    System.out.println(Main.getPatchVersion());
    System.out.println(Main.getSvnRevision());
    System.out.println(Main.getBuildTime());
    }
    }
    {code}
    will return
    {code}

    11

    1202387
    Nov 15 2011, 15:37:14

    {code}
    which comprises
    {code}
    Apache Pig version 0.11.0-SNAPSHOT (r1202387)
    compiled Nov 15 2011, 15:37:14
    {code}
    I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    For more information on JIRA, see: http://www.atlassian.com/software/jira
  • Gianmarco De Francisci Morales (Commented) (JIRA) at Nov 17, 2011 at 3:49 pm
    [ https://issues.apache.org/jira/browse/PIG-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152110#comment-13152110 ]

    Gianmarco De Francisci Morales commented on PIG-2380:
    -----------------------------------------------------

    Jonathan,
    the patch does not apply cleanly to trunk for me. Could you rebase it?

    Also, for the static initializer, running the Main class without packaging it into a jar (that means, using the build folder for the classpath) throws an exception (also in current trunk).

    {code}
    java -cp build/classes:build/ivy/lib/Pig/* org.apache.pig.Main -h
    11/11/17 16:45:39 ERROR pig.Main: ERROR 2999: Unexpected internal error. unable to read pigs manifest file
    11/11/17 16:45:39 WARN pig.Main: There is no log file to write to.
    11/11/17 16:45:39 ERROR pig.Main: java.lang.RuntimeException: unable to read pigs manifest file
    at org.apache.pig.Main.getVersionString(Main.java:749)
    at org.apache.pig.Main.run(Main.java:249)
    at org.apache.pig.Main.main(Main.java:111)
    Caused by: java.lang.NullPointerException
    at java.io.File.(JarFile.java:72)
    at org.apache.pig.Main.getVersionString(Main.java:737)
    ... 2 more
    {code}

    I would propose to fix it, we don't need to throw a RuntimeException for it.
    Let's just warn the user and go on.
    Expose version information more cleanly
    ---------------------------------------

    Key: PIG-2380
    URL: https://issues.apache.org/jira/browse/PIG-2380
    Project: Pig
    Issue Type: Improvement
    Reporter: Jonathan Coveney
    Assignee: Jonathan Coveney
    Priority: Minor
    Fix For: 0.11

    Attachments: PIG2380.patch


    Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version).
    Example:
    {code}
    import org.apache.pig.Main;
    public class Thing {
    public static void main(String[] args) {
    System.out.println(Main.getMajorVersion());
    System.out.println(Main.getMinorVersion());
    System.out.println(Main.getPatchVersion());
    System.out.println(Main.getSvnRevision());
    System.out.println(Main.getBuildTime());
    }
    }
    {code}
    will return
    {code}

    11

    1202387
    Nov 15 2011, 15:37:14

    {code}
    which comprises
    {code}
    Apache Pig version 0.11.0-SNAPSHOT (r1202387)
    compiled Nov 15 2011, 15:37:14
    {code}
    I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    For more information on JIRA, see: http://www.atlassian.com/software/jira
  • Jonathan Coveney (Updated) (JIRA) at Nov 17, 2011 at 9:50 pm
    [ https://issues.apache.org/jira/browse/PIG-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Jonathan Coveney updated PIG-2380:
    ----------------------------------

    Attachment: PIG2380_1.patch

    I changed the logic so it will just warn the user if the manifest isn't available. This has the beneficial side effect (which you predicted, Gianmarco) of letting people run -h without the Pig jar present. I rediffed against an updated branch and successfully applied to a clean branch, but let me know if you hit an issue.

    I ran ant test-commit just to be thorough: no issues :)
    Expose version information more cleanly
    ---------------------------------------

    Key: PIG-2380
    URL: https://issues.apache.org/jira/browse/PIG-2380
    Project: Pig
    Issue Type: Improvement
    Reporter: Jonathan Coveney
    Assignee: Jonathan Coveney
    Priority: Minor
    Fix For: 0.11

    Attachments: PIG2380.patch, PIG2380_1.patch


    Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version).
    Example:
    {code}
    import org.apache.pig.Main;
    public class Thing {
    public static void main(String[] args) {
    System.out.println(Main.getMajorVersion());
    System.out.println(Main.getMinorVersion());
    System.out.println(Main.getPatchVersion());
    System.out.println(Main.getSvnRevision());
    System.out.println(Main.getBuildTime());
    }
    }
    {code}
    will return
    {code}

    11

    1202387
    Nov 15 2011, 15:37:14

    {code}
    which comprises
    {code}
    Apache Pig version 0.11.0-SNAPSHOT (r1202387)
    compiled Nov 15 2011, 15:37:14
    {code}
    I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    For more information on JIRA, see: http://www.atlassian.com/software/jira
  • Gianmarco De Francisci Morales (Resolved) (JIRA) at Nov 18, 2011 at 10:21 am
    [ https://issues.apache.org/jira/browse/PIG-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Gianmarco De Francisci Morales resolved PIG-2380.
    -------------------------------------------------

    Resolution: Fixed

    +1
    Committed to trunk.
    Thanks Jonathan!
    Expose version information more cleanly
    ---------------------------------------

    Key: PIG-2380
    URL: https://issues.apache.org/jira/browse/PIG-2380
    Project: Pig
    Issue Type: Improvement
    Reporter: Jonathan Coveney
    Assignee: Jonathan Coveney
    Priority: Minor
    Fix For: 0.11

    Attachments: PIG2380.patch, PIG2380_1.patch


    Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version).
    Example:
    {code}
    import org.apache.pig.Main;
    public class Thing {
    public static void main(String[] args) {
    System.out.println(Main.getMajorVersion());
    System.out.println(Main.getMinorVersion());
    System.out.println(Main.getPatchVersion());
    System.out.println(Main.getSvnRevision());
    System.out.println(Main.getBuildTime());
    }
    }
    {code}
    will return
    {code}

    11

    1202387
    Nov 15 2011, 15:37:14

    {code}
    which comprises
    {code}
    Apache Pig version 0.11.0-SNAPSHOT (r1202387)
    compiled Nov 15 2011, 15:37:14
    {code}
    I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk.
    --
    This message is automatically generated by JIRA.
    If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
    For more information on JIRA, see: http://www.atlassian.com/software/jira

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriespig, hadoop
postedNov 17, '11 at 5:19a
activeNov 18, '11 at 10:21a
posts5
users1
websitepig.apache.org

People

Translate

site design / logo © 2022 Grokbase