virajjasani commented on code in PR #2428: URL: https://github.com/apache/phoenix/pull/2428#discussion_r3190918532
########## phoenix-core-client/src/main/java/org/apache/phoenix/compile/keyspace/oracle/Oracle.java: ########## @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.compile.keyspace.oracle; + +/** + * Reference implementation (oracle) of the key-space model's key-range extraction + * algorithm. Given an {@link AbstractExpression} tree over a schema with {@code nPk} + * primary-key dimensions, produces the {@link AbstractKeySpaceList} the algorithm + * should emit. + * <p> + * The purpose is differential testing: we compare the oracle's output against the + * production {@code WhereOptimizerV2} implementation's {@code KeySpaceList} to detect + * divergences. Any difference is either a production bug or an oracle bug — the oracle + * being shorter and directly derived from the design, the default suspect is production. + * <p> + * This oracle does not handle: + * <ul> + * <li>Normalization of RVC inequalities (feed in the lex-expanded form).</li> + * <li>Byte encoding, DESC inversion, separator bytes, salt/tenant prefixes.</li> + * <li>Null handling (IS NULL / IS NOT NULL).</li> + * <li>Scalar function wrappers or coercions.</li> + * </ul> + * All of those are production concerns that live above the algebra the model describes. + * <p> + * <b>Correctness property.</b> For every row {@code r} where + * {@code expr.evaluate(r) == true}, the emitted {@link AbstractKeySpaceList} must match + * {@code r} (soundness: no false negatives). False positives — rows in the list but not + * satisfying the expression — are permitted because the production residual filter + * re-evaluates the original predicate at scan time. + */ +public final class Oracle { + + private Oracle() {} Review Comment: I don't think this and relevant classes should be part of our source code. Any comparison with Oracle or Postgresql should be only part of the test code. I also think Postgres would be better choice as it is open source, wdyt? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
