Skip to content

Instantly share code, notes, and snippets.

View shrijeet's full-sized avatar

Shrijeet shrijeet

  • Redwood City, CA
View GitHub Profile
@shrijeet
shrijeet / quickstart-hdfs.properties
Created July 9, 2016 19:34
kafka-connect-hdfs quickstart-hdfs.properties
name=hdfs-sink
connector.class=io.confluent.connect.hdfs.HdfsSinkConnector
tasks.max=1
topics=test_hdfs
hdfs.url=hdfs://10.211.55.101:8020
flush.size=3
hive.integration=true
hive.metastore.uris=thrift://localhost:9083
schema.compatibility=BACKWARD
format.class=io.confluent.connect.hdfs.parquet.ParquetFormat
@shrijeet
shrijeet / AppSchedulable.java
Created March 23, 2015 16:27
Only one of local, rack or any is satisfied
if (rackLocalRequest != null && rackLocalRequest.getNumContainers() != 0
&& localRequest != null && localRequest.getNumContainers() != 0) {
return assignContainer(node, localRequest,
NodeType.NODE_LOCAL, reserved);
}
if (rackLocalRequest != null && !rackLocalRequest.getRelaxLocality()) {
continue;
}
@shrijeet
shrijeet / Pi.java
Created November 4, 2014 23:11
Pi's cleanup method
@Override
public void cleanup(Context context) throws IOException {
//write output to a file
Configuration conf = context.getConfiguration();
Path outDir = new Path(conf.get(FileOutputFormat.OUTDIR));
Path outFile = new Path(outDir, "reduce-out");
FileSystem fileSys = FileSystem.get(conf);
SequenceFile.Writer writer = SequenceFile.createWriter(fileSys, conf,
outFile, LongWritable.class, LongWritable.class,
CompressionType.NONE);
@shrijeet
shrijeet / Pi_job_fail.java
Created November 4, 2014 21:58
MAPREDUCE-4815 Failing pi job
[shrijeet@xxx-209 ~]$ hadoop jar /usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar pi 5 5
Number of Maps = 5
Samples per Map = 5
Wrote input for Map #0
Wrote input for Map #1
Wrote input for Map #2
Wrote input for Map #3
Wrote input for Map #4
Starting Job
14/11/04 16:53:51 INFO client.RMProxy: Connecting to ResourceManager at yarn-rm.xxx-yyyy.example.net/172.0.0.0:8032
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.hadoop.mapred.TestMRCJCFileOutputCommitter
Tests run: 3, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 1.612 sec <<< FAILURE! - in org.apache.hadoop.mapred.TestMRCJCFileOutputCommitter
testAbort(org.apache.hadoop.mapred.TestMRCJCFileOutputCommitter) Time elapsed: 0.116 sec <<< ERROR!
java.lang.NullPointerException: null
at org.apache.hadoop.mapred.TestMRCJCFileOutputCommitter.testAbort(TestMRCJCFileOutputCommitter.java:144)
testFailAbort(org.apache.hadoop.mapred.TestMRCJCFileOutputCommitter) Time elapsed: 0.071 sec <<< FAILURE!
package com.example;
import com.google.common.hash.Funnel;
import com.google.common.hash.PrimitiveSink;
public enum StringFunnel implements Funnel<String> {
INSTANCE;
@Override
public void funnel(String from, PrimitiveSink into) {
@shrijeet
shrijeet / KeyValue.java
Created September 18, 2013 01:55
KeyValue size
+ 4 // int: Total length of the whole KeyValue.
+ 4 // int: Total length of the key part of the KeyValue.
+ 4 // int: Total length of the value part of the KeyValue.
+ 2 // short: Row key length.
+ key.length // The row key.
+ 1 // byte: Family length.
+ family.length // The family.
+ qualifier.length // The qualifier.
+ 8 // long: The timestamp.
+ 1 // byte: The type of KeyValue.
@shrijeet
shrijeet / hive_no_system_exit.patch
Created May 30, 2013 18:38
Do not run taskCleanup if running hive in sequential mode
if (tsk.ifRetryCmdWhenFail()) {
- if (running.size() != 0) {
+ if (running.size() != 0 && executeTasksInParallel()) {
taskCleanup();
}
// in case we decided to run everything in local mode, restore the
@@ -1183,7 +1183,7 @@ public class Driver implements CommandProcessor {
}
SQLState = "08S01";
console.printError(errorMessage);
@shrijeet
shrijeet / .vimrc
Last active December 17, 2015 20:18 — forked from rocarvaj/.vimrc
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
@shrijeet
shrijeet / npe_beeswax_1.java
Created May 15, 2013 20:13
NPE during query result fetch from history
java.lang.NullPointerException
at com.cloudera.beeswax.BeeswaxServiceImpl$RunningQueryState.access$600(BeeswaxServiceImpl.java:124)
at com.cloudera.beeswax.BeeswaxServiceImpl.doWithState(BeeswaxServiceImpl.java:770)
at com.cloudera.beeswax.BeeswaxServiceImpl.fetch(BeeswaxServiceImpl.java:980)
at com.cloudera.beeswax.api.BeeswaxService$Processor$fetch.getResult(BeeswaxService.java:987)
at com.cloudera.beeswax.api.BeeswaxService$Processor$fetch.getResult(BeeswaxService.java:971)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)