fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Resolves #2108: Cascades should match record type key field with record type restrictions

Open alecgrieser opened this issue 1 year ago • 5 comments

This adds record type key matching to the Cascades planner. This is designed to handle two scenarios:

  1. Record type key fields in an index. This makes some amount of sense for multi-type (including universal) indexes, but this only tests single-type indexes mainly as a stepping stone.
  2. In the primary key. As is documented in the FAQ on how to make record types act like tables, this is good to have if the user has put record type key prefixes on all primary keys, as this allows scans of the primary index for a given type to be executed efficiently.

There are actually two approaches in here, which are separated out into separate commits. The first adds additional matching to the SelectExpression::isSubsumedBy method so that if there are record type fields in a match candidate, the value can be fixed based on the value of record types that can be returned by the relevant quantifier. The second commit pushes the type filter predicate down into the LogicalTypeFilterExpression, and then consolidates record type matching to that method.

There's some benefit to consolidating the type matching stuff to a single type of node. However, it may also be that matching within the SelectExpression is a bit more flexible. In particular, it seems like it's more likely to be more resilient to more exotic query trees. But both are presented here in this PR for view.

This resolves #2108.

alecgrieser avatar May 11 '23 16:05 alecgrieser

Result of fdb-record-layer-pr-proto2 on Linux CentOS 7

  • Commit ID: 5b5812f359acb27943b8b90cb98fe0f2b6fd933e
  • Duration 0:09:08
  • Result: :x: FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest sonarqube -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar May 11 '23 16:05 foundationdb-ci

Result of fdb-record-layer-pr-proto3 on Linux CentOS 7

  • Commit ID: 5b5812f359acb27943b8b90cb98fe0f2b6fd933e
  • Duration 0:09:14
  • Result: :x: FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest sonarqube -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar May 11 '23 16:05 foundationdb-ci

Result of fdb-record-layer-pr-proto3 on Linux CentOS 7

  • Commit ID: 97fb13b8bfeb579e515927deb7b71c80ae7b3df9
  • Duration 0:19:31
  • Result: :white_check_mark: SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar May 12 '23 17:05 foundationdb-ci

Result of fdb-record-layer-pr-proto2 on Linux CentOS 7

  • Commit ID: 97fb13b8bfeb579e515927deb7b71c80ae7b3df9
  • Duration 0:19:41
  • Result: :white_check_mark: SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

foundationdb-ci avatar May 12 '23 17:05 foundationdb-ci