Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/codeql-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: |
set -euo pipefail
./mvnw -B \
-pl hazelcast,hazelcast-build-utils,hazelcast-sql,extensions/cdc-debezium \
-pl hazelcast,hazelcast-build-utils,hazelcast-sql,extensions/cdc-debezium,extensions/mongodb \
-am \
-DskipTests \
-Dcheckstyle.skip=true \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security-release-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
core_tests='com.hazelcast.aws.AwsMetadataApiTest,com.hazelcast.azure.TagTest,com.hazelcast.config.XmlSchemaSourceSecurityTest,com.hazelcast.console.ConsoleAppTest,com.hazelcast.core.server.HazelcastMemberStarterTest,com.hazelcast.dataconnection.impl.JdbcDataConnectionTest,com.hazelcast.dataconnection.impl.JdbcUrlPolicyTest,com.hazelcast.dataconnection.impl.hazelcastdataconnection.HazelcastDataConnectionConfigLoaderTest,com.hazelcast.dataconnection.impl.jdbcproperties.HikariTranslatorTest,com.hazelcast.flakeidgen.impl.FlakeIdGeneratorProxyTest,com.hazelcast.gcp.LabelTest,com.hazelcast.gcp.UtilsTest,com.hazelcast.internal.config.ConfigLoaderSecurityTest,com.hazelcast.internal.diagnostics.DiagnosticsLogFileTest,com.hazelcast.internal.serialization.impl.ByteArrayObjectDataIntegrationTest,com.hazelcast.internal.serialization.impl.ObjectDataInputStreamIntegrationTest,com.hazelcast.internal.serialization.impl.UnsafeObjectDataInputIntegrationTest,com.hazelcast.internal.util.ClockTest,com.hazelcast.internal.util.HashUtilTest,com.hazelcast.internal.util.SecureFileAccessTest,com.hazelcast.internal.util.collection.LongHashSetTest,com.hazelcast.internal.util.concurrent.BackoffIdleStrategyTest,com.hazelcast.internal.util.phonehome.PhoneHomeDifferentConfigTest,com.hazelcast.internal.util.phonehome.PhoneHomeIntegrationTest,com.hazelcast.internal.util.XmlUtilTest,com.hazelcast.jet.impl.submitjob.memberside.JobUploadStatusTest,com.hazelcast.jet.impl.submitjob.memberside.validator.JarOnClientValidatorTest,com.hazelcast.jet.retry.impl.IntervalFunctionTest,com.hazelcast.kubernetes.KubernetesApiOriginPolicyTest,com.hazelcast.kubernetes.KubernetesConfigTest,com.hazelcast.spi.discovery.multicast.MulticastDiscoveryStrategyTest,com.hazelcast.spi.utils.RestClientTest,com.hazelcast.spi.utils.RetryUtilsTest'
all_tests="$core_tests,com.hazelcast.jet.sql.impl.parse.QueryParserTest,com.hazelcast.buildutils.ExportPackageViewerTest,com.hazelcast.jet.cdc.OperationTest"
timeout --signal=TERM --kill-after=30s 30m ./mvnw -B \
-pl hazelcast,hazelcast-sql,hazelcast-build-utils,extensions/cdc-debezium \
-pl hazelcast,hazelcast-sql,hazelcast-build-utils,extensions/cdc-debezium,extensions/mongodb \
-am \
-Dcheckstyle.skip=true \
-Dsurefire.failIfNoSpecifiedTests=false \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
import org.apache.calcite.rex.RexDynamicParam;
import org.apache.calcite.rex.RexFieldAccess;
import org.apache.calcite.rex.RexInputRef;
import org.apache.calcite.rex.RexLambda;
import org.apache.calcite.rex.RexLambdaRef;
import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.rex.RexLocalRef;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexNodeAndFieldIndex;
import org.apache.calcite.rex.RexOver;
import org.apache.calcite.rex.RexPatternFieldRef;
import org.apache.calcite.rex.RexRangeRef;
Expand Down Expand Up @@ -124,4 +127,19 @@ public Expression<?> visitTableInputRef(RexTableInputRef fieldRef) {
public Expression<?> visitPatternFieldRef(RexPatternFieldRef fieldRef) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitLambda(RexLambda lambda) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitLambdaRef(RexLambdaRef lambdaRef) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitNodeAndFieldIndex(RexNodeAndFieldIndex nodeAndFieldIndex) {
throw new UnsupportedOperationException();
}
}
13 changes: 12 additions & 1 deletion hazelcast-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<!-- Aircompressor 3.x targets JDK 25; keep the patched Java 8/17-compatible 2.x line. -->
<aircompressor.version>2.0.3</aircompressor.version>
<aws.sdk2.version>2.42.39</aws.sdk2.version>
<calcite.version>1.35.0</calcite.version>
<calcite.version>1.42.0</calcite.version>
<!--
Calcite 1.35 dependency that has CVE
Explicitly upgrade to a version not vulnerable to CVE - https://github.com/advisories/GHSA-gcg6-xv4f-f749
Expand Down Expand Up @@ -516,6 +516,17 @@
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<!-- Keep Calcite 1.42 transitive dependencies converged on their highest resolved versions. -->
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.3.5</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joou-java-6</artifactId>
<version>0.9.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions hazelcast-sql/src/main/codegen/config.fmpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,16 @@ data: {
# Example: "< IDENTIFIER: (<LETTER>|<DIGIT>)+ >".
customIdentifierToken: ""

# Method for parsing "SET [OR RESET]" calls.
setOptionParserMethod: "SqlSetOption"

includePosixOperators: false
includeCompoundIdentifier: true
includeBraces: true
includeAdditionalDeclarations: false
includeParsingStringLiteralAsArrayLiteral: false
includeIntervalWithoutQualifier: false
includeStarExclude: false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public JoinInfo analyzeCondition() {
}
List<Integer> leftKeys = joinInfo.leftKeys.toIntegerList();
List<Integer> rightKeys = joinInfo.rightKeys.toIntegerList();
List<Boolean> nullExclusionFlags = new ArrayList<>(joinInfo.nullExclusionFlags);
HazelcastTable table = OptUtils.extractHazelcastTable(getRight());
RexBuilder rexBuilder = getCluster().getRexBuilder();

Expand All @@ -92,12 +93,14 @@ public RexNode visitInputRef(RexInputRef inputRef) {
rightExpr));
leftKeys.remove(i);
rightKeys.remove(i);
nullExclusionFlags.remove(i);
i--;
}
}

