@Test public void testExprColumnEquality() throws Exception { FieldSchema colSchema = new FieldSchema("someExprCol", "double", "some exprcol"); ExprColumn col1 = new ExprColumn(colSchema, "someExprDisplayString", "AVG(msr1) + AVG(msr2)"); ExprColumn col2 = new ExprColumn(colSchema, "someExprDisplayString", "avg(MSR1) + avg(MSR2)"); assertEquals(col1, col2); assertEquals(col1.hashCode(), col2.hashCode()); col2 = new ExprColumn(colSchema, "someExprDisplayString", new ExprSpec("avg(MSR1) + avg(MSR2)", null, null)); assertEquals(col1, col2); assertEquals(col1.hashCode(), col2.hashCode()); ExprColumn col3 = new ExprColumn(colSchema, "someExprDisplayString", "AVG(msr1)"); assertNotEquals(col1, col3); assertNotEquals(col1.hashCode(), col3.hashCode()); ExprColumn col4 = new ExprColumn(colSchema, "someExprDisplayString", "dim1 = 'FooBar' AND dim2 = 'BarFoo'"); ExprColumn col5 = new ExprColumn(colSchema, "someExprDisplayString", "dim1 = 'FOOBAR' AND dim2 = 'BarFoo'"); assertNotEquals(col4.hashCode(), col5.hashCode()); assertNotEquals(col4, col5); ExprColumn col6 = new ExprColumn(colSchema, "someExprDisplayString", "DIM1 = 'FooBar' AND DIM2 = 'BarFoo'"); assertEquals(col4, col6); assertEquals(col4.hashCode(), col6.hashCode()); }
@Override public int hashCode() { if (!hasHashCode) { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getType() == null) ? 0 : getType().toLowerCase().hashCode()); for (ExprSpec exprSpec : expressionSet) { result = prime * result + exprSpec.hashCode(); } hashCode = result; hasHashCode = true; } return hashCode; }
ExprColumn extends CubeColumn { @Override public int hashCode() { if (!hasHashCode) { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getType() == null) ? 0 : getType().toLowerCase().hashCode()); for (ExprSpec exprSpec : expressionSet) { result = prime * result + exprSpec.hashCode(); } hashCode = result; hasHashCode = true; } return hashCode; } }
ExprColumn extends CubeColumn { @Override public int hashCode() { if (!hasHashCode) { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getType() == null) ? 0 : getType().toLowerCase().hashCode()); for (ExprSpec exprSpec : expressionSet) { result = prime * result + exprSpec.hashCode(); } hashCode = result; hasHashCode = true; } return hashCode; } ExprColumn(FieldSchema column, String displayString, String expression);  ExprColumn(FieldSchema column, String displayString,
                    ExprSpec... expressions);  ExprColumn(FieldSchema column, String displayString, Map<String, String> tags,
                    ExprSpec... expressions);  ExprColumn(String name, Map<String, String> props); }
ExprColumn extends CubeColumn { @Override public int hashCode() { if (!hasHashCode) { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getType() == null) ? 0 : getType().toLowerCase().hashCode()); for (ExprSpec exprSpec : expressionSet) { result = prime * result + exprSpec.hashCode(); } hashCode = result; hasHashCode = true; } return hashCode; } ExprColumn(FieldSchema column, String displayString, String expression);  ExprColumn(FieldSchema column, String displayString,
                    ExprSpec... expressions);  ExprColumn(FieldSchema column, String displayString, Map<String, String> tags,
                    ExprSpec... expressions);  ExprColumn(String name, Map<String, String> props); String getExpr(); String getType(); @Override void addProperties(Map<String, String> props); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); ASTNode getAst(); List<ASTNode> getExpressionASTList(); Collection<String> getExpressions(); Collection<ExprSpec> getExpressionSpecs(); void addExpression(ExprSpec expression); boolean removeExpression(String expression); }
ExprColumn extends CubeColumn { @Override public int hashCode() { if (!hasHashCode) { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getType() == null) ? 0 : getType().toLowerCase().hashCode()); for (ExprSpec exprSpec : expressionSet) { result = prime * result + exprSpec.hashCode(); } hashCode = result; hasHashCode = true; } return hashCode; } ExprColumn(FieldSchema column, String displayString, String expression);  ExprColumn(FieldSchema column, String displayString,
                    ExprSpec... expressions);  ExprColumn(FieldSchema column, String displayString, Map<String, String> tags,
                    ExprSpec... expressions);  ExprColumn(String name, Map<String, String> props); String getExpr(); String getType(); @Override void addProperties(Map<String, String> props); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); ASTNode getAst(); List<ASTNode> getExpressionASTList(); Collection<String> getExpressions(); Collection<ExprSpec> getExpressionSpecs(); void addExpression(ExprSpec expression); boolean removeExpression(String expression); static final char EXPRESSION_DELIMITER; static final char EXPRESSION_SPEC_DELIMITER; }