table = new LongHashTable(10); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.POSSIBLY_SENSITIVE), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.PROTECTED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.FAVORITED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.RETWEETED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.TRUNCATED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.VERIFIED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.GEO_ENABLED), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.FOLLOW_REQUEST_SENT), TwitterEventSchema.MSG_USERPOST_101_FIELD_FLAGS_31 ); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.ID), TwitterEventSchema.MSG_USERPOST_101_FIELD_USERID_51); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.NAME), TwitterEventSchema.MSG_USERPOST_101_FIELD_NAME_52); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.SCREEN_NAME), TwitterEventSchema.MSG_USERPOST_101_FIELD_SCREENNAME_53); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.FAVOURITES_COUNT), TwitterEventSchema.MSG_USERPOST_101_FIELD_FAVOURITESCOUNT_54); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.FOLLOWERS_COUNT), TwitterEventSchema.MSG_USERPOST_101_FIELD_FOLLOWERSCOUNT_55); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.FRIENDS_COUNT), TwitterEventSchema.MSG_USERPOST_101_FIELD_FRIENDSCOUNT_56); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.CREATED_AT), TwitterEventSchema.MSG_USERPOST_101_FIELD_CREATEDAT_57); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.DESCRIPTION), TwitterEventSchema.MSG_USERPOST_101_FIELD_DESCRIPTION_58); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.LISTED_COUNT), TwitterEventSchema.MSG_USERPOST_101_FIELD_LISTEDCOUNT_59); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.LANG), TwitterEventSchema.MSG_USERPOST_101_FIELD_LANGUAGE_60); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.TIME_ZONE), TwitterEventSchema.MSG_USERPOST_101_FIELD_TIMEZONE_61); LongHashTable.setItem(table, buildUniqueId(TwitterKey.USER, TwitterKey.LOCATION), TwitterEventSchema.MSG_USERPOST_101_FIELD_LOCATION_62); LongHashTable.setItem(table, buildUniqueId(TwitterKey.ID), TwitterEventSchema.MSG_USERPOST_101_FIELD_POSTID_21); LongHashTable.setItem(table, buildUniqueId(TwitterKey.TEXT), TwitterEventSchema.MSG_USERPOST_101_FIELD_TEXT_22); LongHashTable.setItem(table, buildUniqueId(TwitterKey.IN_REPLY_TO_STATUS_ID), TwitterEventSchema.MSG_USERPOST_101_FIELD_INREPLYTO_23); return LongHashTable.getItem(table, id);
public boolean isValidSequence(long connection, long sequenceCode) { int sequenceNo = (int)sequenceCode&Integer.MAX_VALUE; boolean result; if (!LongHashTable.hasItem(sequenceCheck, connection)) { if (!LongHashTable.setItem(sequenceCheck, connection, sequenceNo)) { throw new RuntimeException("must grow"); }; result = 0==sequenceNo;//first entry must be zero } else { int lastSeq = LongHashTable.getItem(sequenceCheck, connection); //NOTE: sequence can stay the same or move forward or reset to zero result = (lastSeq+1 == sequenceNo) || (lastSeq == sequenceNo) || (0 == sequenceNo); if (!result) { new Exception("con:"+connection+" last: "+lastSeq+" got "+sequenceNo).printStackTrace(); } LongHashTable.replaceItem(sequenceCheck, connection, sequenceNo); } return result; }
private LongHashTable maskTable() { if (null == bitTable) { LongHashTable maskTable = new LongHashTable(8); //LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.RETWEETED), TwitterEventSchema.FLAG_RETWEET); //deprecate FLAG_RETWEETED_BY_ME LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.POSSIBLY_SENSITIVE), TwitterEventSchema.FLAG_POSSIBLY_SENSITIVE ); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.PROTECTED), TwitterEventSchema.FLAG_USER_PROTECTED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.FAVORITED), TwitterEventSchema.FLAG_FAVORITED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.RETWEETED), TwitterEventSchema.FLAG_RETWEETED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.TRUNCATED), TwitterEventSchema.FLAG_TRUNCATED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.VERIFIED), TwitterEventSchema.FLAG_USER_VERIFIED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.GEO_ENABLED), TwitterEventSchema.FLAG_USER_GEO_ENABLED); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.FOLLOW_REQUEST_SENT), TwitterEventSchema.FLAG_USER_FOLLOW_REQUEST_SENT); LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.CONTRIBUTORS_ENABLED), TwitterEventSchema.FLAG_USER_IS_CONTRIBUTORS); //LongHashTable.setItem(maskTable, buildUniqueId(TwitterKey.USER, TwitterKey.FOLLOW_REQUEST_SENT), TwitterEventSchema.FLAG_USER_IS_TRANSLATOR); bitTable = maskTable; } return bitTable; }
if (!LongHashTable.hasItem(lookupDimensions, pathHash)) { dimIdx = dimsIdx++; LongHashTable.setItem(lookupDimensions, pathHash, dimIdx); } else { dimIdx = LongHashTable.getItem(lookupDimensions, pathHash); if (LongHashTable.hasItem(lookupFieldTableLocal, pathHash)) { throw new UnsupportedOperationException("field "+fieldIdx+" conflicts with previous field, each must be unique."); LongHashTable.setItem(lookupFieldTableLocal, pathHash, fieldIdx); return dimsIdx;
LongHashTable lookupFieldTableLocal = new LongHashTable( LongHashTable.computeBits(schema.mappingCount()<<2) ); LongHashTable lookupDimUsageLocal = new LongHashTable( LongHashTable.computeBits(totalDims<<2) );
if (!LongHashTable.setItem(templateToOffset, templateId, templateOffset)) { throw new SAXException("Error in XML file, Duplicate template id: " + templateId+"(0x"+Long.toHexString(templateId)+")");
@Override public boolean usesBitMask(long id) { return LongHashTable.hasItem(maskTable(), id); }
@Override public int bitMask(long id) { return LongHashTable.getItem(maskTable(), id); }
if (!LongHashTable.hasItem(lookupDimensions, pathHash)) { dimIdx = dimsIdx++; LongHashTable.setItem(lookupDimensions, pathHash, dimIdx); } else { dimIdx = LongHashTable.getItem(lookupDimensions, pathHash); if (LongHashTable.hasItem(lookupFieldTableLocal, pathHash)) { throw new UnsupportedOperationException("field "+fieldIdx+" conflicts with previous field, each must be unique."); LongHashTable.setItem(lookupFieldTableLocal, pathHash, fieldIdx); return dimsIdx;
LongHashTable lookupFieldTableLocal = new LongHashTable( LongHashTable.computeBits(schema.mappingCount()<<2) ); LongHashTable lookupDimUsageLocal = new LongHashTable( LongHashTable.computeBits(totalDims<<2) );
if (!LongHashTable.setItem(templateToOffset, templateId, templateOffset)) { throw new SAXException("Error in XML file, Duplicate template id: " + templateId+"(0x"+Long.toHexString(templateId)+")");
if (!LongHashTable.hasItem(lookupDimensions, pathHash)) { dimIdx = dimsIdx++; LongHashTable.setItem(lookupDimensions, pathHash, dimIdx); } else { dimIdx = LongHashTable.getItem(lookupDimensions, pathHash); if (LongHashTable.hasItem(lookupFieldTableLocal, pathHash)) { throw new UnsupportedOperationException("field "+fieldIdx+" conflicts with previous field, each must be unique."); LongHashTable.setItem(lookupFieldTableLocal, pathHash, fieldIdx); return dimsIdx;
LongHashTable lookupFieldTableLocal = new LongHashTable( LongHashTable.computeBits(schema.mappingCount()<<2) ); LongHashTable lookupDimUsageLocal = new LongHashTable( LongHashTable.computeBits(totalDims<<2) );
if (!LongHashTable.setItem(templateToOffset, templateId, templateOffset)) { throw new SAXException("Error in XML file, Duplicate template id: " + templateId+"(0x"+Long.toHexString(templateId)+")");
if (!LongHashTable.setItem(templateToLimit,templateId, catalogTemplateScriptIdx)) { throw new RuntimeException("internal parse error");
@Override public void endArray() { if (stackPosition>0) { stackPosition--; //logger.info("end of array depth {}",stackPosition); long hash = uStack[stackPosition]; int dimIdx = LongHashTable.getItem(lookupDimsTable, hash); if (0!=dimIdx || LongHashTable.hasItem(lookupDimsTable, hash)) { int[] data = this.dimUsages[dimIdx]; final int fieldCount = data[0];//this is (n-1) not the length final int dim = data[1];//which dim is this, one based //logger.info("write dim data count {} dim {} ",count, dim); //logger.info("end array {} {} {}",dimIdx,fieldCount,dim); for(int i=HEADER_DIM_USAGE_FIELDS; i<=fieldCount; i++) { //logger.info("single entry process for {} {}",dim, data[i]); singleEntryField(dim, data[i]); } } } }
if (!LongHashTable.setItem(templateToLimit,templateId, catalogTemplateScriptIdx)) { throw new RuntimeException("internal parse error");