-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-9549][SQL] fix bugs in expressions #7882
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
Changes from 2 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 |
|---|---|---|
|
|
@@ -227,6 +227,7 @@ abstract class BinaryComparison extends BinaryOperator with Predicate { | |
|
|
||
| override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = { | ||
| if (ctx.isPrimitiveType(left.dataType) | ||
| && left.dataType != BooleanType // java boolean doesn't support > or < operator | ||
|
Contributor
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. our codegen can handle boolean type, doesn't it?
Contributor
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.
Member
Author
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. yes, but without test against // faster version
defineCodeGen(ctx, ev, (c1, c2) => s"$c1 $symbol $c2")rather than the else part, therefore,
Contributor
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. ah ic, makes sense, good catch! |
||
| && left.dataType != FloatType | ||
| && left.dataType != DoubleType) { | ||
| // faster version | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -614,8 +614,9 @@ object DateTimeUtils { | |
| */ | ||
| def dateAddMonths(days: Int, months: Int): Int = { | ||
| val absoluteMonth = (getYear(days) - YearZero) * 12 + getMonth(days) - 1 + months | ||
| val currentMonthInYear = absoluteMonth % 12 | ||
| val currentYear = absoluteMonth / 12 | ||
| val nonNegativeMonth = if (absoluteMonth >= 0) absoluteMonth else 0 | ||
| val currentMonthInYear = nonNegativeMonth % 12 | ||
| val currentYear = nonNegativeMonth / 12 | ||
|
Contributor
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. The above two statements can be replaced with:
Contributor
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. How is that possible?
Contributor
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. /% is not defined for Int. I read the notion in a Scala book which I have returned. I will read more once I have that book back. |
||
| val leapDay = if (currentMonthInYear == 1 && isLeapYear(currentYear + YearZero)) 1 else 0 | ||
| val lastDayOfMonth = monthDays(currentMonthInYear) + leapDay | ||
|
|
||
|
|
@@ -626,7 +627,7 @@ object DateTimeUtils { | |
| } else { | ||
| dayOfMonth | ||
| } | ||
| firstDayOfMonth(absoluteMonth) + currentDayInMonth - 1 | ||
| firstDayOfMonth(nonNegativeMonth) + currentDayInMonth - 1 | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
could this throw a bad exception if the input is some other type that is not Double/Float?
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 have this in
Nanvl: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.
can you double check that FunctionArgumentConversion is not called before the implicit cast rule?