ggangadharan commented on code in PR #6898:
URL: https://github.com/apache/hive/pull/6898#discussion_r4347645347
##########
ql/src/java/org/apache/hadoop/hive/ql/plan/VectorPTFDesc.java:
##########
@@ -108,21 +111,40 @@ public enum SupportedFunctionType {
LAST_VALUE,
COUNT(true),
LEAD,
- LAG;
+ LAG,
+ VARIANCE(VarianceKind.VARIANCE),
+ VAR_POP(VarianceKind.VARIANCE),
+ VAR_SAMP(VarianceKind.VARIANCE_SAMPLE),
+ STD(VarianceKind.STANDARD_DEVIATION),
+ STDDEV(VarianceKind.STANDARD_DEVIATION),
+ STDDEV_POP(VarianceKind.STANDARD_DEVIATION),
+ STDDEV_SAMP(VarianceKind.STANDARD_DEVIATION_SAMPLE);
private final boolean supportDistinct;
+ private final VarianceKind varianceKind;
SupportedFunctionType() {
- supportDistinct = false;
+ this(false);
}
SupportedFunctionType(boolean supportDistinct) {
this.supportDistinct = supportDistinct;
+ this.varianceKind = null;
+ }
+
+ SupportedFunctionType(VarianceKind varianceKind) {
+ this.supportDistinct = false;
Review Comment:
Thanks for the review! Both fields are final, so Java requires each
constructor to assign them; dropping the assignment fails to compile (variable
supportDistinct might not have been initialized). I'd like to keep the enum
fields final, since enums are meant to be immutable. Instead, all three
constructors now delegate to a single canonical SupportedFunctionType(boolean
supportDistinct, VarianceKind varianceKind), so the fields are assigned in one
place only and the separate = false / = null lines are gone. If you'd prefer
non-final fields with empty constructor bodies, I can switch to that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]