@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { return new DistinctCountAggregateFunction(children, getDelegateFunction(children, context)); }
@Override public DistinctCountClientAggregator newClientAggregator() { return new DistinctCountClientAggregator(getAggregatorExpression().getSortOrder()); }
@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 Aggregator newServerAggregator(Configuration config, ImmutableBytesWritable ptr) { DistinctCountClientAggregator clientAgg = newClientAggregator(); clientAgg.aggregate(null, ptr); return new DistinctValueWithCountServerAggregator(config, clientAgg); } }
@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 Aggregator newServerAggregator(Configuration config, ImmutableBytesWritable ptr) { DistinctCountClientAggregator clientAgg = newClientAggregator(); clientAgg.aggregate(null, ptr); return new DistinctValueWithCountServerAggregator(config, clientAgg); } }
@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 Aggregator newServerAggregator(Configuration config, ImmutableBytesWritable ptr) { DistinctCountClientAggregator clientAgg = newClientAggregator(); clientAgg.aggregate(null, ptr); return new DistinctValueWithCountServerAggregator(config, clientAgg); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { return new DistinctCountAggregateFunction(children, getDelegateFunction(children, context)); }
@Override public DistinctCountClientAggregator newClientAggregator() { return new DistinctCountClientAggregator(getAggregatorExpression().getSortOrder()); }
@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 FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { return new DistinctCountAggregateFunction(children, getDelegateFunction(children, context)); }
@Override public DistinctCountClientAggregator newClientAggregator() { return new DistinctCountClientAggregator(getAggregatorExpression().getSortOrder()); }
@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 }