You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/09/16 20:37:30 UTC

[GitHub] [druid] rash67 opened a new pull request, #13102: Add BIG_SUM SQL function

rash67 opened a new pull request, #13102:
URL: https://github.com/apache/druid/pull/13102

   ### Description
   
   This adds a sql function, "BIG_SUM", that uses CompressedBigDecimal to do a sum. Other misc changes:
       
   1. handle NumberFormatExceptions when parsing a string (default to set
         to 0, configurable in agg factory to be strict and throw on error)
   2. format pom file (whitespace) + add dependency
   3. scaleUp -> scale and always require scale as a parameter
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `CompressedBigDecimalSqlAggregator` - sql function definitions and arg parsing
   
   <hr>
   
   This PR has:
   - [X] been self-reviewed.
   - [X] added documentation for new or modified features or behaviors.
   - [X] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [X] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [X] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] 2bethere commented on pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
2bethere commented on PR #13102:
URL: https://github.com/apache/druid/pull/13102#issuecomment-1281644662

   I realized this one has no docs attached. Can you help describe what is now possible that weren't possible before with BIG_SUM so that we can include this in the release notes? cc' @317brian 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rash67 commented on a diff in pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
rash67 commented on code in PR #13102:
URL: https://github.com/apache/druid/pull/13102#discussion_r975834440


##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalAggregatorFactory.java:
##########
@@ -65,19 +69,23 @@
    * @param fieldName fieldName metric field name
    * @param size      size of the int array used for calculations
    * @param scale     scale of the number
+   * @param strictNumberParsing if true, failure to parse strings to numbers throws an exception. otherwise 0 is
+   *                            returned
    */
   @JsonCreator
   public CompressedBigDecimalAggregatorFactory(
       @JsonProperty("name") String name,
       @JsonProperty("fieldName") String fieldName,
       @JsonProperty(value = "size", required = false) Integer size,
-      @JsonProperty(value = "scale", required = false) Integer scale
+      @JsonProperty(value = "scale", required = false) Integer scale,
+      @JsonProperty(value = "strictNumberParsing", required = false) Boolean strictNumberParsing
   )
   {
     this.name = name;
     this.fieldName = fieldName;
     this.size = size == null ? DEFAULT_SIZE : size;
     this.scale = scale == null ? DEFAULT_SCALE : scale;
+    this.strictNumberParsing = strictNumberParsing != null && strictNumberParsing;

Review Comment:
   hmm, everything else has defaults set in the SqlAggregator. The only reason I double-checked it here was because the JsonCreator requires Objects
   
   the scale and size are also both nullable and I could pass in null for those. it seems like I should be consistent with the parameters. Other SqlAggregators do add defaults, so do it in both locations or just the constructor?
   



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] cheddar merged pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
cheddar merged PR #13102:
URL: https://github.com/apache/druid/pull/13102


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rash67 commented on a diff in pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
rash67 commented on code in PR #13102:
URL: https://github.com/apache/druid/pull/13102#discussion_r975836709


##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalSqlAggregator.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.compressedbigdecimal;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.calcite.rel.core.AggregateCall;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.SqlAggFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.type.SqlTypeFamily;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.util.Optionality;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.segment.column.ColumnType;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.sql.calcite.aggregation.Aggregation;
+import org.apache.druid.sql.calcite.aggregation.SqlAggregator;
+import org.apache.druid.sql.calcite.expression.DruidExpression;
+import org.apache.druid.sql.calcite.expression.Expressions;
+import org.apache.druid.sql.calcite.planner.PlannerContext;
+import org.apache.druid.sql.calcite.rel.VirtualColumnRegistry;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+public class CompressedBigDecimalSqlAggregator implements SqlAggregator
+{
+  private static final SqlAggFunction FUNCTION_INSTANCE = new CompressedBigDecimalSqlAggFunction();
+  private static final String NAME = "BIG_SUM";
+
+  @Override
+  public SqlAggFunction calciteFunction()
+  {
+    return FUNCTION_INSTANCE;
+  }
+
+  @Nullable
+  @Override
+  public Aggregation toDruidAggregation(
+      PlannerContext plannerContext,
+      RowSignature rowSignature,
+      VirtualColumnRegistry virtualColumnRegistry,
+      RexBuilder rexBuilder,
+      String name,
+      AggregateCall aggregateCall,
+      Project project,
+      List<Aggregation> existingAggregations,
+      boolean finalizeAggregations
+  )
+  {
+    if (aggregateCall.getArgList().size() < 1) {
+      return null;
+    }
+
+    // fetch sum column expression
+    DruidExpression sumColumn = Expressions.toDruidExpression(
+        plannerContext,
+        rowSignature,
+        Expressions.fromFieldAccess(
+            rowSignature,
+            project,
+            aggregateCall.getArgList().get(0)
+        )
+    );
+
+    if (sumColumn == null) {
+      return null;
+    }
+
+    String sumColumnName;
+
+    if (sumColumn.isDirectColumnAccess()) {
+      sumColumnName = sumColumn.getDirectColumn();
+    } else {
+      sumColumnName =
+          virtualColumnRegistry.getOrCreateVirtualColumnForExpression(sumColumn, ColumnType.UNKNOWN_COMPLEX);
+    }
+
+    // check if size is provided
+    int size = CompressedBigDecimalAggregatorFactory.DEFAULT_SIZE;
+
+    if (aggregateCall.getArgList().size() >= 2) {
+      RexNode sizeArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(1)
+      );
+
+      size = ((Number) RexLiteral.value(sizeArg)).intValue();
+    }
+
+    // check if scale is provided
+    int scale = CompressedBigDecimalAggregatorFactory.DEFAULT_SCALE;
+
+    if (aggregateCall.getArgList().size() >= 3) {
+      RexNode scaleArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(2)
+      );
+
+      scale = ((Number) RexLiteral.value(scaleArg)).intValue();
+    }
+
+    boolean useStrictNumberParsing = CompressedBigDecimalAggregatorFactory.DEFAULT_STRICT_NUMBER_PARSING;