modifiedJoinInfo = new ModifiedJoinInfo(ImmutableIntList.copyOf(leftKeys),
ImmutableIntList.copyOf(rightKeys),
ImmutableList.copyOf(nullExclusionFlags),
ImmutableList.<RexNode>builder()
.addAll(joinInfo.nonEquiConditions)
.addAll(additionalNonEquiConditions).build());
Expand All @@ -123,8 +126,9 @@ public Join copy(

protected static class ModifiedJoinInfo extends JoinInfo {
protected ModifiedJoinInfo(ImmutableIntList leftKeys, ImmutableIntList rightKeys,
ImmutableList<Boolean> nullExclusionFlags,
ImmutableList<RexNode> nonEquiConditions) {
super(leftKeys, rightKeys, nonEquiConditions);
super(leftKeys, rightKeys, nullExclusionFlags, nonEquiConditions);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
import org.apache.calcite.rex.RexDynamicParam;
import org.apache.calcite.rex.RexFieldAccess;
import org.apache.calcite.rex.RexInputRef;
import org.apache.calcite.rex.RexLambda;
import org.apache.calcite.rex.RexLambdaRef;
import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.rex.RexLocalRef;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexNodeAndFieldIndex;
import org.apache.calcite.rex.RexOver;
import org.apache.calcite.rex.RexPatternFieldRef;
import org.apache.calcite.rex.RexRangeRef;
Expand Down Expand Up @@ -139,4 +142,19 @@ public Expression<?> visitTableInputRef(RexTableInputRef fieldRef) {
public Expression<?> visitPatternFieldRef(RexPatternFieldRef fieldRef) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitLambda(RexLambda lambda) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitLambdaRef(RexLambdaRef lambdaRef) {
throw new UnsupportedOperationException();
}

@Override
public Expression<?> visitNodeAndFieldIndex(RexNodeAndFieldIndex nodeAndFieldIndex) {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.hazelcast.sql.impl.schema.Table;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeComparability;
import org.apache.calcite.rel.type.RelDataTypeDigest;
import org.apache.calcite.rel.type.RelDataTypeFamily;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.rel.type.RelDataTypePrecedenceList;
Expand Down Expand Up @@ -362,5 +363,26 @@ public RelDataTypeComparability getComparability() {
public boolean isDynamicStruct() {
return delegate.isDynamicStruct();
}

@Override
public RelDataTypeDigest getDigest() {
return delegate.getDigest();
}

@Override
public boolean deepEquals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof HazelcastFunctionRelDataType) {
obj = ((HazelcastFunctionRelDataType) obj).delegate;
}
return delegate.deepEquals(obj);
}

@Override
public int deepHashCode() {
return delegate.deepHashCode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.hazelcast.jet.sql.impl.schema.HazelcastTable;
import com.hazelcast.jet.sql.impl.validate.HazelcastSqlOperatorTable.RewriteVisitor;
import com.hazelcast.jet.sql.impl.validate.literal.LiteralUtils;
import com.hazelcast.jet.sql.impl.validate.operators.misc.HazelcastCastFunction;
import com.hazelcast.jet.sql.impl.validate.param.AbstractParameterConverter;
import com.hazelcast.jet.sql.impl.validate.types.HazelcastObjectType;
import com.hazelcast.jet.sql.impl.validate.types.HazelcastTypeCoercion;
Expand All @@ -52,7 +51,6 @@
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlDelete;
import org.apache.calcite.sql.SqlDynamicParam;
import org.apache.calcite.sql.SqlFunction;
import org.apache.calcite.sql.SqlIdentifier;
import org.apache.calcite.sql.SqlInsert;
import org.apache.calcite.sql.SqlIntervalLiteral;
Expand Down Expand Up @@ -211,29 +209,6 @@ public void validateInsert(final SqlInsert insert) {
validateUpsertRowType((SqlIdentifier) insert.getTargetTable());
}

@Override
public void validateColumnListParams(
final SqlFunction function,
final List<RelDataType> argTypes,
final List<SqlNode> operands
) {
if (!(function instanceof HazelcastCastFunction)) {
super.validateColumnListParams(function, argTypes, operands);
}

if (argTypes.get(0).getSqlTypeName() != SqlTypeName.COLUMN_LIST) {
throw QueryException.error("Cannot convert " + argTypes.get(0).getSqlTypeName()
+ " to " + argTypes.get(1).getSqlTypeName());
}

final SqlCall call = (SqlCall) operands.get(0);

assert call.getOperator().getKind() == SqlKind.ROW
: "CAST column list argument is not a RowExpression call";

throw QueryException.error("Cannot convert ROW to JSON");
}

private void validateSelect(SqlSelect select, SqlValidatorScope scope) {
// Derive the types for offset-fetch expressions, Calcite doesn't do
// that automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.hazelcast.jet.sql.impl.validate.operators.common.HazelcastFunction;
import com.hazelcast.jet.sql.impl.validate.param.NoOpParameterConverter;
import com.hazelcast.sql.SqlColumnType;
import com.hazelcast.sql.impl.QueryException;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlCallBinding;
Expand All @@ -39,6 +40,7 @@
import org.apache.calcite.sql.type.SqlTypeName;

import static com.hazelcast.jet.sql.impl.validate.types.HazelcastTypeUtils.canCast;
import static com.hazelcast.jet.sql.impl.validate.types.HazelcastTypeUtils.isJsonType;
import static com.hazelcast.jet.sql.impl.validate.types.HazelcastTypeUtils.toHazelcastType;

public final class HazelcastCastFunction extends HazelcastFunction {
Expand Down Expand Up @@ -73,6 +75,13 @@ public boolean checkOperandTypes(HazelcastCallBinding binding, boolean throwOnFa
binding.getValidator().setParameterConverter(sourceParameterIndex, NoOpParameterConverter.INSTANCE);
}

if (sourceType.getSqlTypeName() == SqlTypeName.ROW && isJsonType(targetType)) {
if (throwOnFailure) {
throw QueryException.error("Cannot convert ROW to JSON");
}
return false;
}

if (canCast(sourceType, targetType)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ public final class HazelcastIntegerType extends BasicSqlType {
private final int bitWidth;

private HazelcastIntegerType(SqlTypeName typeName, boolean nullable, int bitWidth) {
super(HazelcastTypeSystem.INSTANCE, typeName);
super(HazelcastTypeSystem.INSTANCE, typeName, nullable);

this.isNullable = nullable;
this.bitWidth = bitWidth;

// recompute the digest to reflect the nullability of the type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public class HazelcastType extends BasicSqlType {
}

HazelcastType(SqlTypeName typeName, boolean nullable, int precision) {
super(HazelcastTypeSystem.INSTANCE, typeName, precision);

this.isNullable = nullable;
super(HazelcastTypeSystem.INSTANCE, typeName, nullable, precision);

computeDigest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ private HazelcastTypeSystem() {
}

@Override
public int getMaxNumericPrecision() {
return MAX_DECIMAL_PRECISION;
public int getMaxPrecision(SqlTypeName typeName) {
return typeName == DECIMAL ? MAX_DECIMAL_PRECISION : super.getMaxPrecision(typeName);
}

@Override
public int getMaxNumericScale() {
return MAX_DECIMAL_SCALE;
public int getMaxScale(SqlTypeName typeName) {
return typeName == DECIMAL ? MAX_DECIMAL_SCALE : super.getMaxScale(typeName);
}

@Override
Expand Down
Loading