You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by tgrall <gi...@git.apache.org> on 2015/10/13 14:49:13 UTC

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

GitHub user tgrall opened a pull request:

    https://github.com/apache/drill/pull/198

    Add Drill version, from Manifest, same as SqlLine in the sys.version …

    …see [DRILL-2726](https://issues.apache.org/jira/browse/DRILL-2726)
    
    This PR does the following:
    ```
    apache drill 1.2.0-SNAPSHOT
    "got drill?"
    0: jdbc:drill:zk=local> select * from sys.version;
    +-----------------+-------------------------------------------+-----------------------------------------------------------------+-----------------------------+--------------------+-----------------------------+
    | version_number  |                 commit_id                 |                         commit_message                          |         commit_time         |    build_email     |         build_time          |
    +-----------------+-------------------------------------------+-----------------------------------------------------------------+-----------------------------+--------------------+-----------------------------+
    | 1.2.0-SNAPSHOT  | b4d47c56b6484eedbf3f44516338da4cdbfbb7b4  | DRILL-3918: During expansion save the metadata for future use.  | 11.10.2015 @ 21:30:38 CEST  | tugdual@gmail.com  | 13.10.2015 @ 04:49:00 CEST  |
    +-----------------+-------------------------------------------+-----------------------------------------------------------------+-----------------------------+--------------------+-----------------------------+
    1 row selected (1.84 seconds)
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tgrall/drill DRILL-2726

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/drill/pull/198.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #198
    
----
commit 3a58761520a5b9eebc271823d24f6c118a5633b7
Author: Tugdual Grall <tu...@gmail.com>
Date:   2015-10-13T12:45:57Z

    Add Drill version, from Manifest, same as SqlLine in the sys.version see DRILL-2726

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:

    https://github.com/apache/drill/pull/198#discussion_r41880888
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java ---
    @@ -73,5 +78,33 @@ public void remove() {
         throw new UnsupportedOperationException();
       }
     
    +  /**
    +   *
    +   * @return version number x.y.z from Manifest file
    +   */
    +  private static String getDrillVersionFromManifest() {
    +    String appName = "";
    +    String appVersion = "";
    +    try {
    +      Enumeration<URL> resources = VersionInfo.class.getClassLoader()
    +              .getResources("META-INF/MANIFEST.MF");
    +      while (resources.hasMoreElements()) {
    +        Manifest manifest = new Manifest(resources.nextElement().openStream());
    +        // check that this is your manifest and do what you need or
    +        // get the next one
    +        appName = manifest.getMainAttributes()
    +                .getValue("Implementation-Title");
    +        if (appName != null && appName.toLowerCase().contains("drill")) {
    +          appVersion = manifest.getMainAttributes()
    +                  .getValue("Implementation-Version");
    +        }
    +      }
    +    } catch (IOException except) {
    +      appVersion = "";
    --- End diff --
    
    Let's change the fallback to "Unknown". Also, let's move this function to a utility method in common. We may want to grab this information elsewhere.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:

    https://github.com/apache/drill/pull/198#discussion_r41888485
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java ---
    @@ -73,5 +78,33 @@ public void remove() {
         throw new UnsupportedOperationException();
       }
     
    +  /**
    +   *
    +   * @return version number x.y.z from Manifest file
    +   */
    +  private static String getDrillVersionFromManifest() {
    +    String appName = "";
    +    String appVersion = "";
    +    try {
    +      Enumeration<URL> resources = VersionInfo.class.getClassLoader()
    +              .getResources("META-INF/MANIFEST.MF");
    +      while (resources.hasMoreElements()) {
    +        Manifest manifest = new Manifest(resources.nextElement().openStream());
    +        // check that this is your manifest and do what you need or
    +        // get the next one
    +        appName = manifest.getMainAttributes()
    +                .getValue("Implementation-Title");
    +        if (appName != null && appName.toLowerCase().contains("drill")) {
    +          appVersion = manifest.getMainAttributes()
    +                  .getValue("Implementation-Version");
    +        }
    +      }
    +    } catch (IOException except) {
    +      appVersion = "";
    --- End diff --
    
    Just getVersion. I think the iterator should stay here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:

    https://github.com/apache/drill/pull/198#discussion_r41880953
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java ---
    @@ -30,6 +32,7 @@
       public boolean beforeFirst = true;
     
       public static class VersionInfo {
    +    public String version_number = "";
    --- End diff --
    
    version instead of version_number is probably fine.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by tgrall <gi...@git.apache.org>.
Github user tgrall commented on a diff in the pull request:

    https://github.com/apache/drill/pull/198#discussion_r41883009
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/VersionIterator.java ---
    @@ -73,5 +78,33 @@ public void remove() {
         throw new UnsupportedOperationException();
       }
     
    +  /**
    +   *
    +   * @return version number x.y.z from Manifest file
    +   */
    +  private static String getDrillVersionFromManifest() {
    +    String appName = "";
    +    String appVersion = "";
    +    try {
    +      Enumeration<URL> resources = VersionInfo.class.getClassLoader()
    +              .getResources("META-INF/MANIFEST.MF");
    +      while (resources.hasMoreElements()) {
    +        Manifest manifest = new Manifest(resources.nextElement().openStream());
    +        // check that this is your manifest and do what you need or
    +        // get the next one
    +        appName = manifest.getMainAttributes()
    +                .getValue("Implementation-Title");
    +        if (appName != null && appName.toLowerCase().contains("drill")) {
    +          appVersion = manifest.getMainAttributes()
    +                  .getValue("Implementation-Version");
    +        }
    +      }
    +    } catch (IOException except) {
    +      appVersion = "";
    --- End diff --
    
    Do you want me to move the getVersion method in this package:
    https://github.com/apache/drill/tree/master/common/src/main/java/org/apache/drill/common/util ?
    
    Should I move the full VersionIterator there? and call it from the store.sys?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:

    https://github.com/apache/drill/pull/198#issuecomment-147749104
  
    Nice! This is very helpful. Thanks for pulling this together. A few little comments and we'll get this incorporated.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/drill/pull/198


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by tgrall <gi...@git.apache.org>.
Github user tgrall commented on the pull request:

    https://github.com/apache/drill/pull/198#issuecomment-147794855
  
    Updated the PR with your comments:
    
    * put a new getVersion() in a util class
    * return "Unknown" by default


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: Add Drill version, from Manifest, same as SqlL...

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on the pull request:

    https://github.com/apache/drill/pull/198#issuecomment-147795248
  
    +1. Let's get this merged.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---