Skip to content

Conversation

@Tankilevitch
Copy link
Contributor

Summary

Fixes Oracle NJS-098 bind parameter mismatch errors that occurred when queries with rolling windows generated time series. Previously, generated time series columns (date_from/date_to) were incorrectly treated as bind parameters, causing a mismatch between placeholder count (10) and provided values (6).

Changes

  • Refactored Oracle date/time casting logic with helper methods
  • Added isIdentifierToken() to detect column identifiers vs bind parameters
  • Added toTimestampTz() to centralize timestamp conversion logic
  • Column identifiers from generated time series now use direct references
  • Bind parameters are preserved only for filter values
  • Added comprehensive JSDoc documentation

Technical Details

Before: All values (including date_from/date_to) were treated as bind parameters with format :"date_from", causing 10 bind placeholders but only 6 parameter values.

After: Column identifiers are detected and used directly: TO_TIMESTAMP_TZ(date_from, ...) while bind parameters (?) continue to use :"?". This results in correct 6 bind placeholders matching 6 parameter values.

Testing

  • Added comprehensive test: does not bind generated time series date_from/date_to
  • All 59 Oracle query tests pass
  • Verified generated SQL has correct bind parameter count
  • Test includes SQL output inspection for debugging

Related Issues

Fixes Oracle NJS-098 errors: "10 bind placeholders were used in the SQL statement but 6 bind values were provided"

Checklist

  • Code follows project conventions
  • Tests added/updated and passing
  • Documentation updated with JSDoc
  • No breaking changes
  • Linting issues resolved (pre-existing warnings in other files)

@Tankilevitch Tankilevitch requested a review from a team as a code owner November 1, 2025 13:23
@github-actions github-actions bot added the javascript Pull requests that update Javascript code label Nov 1, 2025
@Tankilevitch Tankilevitch force-pushed the fix/oracle-bind-parameter-time-series branch from fccd1c1 to 6a7dfa8 Compare November 1, 2025 13:23
@github-actions github-actions bot added the pr:community Contribution from Cube.js community members. label Nov 1, 2025
@Tankilevitch Tankilevitch force-pushed the fix/oracle-bind-parameter-time-series branch 2 times, most recently from 20ab01b to d5b6f5c Compare November 1, 2025 13:27
Refactor Oracle date/time casting logic to properly handle column
identifiers from generated time series (date_from/date_to) without
treating them as bind parameters.

Previously, all values passed to dateTimeCast/timeStampCast were
treated as bind parameters, causing Oracle NJS-098 errors when
queries with rolling windows generated 10 bind placeholders but only
6 parameter values.

Changes:
- Add helper methods isIdentifierToken() and toTimestampTz() to
  centralize casting logic
- Detect column identifiers vs bind parameters ('?')
- Use direct column references for generated series columns
- Preserve bind parameters for filter values only
- Add comprehensive JSDoc documentation

Fixes bind parameter count mismatch that caused NJS-098 errors.
@Tankilevitch Tankilevitch force-pushed the fix/oracle-bind-parameter-time-series branch from d5b6f5c to cafc7fb Compare November 1, 2025 13:29
@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.45%. Comparing base (b0b011e) to head (cafc7fb).

❗ There is a different number of reports uploaded between BASE (b0b011e) and HEAD (cafc7fb). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b0b011e) HEAD (cafc7fb)
cubesql 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #10108       +/-   ##
===========================================
- Coverage   78.10%   55.45%   -22.66%     
===========================================
  Files         457      207      -250     
  Lines       90994    16503    -74491     
  Branches     3330     3244       -86     
===========================================
- Hits        71070     9151    -61919     
+ Misses      19451     6893    -12558     
+ Partials      473      459       -14     
Flag Coverage Δ
cube-backend 55.45% <100.00%> (+0.34%) ⬆️
cubesql ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

javascript Pull requests that update Javascript code pr:community Contribution from Cube.js community members.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant