Repository: partiql/partiql-lang-kotlin (kotlin)

Issue:
`INTERVAL` `MINUTE TO SECOND` uses wrong `IntervalCode`
## Description
- Specifying an `INTERVAL` Datum with a `MINUTE TO SECOND` interval qualifier uses the `HOUR TO SECOND` interval qualifier.

## To Reproduce
```
partiql ▶ INTERVAL '3:4.567' MINUTE TO SECOND (3)
   |

=== RESULT ===
INTERVAL '0:3:4.567' HOUR (2) TO SECOND (3)

OK!
```

## Expected Behavior
Expect above result to be a `MINUTE TO SECOND` interval.

## Additional Context
- Java version: 17
- PartiQL version: 1.2.3-SNAPSHOT
- Add any other context about the problem here.

Pull request description:
## Relevant Issues
- fix Issue #1771 

## Description
- Fix the interval code for `INTERVAL` datum with `MINUTE_SECOND` case to display the interval correctly.
## Other Information
- Updated Unreleased Section in CHANGELOG: **[YES]**: <Explain if NO>
- Any backward-incompatible changes? **[NO]**: <Explain if YES>
- Any new external dependencies? **[NO]**: <Explain if YES>
- Do your changes comply with the [contributing][cg] and [code style][csg] 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.

<!-- DO NOT DELETE BELOW -->

[cg]: https://github.com/partiql/partiql-lang-kotlin/blob/main/CONTRIBUTING.md
[csg]: https://github.com/partiql/partiql-lang-kotlin/blob/main/CODE_STYLE.md

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8546b26b7..d4860fcda 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,7 @@ Thank you to all who have contributed!
 ### Deprecated
 
 ### Fixed
+- Specify the correct qualifier for `INTERVAL` datum with `MINUTE TO SECOND`
 
 ### Removed
 
@@ -39,6 +40,7 @@ Thank you to all who have contributed!
 
 ### Contributors
 Thank you to all who have contributed!
+- @zyfy29
 
 ## [1.2.2](https://github.com/partiql/partiql-lang-kotlin/releases/tag/v1.2.2) - 2025-06-26
 
diff --git a/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java b/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java
index 95b988c07..f637005b5 100644
--- a/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java
+++ b/partiql-spi/src/main/java/org/partiql/spi/value/Datum.java
@@ -1118,7 +1118,7 @@ static Datum intervalMinuteSecond(int minutes, int seconds, int nanos, int preci
         DatumIntervalHelpers.checkUsingPrecision(minutes, precision);
         DatumIntervalHelpers.checkSeconds(seconds);
         int newNanos = DatumIntervalHelpers.coerceNanos(nanos, fractionalPrecision);
-        return new DatumIntervalDayTime(0, 0, minutes, seconds, newNanos, precision, fractionalPrecision, IntervalCode.HOUR_SECOND);
+        return new DatumIntervalDayTime(0, 0, minutes, seconds, newNanos, precision, fractionalPrecision, IntervalCode.MINUTE_SECOND);
     }
 
     /**


Test patch:
diff --git a/partiql-cli/src/test/kotlin/org/partiql/cli/io/DatumWriterTextPrettyTests.kt b/partiql-cli/src/test/kotlin/org/partiql/cli/io/DatumWriterTextPrettyTests.kt
index af592abf9..35432e930 100644
--- a/partiql-cli/src/test/kotlin/org/partiql/cli/io/DatumWriterTextPrettyTests.kt
+++ b/partiql-cli/src/test/kotlin/org/partiql/cli/io/DatumWriterTextPrettyTests.kt
@@ -64,7 +64,7 @@ class DatumWriterTextPrettyTests {
           INTERVAL '1 2:3:4.50' DAY (2) TO SECOND (2),
           INTERVAL '1:2' HOUR (2) TO MINUTE,
           INTERVAL '1:2:3.40' HOUR (2) TO SECOND (2),
-          INTERVAL '0:1:2.30' HOUR (2) TO SECOND (2),
+          INTERVAL '1:2.30' MINUTE (2) TO SECOND (2),
           {
             'bar': [
               1,