Skip to content

Conversation

XuechunHHH
Copy link
Contributor

@XuechunHHH XuechunHHH commented Oct 1, 2025

Relevant Issues

Description

  • Add UPPER, LOWER and TRIM functions support on CHAR/VARCHAR types.
  • Formalize Concat operator length/type handling for string types.
  • Update submodule.

Other Information

  • Updated Unreleased Section in CHANGELOG: YES
  • Any backward-incompatible changes? NO
  • Any new external dependencies? NO
  • Do your changes comply with the contributing and code style guidelines? YES

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

github-actions bot commented Oct 1, 2025

CROSS-COMMIT-REPORT-PARTIQLCORE ❌

BASE (154B9B4) TARGET (BF59CE2) +/-
% Passing 94.65% 93.80% -0.85% ⭕
Passing 6440 6531 91 ✅
Failing 176 246 70 ⭕
Ignored 188 186 -2 ✅
Total Tests 6804 6963 159 ✅

Testing Details

Result Details

  • ❌ REGRESSION DETECTED. See Now Failing/Ignored Tests. ❌
  • New passing tests: 255
  • New failing tests: 27
  • New ignored tests: 0
  • Passing in both: 6276
  • Failing in both: 170
  • Ignored in both: 186
  • PASSING in BASE but now FAILING in TARGET: 51
  • PASSING in BASE but now IGNORED in TARGET: 0
  • FAILING in BASE but now PASSING in TARGET: 2
  • IGNORED in BASE but now PASSING in TARGET: 0

New Tests Added

The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

Now FAILING Tests ❌

The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

Now Passing Tests

The following 2 test(s) were previously FAILING in BASE but are now PASSING in TARGET. Before merging, confirm they are intended to pass:

Click here to see
  1. repeated field on struct is ambiguous{identifier:"REPEATED",cn:9,bn:"REPEATED"}, compileOption: STRICT
  2. repeated field on struct is ambiguous{identifier:" "repeated" ",cn:10,bn:"repeated"}, compileOption: STRICT

CROSS-COMMIT-REPORT-PARTIQLEXTENDED ✅

BASE (154B9B4) TARGET (BF59CE2) +/-
% Passing 34.25% 35.22% 0.97% ✅
Passing 670 696 26 ✅
Failing 1286 1280 -6 ✅
Ignored 0 0 0 ✅
Total Tests 1956 1976 20 ✅

Testing Details

Result Details

  • New passing tests: 34
  • New failing tests: 0
  • New ignored tests: 0
  • Passing in both: 662
  • Failing in both: 1280
  • Ignored in both: 0
  • PASSING in BASE but now FAILING in TARGET: 0
  • PASSING in BASE but now IGNORED in TARGET: 0
  • FAILING in BASE but now PASSING in TARGET: 0
  • IGNORED in BASE but now PASSING in TARGET: 0

New Tests Added

The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact.

@XuechunHHH
Copy link
Contributor Author

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

@XuechunHHH XuechunHHH closed this Oct 6, 2025
@XuechunHHH XuechunHHH reopened this Oct 7, 2025
@XuechunHHH XuechunHHH changed the title add: temporary work around string functions support for CHAR/VARCHAR add: UPPER, LOWER and TRIM support for CHAR/VARCHAR types Oct 8, 2025
CHANGELOG.md Outdated
## [Unreleased](https://TODO.com) - YYYY-MM-DD

### Added
- `UPPER`, `LOWER`, `TRIM` function support for `CHAR/VARCHAR` types
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review: Since the length handling should also be done at planning time, add the real function support instead of only siganatures.

@xd1313113
Copy link
Contributor

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

You probably need a rebase

@XuechunHHH
Copy link
Contributor Author

XuechunHHH commented Oct 8, 2025

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

You probably need a rebase

Previously, our submodule partiql-tests target is https://github.com/partiql/partiql-tests/tree/c40ef9738ed812ac8322c8c63aa3cbe3e2fee18f.
In this PR, update it to https://github.com/partiql/partiql-tests/tree/67d22dcd5a7eeaaa2624be9d1bb3da6a8b9faf0a.

@xd1313113
Copy link
Contributor

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

You probably need a rebase

Previously, our submodule partiql-tests target is https://github.com/partiql/partiql-tests/tree/c40ef9738ed812ac8322c8c63aa3cbe3e2fee18f. In this PR, update it to https://github.com/partiql/partiql-tests/tree/67d22dcd5a7eeaaa2624be9d1bb3da6a8b9faf0a.

PLK has been updated to latest https://github.com/partiql/partiql-tests/tree/67d22dcd5a7eeaaa2624be9d1bb3da6a8b9faf0a by my last PR.
And it is interesting that you did not get a merge conflicts. If you rebase, you will get a clean conformance report.

