@Test public void testMultiVersions() throws IOException, InterruptedException { KylinConfig.getInstanceFromEnv().setProperty("kylin.dictionary.append-entry-size", "4"); AppendTrieDictionaryBuilder builder = createBuilder(); builder.addValue("a"); builder.addValue("b"); builder.addValue("c"); builder.addValue("d"); builder.addValue("e"); builder.addValue("f"); AppendTrieDictionary dict = builder.build(0); assertEquals(2, dict.getIdFromValue("b")); builder = createBuilder(); builder.addValue("g"); try { dict.getIdFromValue("g"); fail("Value 'g' (g) not exists!"); } catch (IllegalArgumentException e) { } builder.addValue("h"); AppendTrieDictionary newDict = builder.build(0); assert newDict.equals(dict); assertEquals(7, newDict.getIdFromValue("g")); assertEquals(8, newDict.getIdFromValue("h")); File dir = new File(LOCAL_BASE_DIR); assertEquals(2, dir.listFiles(new VersionFilter()).length); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AppendTrieDictionary) { AppendTrieDictionary that = (AppendTrieDictionary) o; return Objects.equals(this.baseDir, that.baseDir); } return false; }
AppendTrieDictionary extends CacheDictionary<T> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AppendTrieDictionary) { AppendTrieDictionary that = (AppendTrieDictionary) o; return Objects.equals(this.baseDir, that.baseDir); } return false; } }
AppendTrieDictionary extends CacheDictionary<T> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AppendTrieDictionary) { AppendTrieDictionary that = (AppendTrieDictionary) o; return Objects.equals(this.baseDir, that.baseDir); } return false; }  }
AppendTrieDictionary extends CacheDictionary<T> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AppendTrieDictionary) { AppendTrieDictionary that = (AppendTrieDictionary) o; return Objects.equals(this.baseDir, that.baseDir); } return false; }  void init(String baseDir); @Override int getIdFromValueBytesWithoutCache(byte[] value, int offset, int len, int roundingFlag); CacheStats getCacheStats(); GlobalDictMetadata getDictMetadata(); @Override int getMinId(); @Override int getMaxId(); @Override int getSizeOfId(); @Override int getSizeOfValue(); @Override AppendTrieDictionary copyToAnotherMeta(KylinConfig srcConfig, KylinConfig dstConfig); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override void dump(PrintStream out); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); @Override boolean contains(Dictionary other); }
AppendTrieDictionary extends CacheDictionary<T> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AppendTrieDictionary) { AppendTrieDictionary that = (AppendTrieDictionary) o; return Objects.equals(this.baseDir, that.baseDir); } return false; }  void init(String baseDir); @Override int getIdFromValueBytesWithoutCache(byte[] value, int offset, int len, int roundingFlag); CacheStats getCacheStats(); GlobalDictMetadata getDictMetadata(); @Override int getMinId(); @Override int getMaxId(); @Override int getSizeOfId(); @Override int getSizeOfValue(); @Override AppendTrieDictionary copyToAnotherMeta(KylinConfig srcConfig, KylinConfig dstConfig); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override void dump(PrintStream out); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); @Override boolean contains(Dictionary other); static final byte[] HEAD_MAGIC; static final int HEAD_SIZE_I; }