Skip to content

Instantly share code, notes, and snippets.

View phrocker's full-sized avatar
🏠
Writin dem codez

Marc phrocker

🏠
Writin dem codez
View GitHub Profile
package datawave.query.tables;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import datawave.data.type.NoOpType;
import datawave.query.DocumentSerialization;
import datawave.query.attributes.Document;
try:
writer = AccumuloWriter(args.instance,args.zookeepers,args.username,password,table,"")
for i in range(5000):
writer.put("q",cf="cf" + str(i),cq="cq")
writer.put("q",cf="cf2"+ str(i),cq="cq")
writer.close()
#!/usr/bin/python
# 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
#!/bin/bash
# Disable some unneeded services by default (administrators can re-enable if desired)
systemctl disable firewalld
# Update memory limits
cat << EOF >> /etc/security/limits.conf
* hard memlock unlimited
* soft memlock unlimited
* hard nofile 655350
#!/usr/bin/python
# 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
index meta 8969415289
00850_1961038767_001_0000_0 date: [] 9223372036854775807
00850_1961038767_001_0000_0 query_string: [] 9223372036854775807
00850_1961038767_001_0000_0 sentiment: [] 9223372036854775807
00850_1961038767_001_0000_0 text: [] 9223372036854775807
00850_1961038767_001_0000_0 user: [] 9223372036854775807
00850_1961038767_001_0000_1 date: [] 9223372036854775807
00850_1961038767_001_0000_1 query_string: [] 9223372036854775807
00850_1961038767_001_0000_1 sentiment: [] 9223372036854775807
00850_1961038767_001_0000_1 text: [] 9223372036854775807
AccumuloConfiguration accconf = DefaultConfiguration.getInstance();
SortedMap<Key, Value> map = new TreeMap<>();
FileSKVIterator reader = RFileOperations.getInstance().newScanReaderBuilder().forFile(file, FileSystem.get(new URI(file), conf), conf, CryptoServiceFactory.newDefaultInstance()).withTableConfiguration(accconf).overRange(new Range(), Collections.emptySet(), false).build();
Authorizations auths = new Authorizations("RST");
SortedKeyValueIterator<Key, Value> filter = VisibilityFilter.wrap(reader, auths, "".getBytes());
long count = 0;
while (filter.hasTop()) {
Key key = filter.getTopKey();
@phrocker
phrocker / UidExample.java
Created February 28, 2020 01:38
Uid Example
Uid.List v = Uid.List.parseFrom(value.get());
for (String uid : v.getUIDList()) {
// uid to look up in shard
}
@phrocker
phrocker / Uid.java
Created February 28, 2020 01:37
Uid
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Uid.proto
package datawave.ingest.protobuf;
public final class Uid {
private Uid() {}
public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {}
@phrocker
phrocker / combiner
Created January 21, 2020 19:44
combiner
from org.poma.accumulo import Key,KeyValue
from org.apache.accumulo.core.data import Range,Value
from org.apache.hadoop.io import WritableUtils
from java.io import ByteArrayInputStream, DataInputStream
import struct
import json
def swap32(i):
return struct.unpack("<L", struct.pack(">L", i))[0]