DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Hadoop, Pig, and Broken Dreams of Environment Variables

Hadoop, Pig, and Broken Dreams of Environment Variables

Oliver Hookins user avatar by
Oliver Hookins
·
Sep. 13, 12 · Interview
Like (0)
Save
Tweet
Share
5.71K Views

Join the DZone community and get the full member experience.

Join For Free
Okay, this post isn't nearly as melodramatic as its title – I’m doing some log analysis with Hadoop and Pig. As the logs are coming from a webserver and are not that far from standard “combined” format, it is most logical to use the time-saving UDFs in Pig’s Piggybank. This is just a set of user-contributed code, but very useful.

Unfortunately there doesn’t seem to be a Debian package for it, at least not in the set of repositories I have available to me on this machine so I thought I’d just compile it – it is dynamically loadable from an arbitrary path in a Pig script so this is not a big issue. The process is two-fold:

  1. Compile Pig itself (or locate the pig-withouthadoop.jar pre-compiled on your system)
  2. Compile Piggybank against that version of Pig

Pig uses the Ant build system, and it really is as trivial as running ant from the top-level directory. I checked out the tagged release of 0.10.0 and successfully built Pig. Building Piggybank against it, however, errored out with something I wasn’t immediately able to find on the interwebs:

$ ant
Buildfile: /home/oliver/release-0.10.0/contrib/piggybank/java/build.xml

init:
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/classes
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/test
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/test/classes
    [mkdir] Created dir: /home/oliver/release-0.10.0/contrib/piggybank/java/build/docs/api

compile:
     [echo]  *** Compiling Pig UDFs ***
    [javac] /home/oliver/release-0.10.0/contrib/piggybank/java/build.xml:92: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 154 source files to /home/oliver/release-0.10.0/contrib/piggybank/java/build/classes
    [javac] error: error reading /home/oliver/release-0.10.0/pig-withouthadoop.jar; invalid header field
    [javac] 1 error

BUILD FAILED
/home/oliver/release-0.10.0/contrib/piggybank/java/build.xml:92: Compile failed; see the compiler error output for details.

Total time: 0 seconds

Now, I’m not a Java guy so this means very little to me. However I do at least know that a Jar file is simply a zip archive so I went digging. Assuming that the ‘invalid header field’ is in the metadata of the Jar file, I looked in the contained META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.0
Created-By: 1.6.0_26-b03 (Sun Microsystems Inc.)
Main-Class: org.apache.pig.Main

Name: org/apache/pig
Implementation-Vendor: Apache
Implementation-Title: Pig
Implementation-Version: 0.10.0-SNAPSHOT
Build-TimeStamp: Sep 12 2012, 08:14:45
Svn-Revision: svnversion: warning: cannot set LC_CTYPE locale
svnversi
 on: warning: environment variable LC_CTYPE is UTF-8
svnversion: warni
 ng: please check that your locale name is correct
1383830

It seems that some locale settings in the environment are causing issues with the svnversion program, and indeed when running it separately I can confirm the same issue:

~/release-0.10.0$ svnversion
svnversion: warning: cannot set LC_CTYPE locale
svnversion: warning: environment variable LC_CTYPE is UTF-8
svnversion: warning: please check that your locale name is correct
1383830

I’ve been seeing this on a bunch of machines I’ve been using recently but frankly I haven’t had the time to diagnose it. It is easily worked around with unset LC_CTYPE:

~/release-0.10.0$ unset LC_CTYPE
~/release-0.10.0$ svnversion
1383830

There's some contention around adding superfluous metadata fields in Ant builds, but again, this is something I don’t particularly care to dive into at the moment. An acceptable alternative workaround in this case would have been to remove the additional metadata generation in the Ant build.xml.

Rebuilding Pig now and Piggybank against it works. Huzzah! On to the next problem.
hadoop

Published at DZone with permission of Oliver Hookins, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Secrets Management
  • Express Hibernate Queries as Type-Safe Java Streams
  • How To Validate Three Common Document Types in Python
  • Using the PostgreSQL Pager With MariaDB Xpand

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: