@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DistinctCountAggregateFunction other = (DistinctCountAggregateFunction)obj; return (isConstantExpression() && other.isConstantExpression()) || children.equals(other.getChildren()); }
@Override public int hashCode() { return isConstantExpression() ? 0 : super.hashCode(); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { // TODO: optimize query plan of this to run scan serially for a limit of one row if (!super.evaluate(tuple, ptr)) { ptr.set(ZERO); // If evaluate returns false, then no rows were found, so result is 0 } else if (isConstantExpression()) { ptr.set(ONE); // Otherwise, we found one or more rows, so a distinct on a constant is 1 } return true; // Always evaluates to a LONG value }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DistinctCountAggregateFunction other = (DistinctCountAggregateFunction)obj; return (isConstantExpression() && other.isConstantExpression()) || children.equals(other.getChildren()); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DistinctCountAggregateFunction other = (DistinctCountAggregateFunction)obj; return (isConstantExpression() && other.isConstantExpression()) || children.equals(other.getChildren()); }
@Override public int hashCode() { return isConstantExpression() ? 0 : super.hashCode(); }
@Override public int hashCode() { return isConstantExpression() ? 0 : super.hashCode(); }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { // TODO: optimize query plan of this to run scan serially for a limit of one row if (!super.evaluate(tuple, ptr)) { ptr.set(ZERO); // If evaluate returns false, then no rows were found, so result is 0 } else if (isConstantExpression()) { ptr.set(ONE); // Otherwise, we found one or more rows, so a distinct on a constant is 1 } return true; // Always evaluates to a LONG value }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { // TODO: optimize query plan of this to run scan serially for a limit of one row if (!super.evaluate(tuple, ptr)) { ptr.set(ZERO); // If evaluate returns false, then no rows were found, so result is 0 } else if (isConstantExpression()) { ptr.set(ONE); // Otherwise, we found one or more rows, so a distinct on a constant is 1 } return true; // Always evaluates to a LONG value }