# Conflicts:
#	CHANGELOG.md
) { args ->
val string = args[0].bytes.toString(Charsets.UTF_8)
val result = string.lowercase()
Datum.clob(result.toByteArray())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curious, in Datum, we treat PType.CLOB as a byte array. I might be wrong here, but I think it should be just text by the SQL spec.

Copy link
Contributor Author

@XuechunHHH XuechunHHH Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently treat both CLOBand BLOB as byte[] in Datum. See

static Datum clob(@NotNull byte[] value) throws PRuntimeException {
// TODO: Check size of value
return clob(value, Integer.MAX_VALUE);
}
/**
* @param value the backing value
* @param length the length of the clob to coerce the value to
* @return a value of type {@link PType#CLOB} with the default length
* @throws PRuntimeException if the value could not fit into the requested length, or if the requested length is not allowed ({@link org.partiql.spi.errors.PError#INTERNAL_ERROR})
*/
@NotNull
static Datum clob(@NotNull byte[] value, int length) throws PRuntimeException {
// TODO: Check size of value
return new DatumBytes(value, PType.clob(length));
}
// BYTE STRINGS
/**
* @param value the backing value
* @return a value of type {@link PType#BLOB} with the default length
* @throws PRuntimeException if the value could not fit into the default length, or if the requested length is not allowed ({@link org.partiql.spi.errors.PError#INTERNAL_ERROR})
*/
@NotNull
static Datum blob(@NotNull byte[] value) throws PRuntimeException {
// TODO: Check size
return new DatumBytes(value, PType.blob(Integer.MAX_VALUE));
}
/**
* @param value the backing value
* @param length the length of the clob to coerce the value to
* @return a value of type {@link PType#BLOB} with the default length
* @throws PRuntimeException if the value could not fit into the requested length, or if the length is not valid ({@link org.partiql.spi.errors.PError#INTERNAL_ERROR})
*/
@NotNull
static Datum blob(@NotNull byte[] value, int length) throws PRuntimeException {
// TODO: Check size
return new DatumBytes(value, PType.blob(length));
}

Thanks for the call out. Agree that CLOB should be test-based instead. Both PType and Datum need to be formalized further.

@alancai98
Copy link
Member

alancai98 commented Oct 8, 2025

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

You probably need a rebase

Previously, our submodule partiql-tests target is partiql/partiql-tests@c40ef97. In this PR, update it to partiql/partiql-tests@67d22dc.

PLK has been updated to latest partiql/partiql-tests@67d22dc by my last PR. And it is interesting that you did not get a merge conflicts. If you rebase, you will get a clean conformance report.

The submodule currently in main is pointing to https://github.com/partiql/partiql-tests/tree/c40ef9738ed812ac8322c8c63aa3cbe3e2fee18f, which is not updated. It's correct in this PR https://github.com/partiql/partiql-lang-kotlin/pull/1839/files#diff-9f1f22f097a05c1bf7e176ec44837633ab6cd0b2afec6cf9743dccc4904f21e6.

In the future, I think we should generally update the conformance submodule in its own PR so we can distinguish conformance report changes more easily.

@xd1313113
Copy link
Contributor

The cross-commit report failure stems from the update of conformance test submodule. Run the conformance test locally, the failing and passing tests are exactly the same as the main branch.

You probably need a rebase

Previously, our submodule partiql-tests target is partiql/partiql-tests@c40ef97. In this PR, update it to partiql/partiql-tests@67d22dc.

PLK has been updated to latest partiql/partiql-tests@67d22dc by my last PR. And it is interesting that you did not get a merge conflicts. If you rebase, you will get a clean conformance report.

The submodule currently in main is pointing to https://github.com/partiql/partiql-tests/tree/c40ef9738ed812ac8322c8c63aa3cbe3e2fee18f, which is not updated. It's correct in this PR https://github.com/partiql/partiql-lang-kotlin/pull/1839/files#diff-9f1f22f097a05c1bf7e176ec44837633ab6cd0b2afec6cf9743dccc4904f21e6.

In the future, I think we should generally update the conformance submodule in its own PR so we can distinguish conformance report changes more easily.

Synced Xuechun offline. The conformance submodule was updated to latest by my PR 6792e1d,
but was reverted in John's PR yesterday accidentally. 154b9b4

It looks PR author is not aware of submodule update and may revert submodule unexpectedly as git add . will add reverted submodule automatically.


### Changed
- Formalize `UPPER`, `LOWER`, `TRIM` and `CONCAT` length and type handling on string types
- `CLOB` now supports length parameters with `CLOB(n)` syntax
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: Added support for max_length parameters in the CLOB type, which is CLOB(n) instead of CLOB now. This change aligns our syntax with the SQL-99 specification, which defines CLOB as optionally accepting a length parameter:

 <character string type> ::= 
      CHARACTER [ <left paren> <length> <right paren> ] 
      ...
      | CLOB [ <left paren> <large object length> <right paren> ]

PType.varchar(256), // TODO: Length
PType.string(),
PType.clob(Int.MAX_VALUE), // TODO: Length
PType.clob(256), // TODO: Length
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self-review: This change avoid corner test (overflow) in planner. Previously CLOB actually had fixed param max_length = Int.MAX_VALUE in the implementation.

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.

4 participants