Skip to content

Implement CQL Long#361

Closed
cmoesel wants to merge 2 commits into
test-serverfrom
fix-bugs
Closed

Implement CQL Long#361
cmoesel wants to merge 2 commits into
test-serverfrom
fix-bugs

Conversation

@cmoesel
Copy link
Copy Markdown
Member

@cmoesel cmoesel commented Apr 23, 2026

This PR introduces support for CQL Long, represented using BigInt in JavaScript. Since Integer and Decimal are represented using Number, we can easily distinguish CQL Longs from Integers and Decimals by their type (typeof var === 'bigint'). This actually made implementation easier (and more correct) compared to my initial implementation using Number (which I thought would be easier since it was more of an incremental change, but maybe not).

I based this PR on the test-server branch so I could test it with the CQL Test Runner, but in hindsight, that also wasn't that smart because of cql-tests-runner#79 (which basically reports that the test runner doesn't correctly detect equal Longs). Oh well. If you want to test it using the Test Runner anyway, feel free -- but I've updated the cql-tests-runner mitre-wip branch to skip the Long tests since the runner doesn't support them correctly.

This PR is configured to go into the test-server branch, but that's just so it is easy to see only the relevant changes in the diff. I'm marking this draft for now because I think test-server should be merged first (if we decide to merge it) and then this should be changed to be based on main.

Submitter:

  • This pull request describes why these changes were made
  • Code diff has been done and been reviewed (it does not contain: additional white space, not applicable code changes, debug statements, etc.)
  • Tests are included and test edge cases
  • Tests have been run locally and pass
  • Code coverage has not gone down and all code touched or added is covered.
  • Code passes lint and prettier (hint: use npm run test:plus to run tests, lint, and prettier)
  • All dependent libraries are appropriately updated or have a corresponding PR related to this change
  • cql4browsers.js built with npm run build:browserify if source changed.

Reviewer:

Name:

  • Code is maintainable and reusable, reuses existing code and infrastructure where appropriate, and accomplishes the task’s purpose
  • The tests appropriately test the new code, including edge cases
  • You have tried to break the code

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 73.07692% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.82%. Comparing base (af1fd22) to head (d67ec1f).

Files with missing lines Patch % Lines
src/util/math.ts 68.75% 8 Missing and 2 partials ⚠️
src/elm/type.ts 71.42% 4 Missing and 2 partials ⚠️
src/runtime/context.ts 0.00% 2 Missing and 1 partial ⚠️
src/elm/arithmetic.ts 91.66% 0 Missing and 1 partial ⚠️
src/elm/literal.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           test-server     #361      +/-   ##
===============================================
+ Coverage        87.58%   87.82%   +0.24%     
===============================================
  Files               52       53       +1     
  Lines             4607     4675      +68     
  Branches          1297     1299       +2     
===============================================
+ Hits              4035     4106      +71     
- Misses             359      373      +14     
+ Partials           213      196      -17     

☔ 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.

cmoesel added 2 commits May 8, 2026 17:18
- Add support for Long literal, ToLong conversion, min/max long values
- Use JavaScript Number to represent Long (NOTE: this means that values are imprecise outside of the safe integer range in JS)
- Add tests for literals, conversion, and other operations that accept Long arguments
- Improve underflow/overflow tests to test boundaries more carefully
- Added .skip to tests that fail due to Number imprecision for high values
- Unskipped Long tests in the spec tests that now pass
Update support for Long to use BigInt so we can distinguish between decimal/integer (JS Number) and long (JS BigInt).
@cmoesel cmoesel changed the title Implement CQL Long and Fix DateTime toString() bug Implement CQL Long May 8, 2026
@cmoesel
Copy link
Copy Markdown
Member Author

cmoesel commented May 11, 2026

Closing this PR in favor of #363, which is based on main instead of the test-server branch.

@cmoesel cmoesel closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants