-
Notifications
You must be signed in to change notification settings - Fork 7
mvtc empty #7348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
mvtc empty #7348
Conversation
- JdbcType implements SimpleConvert - PropertyType implements SimpleConvert - ColumnInfo implements SimpleConvert - Unit implements SimpleConvert
- JdbcType implements SimpleConvert - PropertyType implements SimpleConvertmake JdbcType.CHAR.convert() consistent with JdbcType.VARCHAR - ColumnInfo implements SimpleConvert - Unit implements SimpleConvert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request consolidates column value conversion and required/non-empty validation logic across the codebase. The primary goals are to handle Array type validation correctly (where required means "cardinality() > 0" rather than "IS NOT NULL") and to ensure consistent conversion behavior for Multiple-choice text fields (converting null/"" to [] rather than null).
Changes:
- Introduces the
SimpleConvertinterface to unify conversion logic across JdbcType, PropertyType, Unit, and ColumnInfo - Consolidates conversion logic into
ColumnInfo.convert()instead of scatteredConvertUtils.convert()calls - Adds
JdbcType.isEmpty()method to properly validate required fields based on type-specific semantics - Adds
array_is_empty()SQL function for PostgreSQL to check array emptiness using cardinality
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| api/src/org/labkey/api/data/SimpleConvert.java | New interface defining conversion contract with optional performance optimization method |
| api/src/org/labkey/api/data/JdbcType.java | Implements SimpleConvert, adds isEmpty() method with Array-specific logic, refactors convert() methods |
| api/src/org/labkey/api/exp/PropertyType.java | Implements SimpleConvert, updates STRING/MULTI_LINE/XML_TEXT to convert empty strings to null |
| api/src/org/labkey/api/ontology/Unit.java | Implements SimpleConvert for Quantity conversion |
| api/src/org/labkey/api/data/ColumnRenderProperties.java | Adds SimpleConvert interface, refactors getConvertFn() to use new pattern |
| api/src/org/labkey/api/data/BaseColumnInfo.java | Implements getConvertFn() using ColumnRenderProperties.getDefaultConvertFn() |
| api/src/org/labkey/api/data/AbstractWrappedColumnInfo.java | Implements getConvertFn() delegation |
| api/src/org/labkey/api/exp/PropertyDescriptor.java | Implements getConvertFn() delegation |
| api/src/org/labkey/api/data/validator/RequiredValidator.java | Updated to use JdbcType parameter and isEmpty() method for validation |
| api/src/org/labkey/api/data/validator/ColumnValidators.java | Updated createRequiredValidator to pass JdbcType to RequiredValidator |
| api/src/org/labkey/api/dataiterator/SimpleTranslator.java | Refactored conversion columns to use ColumnInfo.convert(), removed PropertyConvertColumn classes |
| api/src/org/labkey/api/dataiterator/StandardDataIteratorBuilder.java | Updated to use simplified addConvertColumn signature |
| api/src/org/labkey/api/data/ConvertHelper.java | Added getSimpleConvert() factory method, updated DateFriendlyStringConverter to handle empty strings |
| api/src/org/labkey/api/data/TableViewForm.java | Refactored to use col.convert() instead of ConvertUtils.convert() |
| api/src/org/labkey/api/data/MultiChoice.java | Updated DisplayColumn to implement IMultiValuedDisplayColumn, improved rendering |
| api/src/org/labkey/api/query/*.java | Multiple query service classes updated to use col.convert() |
| experiment/src/org/labkey/experiment/api/*.java | Multiple experiment classes updated to use col.convert() or type.convert() |
| query/src/org/labkey/query/sql/Method.java | Added ArrayIsEmptyMethod for array_is_empty SQL function |
| api/src/org/labkey/api/webdav/WebdavResource.java | Added getSpringResource() helper method |
| api/webapp/WEB-INF/web.xml | Updated to Servlet 3.0 spec, added async-supported to filters |
| api/src/org/labkey/api/data/ColumnInfoTests.jsp | New test file for ColumnInfo.convert() integration testing |
| api/src/messages/Validation.properties | Fixed typo: "tyepMismatch" -> "typeMismatch" |
| core/src/org/labkey/core/CoreModule.java | Added ColumnInfoTests.jsp as integration test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } final String name = col.getName(); | ||
|
|
||
|
|
||
|
|
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be orphaned code on line 1347. The variable declaration final String name = col.getName(); is defined but never used in this scope, and appears to be a remnant from refactoring. This dead code should be removed.
| } final String name = col.getName(); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep should remove
| @Override | ||
| public URL getURL() throws IOException | ||
| { | ||
| // Nnot sure why getExceuteHref() takes a view context. We ay not need for the moment. |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are spelling errors in the comment. "Nnot" should be "Not", "getExceuteHref" should be "getExecuteHref", and "We ay" should be "We may".
I'm not sure if the current callers handle FIELD_MARKER???.
update DomainKind.hasNullValues() to handle empty arrays, also a faster version.
| return new SqlSelector(ExperimentService.get().getSchema(), blankRowsSQL).exists(); | ||
| } | ||
|
|
||
| if (getTotalAndNonBlankSql(domain, prop, allRowsSQL, nonBlankRowsSQL)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For non-provisioned domain, why do we need a second check if getBlanksSql(domain, prop, blankRowsSQL) is false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there may be a case where the domain supports provisioning (null != getStorageSchemaName()), but no table has been created yet (null == domain.getStorageTableName()).
In that case both methods could return false. I just tried to keep the flow mostly the same.
| } final String name = col.getName(); | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep should remove
| // error | ||
| if (col.isMvEnabled() && col.isNullable()) | ||
| // if the column is mv-enabled and a mv indicator has been specified, don't flag the required error | ||
| if (col.isMvEnabled() && col.isNullable()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be checked if requiredError is true, right?
| @Override | ||
| public boolean isEmpty(Object value) | ||
| { | ||
| if (null == value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check for JSONArray to be consistent with other places?
Rationale
For Array type required does not mean "IS NOT NULL" it means "cardinality() > 0".
Also for Multiple-choice text we prefer that null/"" converts to [] not to null.
To help implement this we consolidate column conversion into ColumnInfo.convert() and required/non-empty checking into JdbcType.isEmpty().
Related Pull Requests
Changes