public static STATS_TYPE getStatsType(String statsLabel) { if (DURATION.name().equals(statsLabel)) { return DURATION; } else if (ACTIVITY.name().equals(statsLabel)) { return ACTIVITY; } else if (LINKS.name().equals(statsLabel)) { return LINKS; } else { throw new EnumConstantNotPresentException(STATS_TYPE.class, statsLabel); } }
public static STATS_TYPE determineStatsType(Text colFam) { int offset = STATS_BYTES.length + 1; int secondSlashIndex = 0; int numCharsToCheck = Math.min(offset + 1 + STATS_TYPE.getMaxLength(), colFam.getLength()); // faster to just compare bytes with STATS/statsType/ for each statsType for (int i = offset; i < numCharsToCheck; i++) { secondSlashIndex = i; if (colFam.getBytes()[i] == COL_SEPARATOR_BYTE) { break; } } int count = (secondSlashIndex > offset ? secondSlashIndex - offset : offset); try { return STATS_TYPE.getStatsType(Text.decode(colFam.getBytes(), offset, count)); } catch (CharacterCodingException e) { // same behavior as EdgeKey.getParts throw new RuntimeException("Edge key column encoding exception", e); } } }
@Override public int hashCode() { final int prime = 223; int result = 1; result = prime * result + ((colvis == null) ? 0 : colvis.hashCode()); result = prime * result + (deleted ? 1231 : 1237); result = prime * result + ((format == null) ? 0 : format.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((sinkData == null) ? 0 : sinkData.hashCode()); result = prime * result + ((sinkRelationship == null) ? 0 : sinkRelationship.hashCode()); result = prime * result + ((sinkAttribute1 == null) ? 0 : sinkAttribute1.hashCode()); result = prime * result + ((sourceData == null) ? 0 : sourceData.hashCode()); result = prime * result + ((sourceRelationship == null) ? 0 : sourceRelationship.hashCode()); result = prime * result + ((sourceAttribute1 == null) ? 0 : sourceAttribute1.hashCode()); result = prime * result + ((statsType == null) ? 0 : statsType.hashCode()); result = prime * result + (int) (timestamp ^ (timestamp >>> 32)); result = prime * result + ((attribute3 == null) ? 0 : attribute3.hashCode()); result = prime * result + ((attribute2 == null) ? 0 : attribute2.hashCode()); result = prime * result + ((yyyymmdd == null) ? 0 : yyyymmdd.hashCode()); result = prime * result + ((dateType == null) ? 0 : dateType.hashCode()); return result; }
edge.setStatsType(edgeKey.getStatsType().name()); switch (edgeKey.getStatsType()) { case ACTIVITY:
rowsb.append(this.getSourceData()); parts.set(0, STATS_COLF); parts.set(version.getStatsTypeIndex(), this.getStatsType().name()); } else if (this.format == EDGE_FORMAT.STANDARD) { rowsb.append(this.getSourceData()).append("\0").append(this.getSinkData());
@Override public int hashCode() { final int prime = 223; int result = 1; result = prime * result + ((colvis == null) ? 0 : colvis.hashCode()); result = prime * result + (deleted ? 1231 : 1237); result = prime * result + ((format == null) ? 0 : format.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + ((sinkData == null) ? 0 : sinkData.hashCode()); result = prime * result + ((sinkRelationship == null) ? 0 : sinkRelationship.hashCode()); result = prime * result + ((sinkAttribute1 == null) ? 0 : sinkAttribute1.hashCode()); result = prime * result + ((sourceData == null) ? 0 : sourceData.hashCode()); result = prime * result + ((sourceRelationship == null) ? 0 : sourceRelationship.hashCode()); result = prime * result + ((sourceAttribute1 == null) ? 0 : sourceAttribute1.hashCode()); result = prime * result + ((statsType == null) ? 0 : statsType.hashCode()); result = prime * result + (int) (timestamp ^ (timestamp >>> 32)); result = prime * result + ((attribute3 == null) ? 0 : attribute3.hashCode()); result = prime * result + ((attribute2 == null) ? 0 : attribute2.hashCode()); result = prime * result + ((yyyymmdd == null) ? 0 : yyyymmdd.hashCode()); result = prime * result + ((dateType == null) ? 0 : dateType.hashCode()); return result; }
public List<Text> computeColumnFamilyUnions(boolean includeStats) { List<Text> columnFamilies = new ArrayList<>(); for (IdentityContext edgeType : edgeTypes) { for (IdentityContext edgeRelationship : edgeRelationships) { columnFamilies.add(new Text(edgeType.getLiteral() + "/" + edgeRelationship.getLiteral())); if (includeStats) { for (EdgeKey.STATS_TYPE stats_type : EdgeKey.STATS_TYPE.values()) { String[] parts = StringUtils.split(edgeRelationship.getLiteral(), '-'); columnFamilies.add(new Text("STATS/" + stats_type + "/" + edgeType.getLiteral() + "/" + parts[0])); } } } } return columnFamilies; }
public STATS_TYPE getStatsType(List<String> pieces) { return STATS_TYPE.getStatsType(pieces.get(iStatsType)); }