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

[DRAFT] Update Calcite to 1.38 #2961

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions common/src/main/java/org/apache/drill/common/types/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@
*/
package org.apache.drill.common.types;

import static org.apache.drill.common.types.TypeProtos.DataMode.REPEATED;
import com.google.protobuf.TextFormat;
import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.common.types.TypeProtos.MinorType;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.apache.drill.common.exceptions.DrillRuntimeException;
import org.apache.drill.common.types.TypeProtos.DataMode;
import org.apache.drill.common.types.TypeProtos.MajorType;
import org.apache.drill.common.types.TypeProtos.MinorType;

import com.google.protobuf.TextFormat;
import static org.apache.drill.common.types.TypeProtos.DataMode.REPEATED;

public class Types {
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Types.class);
Expand Down Expand Up @@ -936,11 +935,10 @@ public static int maxPrecision(MinorType type) {
return 28;
case DECIMAL38DENSE:
case DECIMAL38SPARSE:
case VARDECIMAL:
return 38;
case DECIMAL9:
return 9;
case VARDECIMAL:
return 38;
default:
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ private static AggregateCall getAggCall(AggregateCall oldCall,
oldCall.isDistinct(),
oldCall.isApproximate(),
oldCall.ignoreNulls(),
oldCall.rexList,
oldCall.getArgList(),
oldCall.filterArg,
oldCall.distinctKeys,
Expand Down Expand Up @@ -541,6 +542,7 @@ private RexNode reduceStddev(
oldCall.isDistinct(),
oldCall.isApproximate(),
oldCall.ignoreNulls(),
oldCall.rexList,
ImmutableIntList.of(argSquaredOrdinal),
oldCall.filterArg,
oldCall.distinctKeys,
Expand All @@ -562,6 +564,7 @@ private RexNode reduceStddev(
oldCall.isDistinct(),
oldCall.isApproximate(),
oldCall.ignoreNulls(),
oldCall.rexList,
ImmutableIntList.of(argOrdinal),
oldCall.filterArg,
oldCall.distinctKeys,
Expand Down Expand Up @@ -739,6 +742,7 @@ public void onMatch(RelOptRuleCall call) {
oldAggregateCall.isDistinct(),
oldAggregateCall.isApproximate(),
oldAggregateCall.ignoreNulls(),
oldAggregateCall.rexList,
oldAggregateCall.getArgList(),
oldAggregateCall.filterArg,
oldAggregateCall.distinctKeys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.planner.physical;

import com.google.common.collect.ImmutableList;
import org.apache.drill.common.expression.IfExpression;
import org.apache.drill.common.expression.NullExpression;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -179,6 +180,7 @@ protected void createKeysAndExprs() {
aggCall.e.isDistinct(),
aggCall.e.isApproximate(),
false,
ImmutableList.of(),
Collections.singletonList(aggExprOrdinal),
aggCall.e.filterArg,
null,
Expand All @@ -194,6 +196,7 @@ protected void createKeysAndExprs() {
aggCall.e.isDistinct(),
aggCall.e.isApproximate(),
false,
ImmutableList.of(),
Collections.singletonList(aggExprOrdinal),
aggCall.e.filterArg,
null,
Expand Down Expand Up @@ -270,6 +273,7 @@ public Prel prepareForLateralUnnestPipeline(List<RelNode> children) {
aggCall.isDistinct(),
aggCall.isApproximate(),
false,
ImmutableList.of(),
arglist,
aggCall.filterArg,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package org.apache.drill.exec.planner.sql.conversion;

import java.math.BigDecimal;

import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.rex.RexBuilder;
Expand All @@ -30,6 +28,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

class DrillRexBuilder extends RexBuilder {

private static final Logger logger = LoggerFactory.getLogger(DrillRexBuilder.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void testWideningLimit() throws Exception {
// A union of VARDECIMALs that requires a widening to an unsupported
// DECIMAL(40, 6). The resulting column should be limited DECIMAL(38, 6)
// and a precision loss warning logged.
String query = "SELECT CAST(10 AS DECIMAL(38, 4)) AS `Col1` " +
String query = "SELECT CAST('10' AS DECIMAL(38, 4)) AS `Col1` " +
"UNION ALL " +
"SELECT CAST(22 AS DECIMAL(29, 6)) AS `Col1`";

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<bouncycastle.version>1.78.1</bouncycastle.version>
<caffeine.version>2.9.3</caffeine.version>
<calcite.groupId>org.apache.calcite</calcite.groupId>
<calcite.version>1.34.0</calcite.version>
<calcite.version>1.35.0</calcite.version>
<codemodel.version>2.6</codemodel.version>
<commons.beanutils.version>1.9.4</commons.beanutils.version>
<commons.cli.version>1.4</commons.cli.version>
Expand Down
Loading