Conversation
… to DOUBLE[] columns
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdd VARCHAR (Utf8Sequence) support for writing STRING-like inputs into ARRAY columns by splitting array validation paths, adding a Utf8Sequence overload in RecordToRowCopierUtils, a corresponding implicitCastVarcharAsDoubleArray in SqlUtil, branching generated code to the VARCHAR path, and adding unit tests. Changes
Sequence Diagram(s)sequenceDiagram
participant Copier as Generated copier
participant Utils as RecordToRowCopierUtils
participant Sql as SqlUtil
participant Parser as DoubleArrayParser
participant Row as TableWriter.Row
Copier->>Utils: validateArrayDimensionsAndTransferCol(row, col, parser, vch, expectedType)
Utils->>Sql: implicitCastVarcharAsDoubleArray(vch, parser, expectedType)
Sql->>Parser: parse(vch.asAsciiCharSequence(), dims)
Parser-->>Sql: ArrayView (or throw)
Sql-->>Utils: ArrayView
Utils->>Row: putArray(col, ArrayView)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
core/src/test/java/io/questdb/test/griffin/InsertCastTest.java (2)
1342-1342: Typo: fix comment “bar array” → “bad array”Minor nit.
Apply this diff:
- // bar array + // bad array
1347-1351: Confirm intent: error message reports from-type as STRING even for VARCHAR inputThe expected message uses [STRING -> DOUBLE[][]] although the input is cast as VARCHAR. This matches the current implementation (SqlUtil.implicitCastVarcharAsDoubleArray throws with from-type STRING). If this is the intended UX to unify error messaging across STRING/VARCHAR for array parsing, all good. If not, consider aligning the from-type to VARCHAR in both code and tests.
core/src/main/java/io/questdb/griffin/SqlUtil.java (1)
879-889: Clarify why exceptions use from-type STRING for VARCHAR inputThe implementation intentionally throws ImplicitCastException with from-type STRING for VARCHAR inputs. This matches tests, but differs from other VARCHAR casts (which report VARCHAR). Consider documenting this to avoid confusion for future maintainers.
Apply this diff to add a brief rationale comment:
public static ArrayView implicitCastVarcharAsDoubleArray(Utf8Sequence value, DoubleArrayParser parser, int expectedType) { + // Note: We deliberately report the source type as STRING in error messages, even though the input is VARCHAR. + // Arrays are parsed from an ASCII CharSequence (value.asAsciiCharSequence()), and existing array-cast errors + // are standardized to [STRING -> <ARRAY_TYPE>] across STRING/VARCHAR inputs. try { parser.of(value.asAsciiCharSequence(), ColumnType.decodeArrayDimensionality(expectedType)); } catch (IllegalArgumentException e) { throw ImplicitCastException.inconvertibleValue(value, ColumnType.STRING, expectedType); } if (expectedType != ColumnType.UNDEFINED && parser.getType() != expectedType) { throw ImplicitCastException.inconvertibleValue(value, ColumnType.STRING, expectedType); } return parser; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
core/src/main/java/io/questdb/griffin/RecordToRowCopierUtils.java(5 hunks)core/src/main/java/io/questdb/griffin/SqlUtil.java(1 hunks)core/src/test/java/io/questdb/test/griffin/InsertCastTest.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: New pull request (Check Changes Check changes)
- GitHub Check: build
- GitHub Check: build
🔇 Additional comments (7)
core/src/test/java/io/questdb/test/griffin/InsertCastTest.java (1)
1331-1352: Solid coverage for VARCHAR → DOUBLE[][] happy-path, null, and failure cases
- The positive path and null handling look good.
- The two negative cases are valuable: non-array text and non-ASCII content.
core/src/main/java/io/questdb/griffin/RecordToRowCopierUtils.java (6)
175-177: Pool both overloads for STRING/VARCHAR array transfersGood addition. This allows the generator to emit the right helper call based on source column type.
275-277: Enable array parser path for both STRING and VARCHAR sourcesCorrectly broadens the special-case stack setup so the parser is available for VARCHAR→ARRAY casts too.
721-729: Correct bytecode sequence for VARCHAR → ARRAY transfer
- Stack setup is consistent: [rowWriter, toColIdx, parser, record, fromColIdx] → getVarcharA → [rowWriter, toColIdx, parser, varchar] → push toColumnType → static helper.
- Using the VARCHAR-specific helper ensures Utf8Sequence is handled without intermediate allocations beyond the ascii view.
Looks good.
817-818: Mirror STRING path to dedicated helperSwitching the STRING branch to the String-specific helper maintains symmetry and keeps the method signatures clean in the generator.
1188-1197: New VARCHAR helper: null-safe and delegates to SqlUtilThe null short-circuit preserves TableWriter/WAL null semantics. Delegation to SqlUtil centralizes parsing and error messaging. Good separation of concerns.
1203-1206: Array parser is now required for STRING and VARCHAR sourcesAccurate capability check; avoids unnecessary parser field for unrelated copy plans.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
unrelated test failure, created #6062 |
|
another failure due to #6062 |
[PR Coverage check]😍 pass : 18 / 19 (94.74%) file detail
|

Fixes an internal error that occurred when inserting
VARCHARvalues containing array representations intoDOUBLE[](or other array type) columns. The system now properly handles implicit casting fromVARCHARto array types duringINSERToperations.