Skip to content

Instantly share code, notes, and snippets.

View tamtam180's full-sized avatar

tamtam180 tamtam180

View GitHub Profile
@tamtam180
tamtam180 / gist:1797071
Created February 11, 2012 06:19
hive ticket draft1
----- 手直ししたバージョン -----
summary:
utc_from_timestamp and utc_to_timestamp returns incorrect results.
detail:
how to reproduce:
{noformat}
$ echo "2011-12-25 09:00:00.123456" > /tmp/data5.txt
@tamtam180
tamtam180 / gist:2055893
Created March 17, 2012 06:54
MurmurHash1のJava実装. オリジナル実装はunsigned intで行っているが、signed intでもビットパターンは変わらないので問題なし(のはず)
public class MurmurHash1 {
public long digest(byte[] data, int seed, boolean bigendian) {
int m = 0xc6a4a793;
int r = 16;
int len = data.length;
int h = seed ^ (len * m);
@tamtam180
tamtam180 / EncodeUtils.java
Created March 17, 2012 08:24
MurmurHash2のJava実装。32ビットハッシュを求めるやつと64ビットハッシュを求めるやつ
public class EncodeUtils {
public static long toLongBE(byte[] b, int offset) {
return (((long)b[offset+0] << 56) +
((long)(b[offset+1] & 255) << 48) +
((long)(b[offset+2] & 255) << 40) +
((long)(b[offset+3] & 255) << 32) +
((long)(b[offset+4] & 255) << 24) +
((b[offset+5] & 255) << 16) +
@tamtam180
tamtam180 / EncodeUtils.java
Created March 17, 2012 10:39
MurmurHash3のJava実装。32ビットと128ビットを求めるやつ。x86とx64で結果は異なる
public class EncodeUtils {
public static int toIntBE(byte[] b, int i) {
return ((b[i+0] << 24) + (b[i+1] << 16) + (b[i+2] << 8) + (b[i+3] << 0));
}
public static int toIntLE(byte[] b, int i) {
return ((b[i+3] << 24) + (b[i+2] << 16) + (b[i+1] << 8) + (b[i+0] << 0));
}
Index: ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
===================================================================
--- ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (revision 1304983)
+++ ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (working copy)
@@ -6468,10 +6468,8 @@
// Finally add the partitioning columns
for (FieldSchema part_col : tab.getPartCols()) {
LOG.trace("Adding partition col: " + part_col);
- // TODO: use the right type by calling part_col.getType() instead of
- // String.class
abstract class Base {
protected String aaa;
public Base setAaa(String aaa) {
this.aaa = aaa;
return this;
}
}
class Hoge extends Base {
protected String xxx;
@tamtam180
tamtam180 / gist:2316537
Created April 6, 2012 03:19
CityHashのJava実装。
/*
* Copyright (C) 2012 tamtam180
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
Rest call:
/_api/collection/collection-identifier/parameter
I got follows error:
{"error":true,"code":404,"errorNum":404,"errorMessage":"expecting one of the resources 'count', 'figures'"}
[tamtam@tamsvr20 tmp]$ curl -X GET --dump - http://localhost:8529/_api/collection/tamtam
HTTP/1.1 200 OK
connection: Keep-Alive
content-type: application/json
@tamtam180
tamtam180 / memo.txt
Created April 7, 2012 11:56
AvocadoDB's Memo
なんかWikiのドキュメントと構造が違うような。
確認したリビジョン: 16aacb1769eccb16570ed6e10e7f924b1cac8550 (Fri Apr 6 22:21:34 2012 +0200)
[tamtam@tamsvr20 tmp]$ curl -X GET --dump - http://localhost:8529/_api/collections
HTTP/1.1 200 OK
connection: Keep-Alive
content-type: application/json
server: triagens GmbH High-Performance HTTP Server
content-length: 531
@tamtam180
tamtam180 / collection.json
Created April 7, 2012 11:56
AvocadoDB's Memo
{
"code": 200,
"collections": [
{
"id": 130920,
"name": "tamtam",
"status": 3
},
{
"id": 4783976,