Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nbauernfeind
Copy link
Member

Fixes #5998.

@nbauernfeind nbauernfeind added this to the 0.37.0 milestone Sep 12, 2024
@nbauernfeind nbauernfeind self-assigned this Sep 12, 2024
@@ -20290,6 +20290,10 @@ public static boolean greaterEquals(float a, BigDecimal b) {
return compareTo(a, b) >= 0;
}

public static BigDecimal negate(BigDecimal a) {
Copy link
Member

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.

final ColumnDefinition<?> cd = ColumnDefinition.fromGenericType(name, cs.getType(), cs.getComponentType());
columnDefinitions.put(name, cd);
}
parentTable.getDefinition().getColumns().forEach(cd -> columnDefinitions.put(cd.getName(), cd));
Copy link
Member

Choose a reason for hiding this comment

The 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 select(), view(), update(), and updateView() preserving a partitioning column: does the output reflect that the column is partitioning, and is that a change?

@@ -189,7 +189,7 @@ public List<String> initDef(
.endl();

applyUsedVariables(columnDefinitionMap, result.getVariablesUsed(), result.getPossibleParams());
returnedType = result.getType();
returnedType = TypeUtils.getUnboxedTypeIfBoxed(result.getType());
Copy link
Member

Choose a reason for hiding this comment

The 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 getReturnedType? I'm mainly concerned about the python formula column.

Comment on lines +1720 to +1722
// Verify that the operator overload method returns the original expected type (or its unboxed form):
Assert.equals(TypeUtils.getUnboxedTypeIfBoxed(ret), "TypeUtils.getUnboxedTypeIfBoxed(ret)",
result, "result");
Copy link
Member

Choose a reason for hiding this comment

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

Should we allow boxed or unboxed?

Assert.equals(TypeUtils.getUnboxedTypeIfBoxed(ret), "TypeUtils.getUnboxedTypeIfBoxed(ret)",
                TypeUtils.getUnboxedTypeIfBoxed(result), "TypeUtils.getUnboxedTypeIfBoxed(result)");

@@ -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):
Copy link
Member

Choose a reason for hiding this comment

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

We talked about "smart unboxing" when given a null input that matches a single primitive method. I'm not sure if it makes sense, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QueryLanguageParser regression in the handling of inequalities inside of update_view
2 participants