-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix: SelectColumn Should Unbox Result Type #6052
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1717,10 +1717,11 @@ public Class<?> visit(UnaryExpr n, VisitArgs printer) { | |
// since the original expression was visited by getTypeWithCaching at the beginning of this method. | ||
final Class<?> result = unaryOpOverloadMethod.accept(this, printer); | ||
|
||
// Verify that the operator overload method returns the original expected type: | ||
Assert.equals(ret, "ret", result, "result"); | ||
// Verify that the operator overload method returns the original expected type (or its unboxed form): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We talked about "smart unboxing" when given a |
||
Assert.equals(TypeUtils.getUnboxedTypeIfBoxed(ret), "TypeUtils.getUnboxedTypeIfBoxed(ret)", | ||
result, "result"); | ||
Comment on lines
+1720
to
+1722
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we allow boxed or unboxed?
|
||
|
||
return ret; | ||
return result; | ||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,7 +189,7 @@ public List<String> initDef( | |
.endl(); | ||
|
||
applyUsedVariables(columnDefinitionMap, result.getVariablesUsed(), result.getPossibleParams()); | ||
returnedType = result.getType(); | ||
returnedType = TypeUtils.getUnboxedTypeIfBoxed(result.getType()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a healthy change. That said, should we be changing the consumer of returned type to ensure that things are better for all select columns? Or should we check the other implementations of |
||
if (returnedType == boolean.class) { | ||
returnedType = Boolean.class; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,12 +111,7 @@ public static AnalyzerContext createContext( | |
|
||
// First pass to initialize all columns and to compile formulas in one batch. | ||
final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor = QueryCompilerRequestProcessor.batch(); | ||
for (Map.Entry<String, ColumnSource<?>> entry : columnSources.entrySet()) { | ||
final String name = entry.getKey(); | ||
final ColumnSource<?> cs = entry.getValue(); | ||
final ColumnDefinition<?> cd = ColumnDefinition.fromGenericType(name, cs.getType(), cs.getComponentType()); | ||
columnDefinitions.put(name, cd); | ||
} | ||
parentTable.getDefinition().getColumns().forEach(cd -> columnDefinitions.put(cd.getName(), cd)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would definitely run nightlies. I would also like you to test out what happens if you run |
||
|
||
final Set<String> resultColumnNames = new HashSet<>(); | ||
for (final SelectColumn sc : selectColumns) { | ||
|
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.
Maybe we should assess if there are further gaps? Maybe the way to get there is by updating the generator and adding it to our process.