Review Comment:
   I'm updating size/scale to be null as well so the constructor is the authority on defaults



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] imply-cheddar commented on a diff in pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
imply-cheddar commented on code in PR #13102:
URL: https://github.com/apache/druid/pull/13102#discussion_r974816229


##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalAggregatorFactory.java:
##########
@@ -65,19 +69,23 @@
    * @param fieldName fieldName metric field name
    * @param size      size of the int array used for calculations
    * @param scale     scale of the number
+   * @param strictNumberParsing if true, failure to parse strings to numbers throws an exception. otherwise 0 is
+   *                            returned
    */
   @JsonCreator
   public CompressedBigDecimalAggregatorFactory(
       @JsonProperty("name") String name,
       @JsonProperty("fieldName") String fieldName,
       @JsonProperty(value = "size", required = false) Integer size,
-      @JsonProperty(value = "scale", required = false) Integer scale
+      @JsonProperty(value = "scale", required = false) Integer scale,
+      @JsonProperty(value = "strictNumberParsing", required = false) Boolean strictNumberParsing
   )
   {
     this.name = name;
     this.fieldName = fieldName;
     this.size = size == null ? DEFAULT_SIZE : size;
     this.scale = scale == null ? DEFAULT_SCALE : scale;
+    this.strictNumberParsing = strictNumberParsing != null && strictNumberParsing;

Review Comment:
   I'm pretty sure that when `strictNumberParsing` is `null`, this will be `false`, but it would be so much easier to be more sure of that if it followed the same pattern above:
   
   ```
   strictNumberParsing == null ? DEFAULT_STRICT_NUMBER_PARSING : strictNumberParsing
   ```



##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalSqlAggregator.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.compressedbigdecimal;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.calcite.rel.core.AggregateCall;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.SqlAggFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.type.SqlTypeFamily;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.util.Optionality;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.segment.column.ColumnType;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.sql.calcite.aggregation.Aggregation;
+import org.apache.druid.sql.calcite.aggregation.SqlAggregator;
+import org.apache.druid.sql.calcite.expression.DruidExpression;
+import org.apache.druid.sql.calcite.expression.Expressions;
+import org.apache.druid.sql.calcite.planner.PlannerContext;
+import org.apache.druid.sql.calcite.rel.VirtualColumnRegistry;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+public class CompressedBigDecimalSqlAggregator implements SqlAggregator
+{
+  private static final SqlAggFunction FUNCTION_INSTANCE = new CompressedBigDecimalSqlAggFunction();
+  private static final String NAME = "BIG_SUM";
+
+  @Override
+  public SqlAggFunction calciteFunction()
+  {
+    return FUNCTION_INSTANCE;
+  }
+
+  @Nullable
+  @Override
+  public Aggregation toDruidAggregation(
+      PlannerContext plannerContext,
+      RowSignature rowSignature,
+      VirtualColumnRegistry virtualColumnRegistry,
+      RexBuilder rexBuilder,
+      String name,
+      AggregateCall aggregateCall,
+      Project project,
+      List<Aggregation> existingAggregations,
+      boolean finalizeAggregations
+  )
+  {
+    if (aggregateCall.getArgList().size() < 1) {
+      return null;
+    }
+
+    // fetch sum column expression
+    DruidExpression sumColumn = Expressions.toDruidExpression(
+        plannerContext,
+        rowSignature,
+        Expressions.fromFieldAccess(
+            rowSignature,
+            project,
+            aggregateCall.getArgList().get(0)
+        )
+    );
+
+    if (sumColumn == null) {
+      return null;
+    }
+
+    String sumColumnName;
+
+    if (sumColumn.isDirectColumnAccess()) {
+      sumColumnName = sumColumn.getDirectColumn();
+    } else {
+      sumColumnName =
+          virtualColumnRegistry.getOrCreateVirtualColumnForExpression(sumColumn, ColumnType.UNKNOWN_COMPLEX);
+    }
+
+    // check if size is provided
+    int size = CompressedBigDecimalAggregatorFactory.DEFAULT_SIZE;
+
+    if (aggregateCall.getArgList().size() >= 2) {
+      RexNode sizeArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(1)
+      );
+
+      size = ((Number) RexLiteral.value(sizeArg)).intValue();
+    }
+
+    // check if scale is provided
+    int scale = CompressedBigDecimalAggregatorFactory.DEFAULT_SCALE;
+
+    if (aggregateCall.getArgList().size() >= 3) {
+      RexNode scaleArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(2)
+      );
+
+      scale = ((Number) RexLiteral.value(scaleArg)).intValue();
+    }
+
+    boolean useStrictNumberParsing = CompressedBigDecimalAggregatorFactory.DEFAULT_STRICT_NUMBER_PARSING;

Review Comment:
   Given that this is maintaining the same semantics as whatever the aggregator factory does for the strict parsing, I think it should be fine to treat it as a `Boolean` and pass in `null`.



##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalAggregatorFactory.java:
##########
@@ -57,6 +60,7 @@
   private final String fieldName;
   private final int size;
   private final int scale;
+  private final boolean strictNumberParsing;

Review Comment:
   You need to add a getter with `@JsonProperty` on it for this to be serialized out and down to the other nodes in the system.



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rash67 commented on pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
rash67 commented on PR #13102:
URL: https://github.com/apache/druid/pull/13102#issuecomment-1249795888

   ugh, this should be stacked on https://github.com/apache/druid/pull/13086
   ignore first commit
   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rash67 commented on a diff in pull request #13102: Add BIG_SUM SQL function

Posted by GitBox <gi...@apache.org>.
rash67 commented on code in PR #13102:
URL: https://github.com/apache/druid/pull/13102#discussion_r975835227


##########
extensions-contrib/compressed-bigdecimal/src/main/java/org/apache/druid/compressedbigdecimal/CompressedBigDecimalSqlAggregator.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.compressedbigdecimal;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.calcite.rel.core.AggregateCall;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.SqlAggFunction;
+import org.apache.calcite.sql.SqlFunctionCategory;
+import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.type.SqlTypeFamily;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.util.Optionality;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.segment.column.ColumnType;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.sql.calcite.aggregation.Aggregation;
+import org.apache.druid.sql.calcite.aggregation.SqlAggregator;
+import org.apache.druid.sql.calcite.expression.DruidExpression;
+import org.apache.druid.sql.calcite.expression.Expressions;
+import org.apache.druid.sql.calcite.planner.PlannerContext;
+import org.apache.druid.sql.calcite.rel.VirtualColumnRegistry;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+public class CompressedBigDecimalSqlAggregator implements SqlAggregator
+{
+  private static final SqlAggFunction FUNCTION_INSTANCE = new CompressedBigDecimalSqlAggFunction();
+  private static final String NAME = "BIG_SUM";
+
+  @Override
+  public SqlAggFunction calciteFunction()
+  {
+    return FUNCTION_INSTANCE;
+  }
+
+  @Nullable
+  @Override
+  public Aggregation toDruidAggregation(
+      PlannerContext plannerContext,
+      RowSignature rowSignature,
+      VirtualColumnRegistry virtualColumnRegistry,
+      RexBuilder rexBuilder,
+      String name,
+      AggregateCall aggregateCall,
+      Project project,
+      List<Aggregation> existingAggregations,
+      boolean finalizeAggregations
+  )
+  {
+    if (aggregateCall.getArgList().size() < 1) {
+      return null;
+    }
+
+    // fetch sum column expression
+    DruidExpression sumColumn = Expressions.toDruidExpression(
+        plannerContext,
+        rowSignature,
+        Expressions.fromFieldAccess(
+            rowSignature,
+            project,
+            aggregateCall.getArgList().get(0)
+        )
+    );
+
+    if (sumColumn == null) {
+      return null;
+    }
+
+    String sumColumnName;
+
+    if (sumColumn.isDirectColumnAccess()) {
+      sumColumnName = sumColumn.getDirectColumn();
+    } else {
+      sumColumnName =
+          virtualColumnRegistry.getOrCreateVirtualColumnForExpression(sumColumn, ColumnType.UNKNOWN_COMPLEX);
+    }
+
+    // check if size is provided
+    int size = CompressedBigDecimalAggregatorFactory.DEFAULT_SIZE;
+
+    if (aggregateCall.getArgList().size() >= 2) {
+      RexNode sizeArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(1)
+      );
+
+      size = ((Number) RexLiteral.value(sizeArg)).intValue();
+    }
+
+    // check if scale is provided
+    int scale = CompressedBigDecimalAggregatorFactory.DEFAULT_SCALE;
+
+    if (aggregateCall.getArgList().size() >= 3) {
+      RexNode scaleArg = Expressions.fromFieldAccess(
+          rowSignature,
+          project,
+          aggregateCall.getArgList().get(2)
+      );
+
+      scale = ((Number) RexLiteral.value(scaleArg)).intValue();
+    }
+
+    boolean useStrictNumberParsing = CompressedBigDecimalAggregatorFactory.DEFAULT_STRICT_NUMBER_PARSING;

Review Comment:
   as noted above, should this be consistent for size and scale? they are both Nullable and have defaults in the constructor
   
   thoughts?



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org