Skip to content

Instantly share code, notes, and snippets.

View chriswhite199's full-sized avatar

Chris White chriswhite199

  • Camano Island, WA, USA
View GitHub Profile
@chriswhite199
chriswhite199 / schema-dl.sh
Created September 19, 2020 19:52
XSD Offline Download
#!/bin/bash
set -e
command -V xq || (echo "no xq installed - pip install yq" && exit 1)
command -V dos2unix || (echo "no dos2unix installed" && exit 1)
xml=$1
[[ ! -z "$xml" ]] || (echo "No file passed as input" && exit 1)
{
"bigDecimal": -0.203915448728157455435,
"ipAddress" : "1.2.3.4"
}
@chriswhite199
chriswhite199 / JobClientTaskHostDriver.java
Created November 11, 2013 13:51
Reflection hack to get the successful map task attempt hostnames - which isn't available via the JobClient public API. This is for Hadoop 1.2.1 and may not be forwards or backwards compatible.
package sandbox.hadoop;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
package csw.hadoop.sandbox;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DataOutputBuffer;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.mapreduce.Partitioner;
import org.apache.hadoop.mapreduce.Reducer;