This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AvroBase<User> userHAB = AvroBaseFactory.createAvroBase( | |
| new UserHABModule(), HAB.class, | |
| TABLE, COLUMN_FAMILY, AvroFormat.BINARY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| User saved = new User(); | |
| saved.firstName = new Utf8("Sam"); | |
| saved.lastName = new Utf8("Pullara"); | |
| saved.email = new Utf8("spullara@yahoo.com"); | |
| saved.password = ByteBuffer.wrap(new Utf8("").getBytes()); | |
| byte[] row = Bytes.toBytes("spullara"); | |
| userHAB.put(row, saved); | |
| Row<User> loaded = userHAB.get(row); | |
| Iterable<Row<User>> searched = userHAB.search("firstName:Sam"); | |
| userHAB.delete(row); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AvroJsonEncoder extends JsonEncoder { | |
| private Parser parser; | |
| private JsonGenerator out; | |
| private static Field parserField; | |
| static { | |
| try { | |
| parserField = JsonEncoder.class.getDeclaredField("parser"); | |
| parserField.setAccessible(true); | |
| } catch (Exception e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| i7:hbasestorage sam$ find schema | |
| schema | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/..regioninfo.crc | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/.oldlogs | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/.oldlogs/.hlog.1279236292929.crc | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/.oldlogs/hlog.1279236292929 | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/.regioninfo | |
| schema/b3853dd37ab6a8e64fb56e72b0a6fb1b/avro | |
| i7:hbasestorage sam$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2010-07-26 19:41:01,193 DEBUG org.apache.hadoop.hbase.master.RegionManager: Adding operation TABLE_FLUSH from tasklist | |
| 2010-07-26 19:41:02,105 DEBUG org.apache.hadoop.hbase.master.RegionManager: Sending MSG_REGION_FLUSH REGION => {NAME => 'bag,,1280187157796.b8aa093b5e18084fb09471e8da7e6654.', STARTKEY => '', ENDKEY => '', ENCODED => b8aa093b5e18084fb09471e8da7e6654, TABLE => {{NAME => 'bag', FAMILIES => [{NAME => 'category', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'LZO', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'data', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'LZO', TTL => '2147483647', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}} to 10.162.243.193:60020 | |
| hbase(main):004:0* quit | |
| [root@ip-10-162-243-193 hbasestorage]# find bag | |
| bag | |
| bag/b8aa093b5e18084fb09471e8da7e6654 | |
| bag/b8aa093b5e18084fb09471e8da7e6654/.tmp | |
| bag/b8aa093b5e18084fb09471e8da7e6654/.tmp/5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class ClassToTypeLiteralMatcherAdapter extends AbstractMatcher<TypeLiteral> { | |
| private final Matcher<Class> classMatcher; | |
| public ClassToTypeLiteralMatcherAdapter(Matcher<Class> classMatcher) { | |
| this.classMatcher = classMatcher; | |
| } | |
| public boolean matches(TypeLiteral typeLiteral) { | |
| return classMatcher.matches(typeLiteral.getRawType()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package bagcheck.util; | |
| import java.util.Stack; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| /** | |
| * Clean up Text | |
| * <p/> | |
| * User: sam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BagCheckCLI { | |
| private static final String API = System.getenv("BAGCHECK_API"); | |
| private static final Pattern PATH_PATTERN = Pattern.compile("\\{(.*?)\\}"); | |
| @Argument(alias = "d") | |
| private static Boolean debug = false; | |
| @Argument(alias = "u") | |
| private static String user = System.getenv("BAGCHECK_USER"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| hbase(main):013:0> get 'user', '' | |
| COLUMN CELL | |
| customer:i timestamp=1280510563836, value=\x00\x00\x00\x00\x00\x00\x00\x07 | |
| profile:i timestamp=1280512821564, value=\x00\x00\x00\x00\x00\x00\x00\x01 | |
| 2 row(s) in 0.0380 seconds | |
| hbase(main):014:0> get 'user', '', 'profile:s' | |
| COLUMN CELL | |
| profile:s timestamp=1283811422569, value=5275255d77aff6d360ffca08d56a1135ebe17f7269e7e48392216e7dac2ba1da | |
| 1 row(s) in 0.0360 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.common.base.Function; | |
| public class test { | |
| static Integer test(Function<String, Integer> f) { | |
| return f.apply("1"); | |
| } | |
| public static void main(String[] args) { | |
| System.out.println(test(#(String s){ return Integer.parseInt(s);}) + 1); |