Skip to content

Fix/oracle av benchmark issues - #10

Open
yassirsalmi wants to merge 3 commits into
oracle-samples:mainfrom
yassirsalmi:fix/oracle-av-benchmark-issues
Open

yassirsalmi wants to merge 3 commits into
oracle-samples:mainfrom
yassirsalmi:fix/oracle-av-benchmark-issues

Conversation

@yassirsalmi

@yassirsalmi yassirsalmi commented Sep 17, 2026

Copy link
Copy Markdown
Member

1. Population percentage change

Reported problem

Example question:

Find population % change year ago, population share of geography, population change year ago with levels age

The existing POP_PCT_CHG_YA expression used LAG, so it returned previous population value not the percentage change:

"POP_PCT_CHG_YA" AS (
  LAG(POPULATION) OVER (HIERARCHY year OFFSET 1)
)
CLASSIFICATION "CAPTION" VALUE 'Population % Change Year Ago'
CLASSIFICATION "DESCRIPTION" VALUE 'Population Percent Change Year Ago'

The population dataset contains only 1982 and 1988. Therefore, OFFSET 1 compares 1988 with the previous available year, 1982. It is not a one-calendar-year comparison.

Fix

The measure now uses LAG_DIFF_PERCENT. Oracle returns the percentage change as a ratio, so it is multiplied by 100 to produce values such as 1.7 for a 1.7% change:

"POP_PCT_CHG_YA" AS (
  100 * LAG_DIFF_PERCENT(POPULATION)
    OVER (HIERARCHY year OFFSET 1)
)
CLASSIFICATION "CAPTION"
  VALUE 'Population % Change from Previous Available Year'
CLASSIFICATION "DESCRIPTION"
  VALUE 'Population percent change from the previous available year'

The related absolute-change measure remains:

"POP_CHG_YA" AS (
  LAG_DIFF(POPULATION)
    OVER (HIERARCHY year OFFSET 1)
)

Its caption and description were updated to use “previous available year” rather than “year ago.”

Question updates

Natural-language wording was updated to use “previous available year” rather than “year ago.”

2. County identity

Reported problem

The current county level treated COUNTY_FIPS as globally unique:

LEVEL "STATE"
  KEY ("STATE_FIPS")
  DETERMINES (
    "STATE",
    "STATE_NAME")

LEVEL "COUNTY"
  KEY ("COUNTY_FIPS")
  DETERMINES (
    "STATE_FIPS",
    "COUNTY_FIPS_CLASS_CODE",
    "COUNTY_NAME",
    "COUNTY_NS_CODE")

The hierarchy is:

("COUNTY" CHILD OF "STATE")

County FIPS codes are local to a state. The same county code can identify different counties in different states, so COUNTY_FIPS alone cannot determine one state.

Attribute dimension fix

The county level now uses the state and county composite key:

LEVEL "COUNTY"
  KEY ("STATE_FIPS", "COUNTY_FIPS")
  DETERMINES (
    "STATE_FIPS",
    "COUNTY_FIPS_CLASS_CODE",
    "COUNTY_NAME",
    "COUNTY_NS_CODE")

The existing hierarchy remains valid:

("COUNTY" CHILD OF "STATE")

Analytic View binding fix

The Analytic View binding now uses the same compound key:

"UDSA_COUNTIES_AD" AS "UDSA_COUNTIES_AD"
  KEY ("STATE_FIPS", "COUNTY_FIPS")
    REFERENCES DISTINCT ("STATE_FIPS", "COUNTY_FIPS")
    SPARSE MANY TO ONE RELATIONSHIP
  HIERARCHIES (
    "UDSA_COUNTIES" AS "COUNTIES" DEFAULT)

3. Security-delay minutes

Reported problem

Example question:

Fetch avg security delay minutes, total security delay minutes at levels day of week

The questions explicitly requested total security-delay minutes, but their golden SQL selected SUM_SECURITY_DELAY_HOURS.

The existing hours measure also rounded each flight’s delay to a whole hour before summing:

"SUM_SECURITY_DELAY_HOURS" FACT (
  ROUND((security_delay_minutes / 60), 0))
  AGGREGATE BY SUM
CLASSIFICATION "CAPTION" VALUE 'Total Security Delay Minutes'
CLASSIFICATION "DESCRIPTION"
  VALUE 'The total (sum) Security Delays in hours.'
CLASSIFICATION "UNITS" VALUE 'Hours'

This definition had several problems:

  • The measure name indicated hours while the questions requested minutes.
  • Its caption indicated minutes while its units indicated hours.
  • Each flight was rounded before aggregation.
  • SUM(ROUND(minutes / 60, 0)) is not equivalent to SUM(minutes) / 60.
  • Per-flight rounding could materially understate the total.

Fix

A proper total minutes measure is now added, defined as:

"SUM_SECURITY_DELAY_MINUTES" FACT (
  security_delay_minutes)
  AGGREGATE BY SUM
CLASSIFICATION "CAPTION" VALUE 'Total Security Delay Minutes'
CLASSIFICATION "DESCRIPTION"
  VALUE 'The total security delay in minutes.'
CLASSIFICATION "UNITS" VALUE 'Minutes'

All 16 affected golden SQL queries now select this new created measure

Retained hours measure

SUM_SECURITY_DELAY_HOURS was not removed. It remains available for compatibility, but it now converts the aggregated minute total to exact hours:

"SUM_SECURITY_DELAY_HOURS" AS (
  "SUM_SECURITY_DELAY_MINUTES" / 60)
CLASSIFICATION "CAPTION" VALUE 'Total Security Delay Hours'
CLASSIFICATION "DESCRIPTION"
  VALUE 'The total security delay in hours without per-flight rounding.'
CLASSIFICATION "UNITS" VALUE 'Hours'

@yassirsalmi yassirsalmi self-assigned this Sep 17, 2026
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 17, 2026
@trigonak

Copy link
Copy Markdown
Member

We need to add a note to our RESULTS.md clarifying pointing to the commit on which we ran those numbers and that some queries were since updates, so new numbers are WIP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants