This is an automated email from the ASF dual-hosted git repository.
jooger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 9137608449 IGNITE-21243 Bump calcite version to 1.37 (#3878)
9137608449 is described below
commit 913760844952baddc49d545ec7f2aac95bd7874f
Author: ygerzhedovich <[email protected]>
AuthorDate: Tue Jun 11 14:02:25 2024 +0300
IGNITE-21243 Bump calcite version to 1.37 (#3878)
---
gradle/libs.versions.toml | 4 +-
modules/sql-engine/build.gradle | 1 -
.../ignite/internal/sql/engine/ItDmlTest.java | 3 +-
.../internal/sql/engine/ItFunctionsTest.java | 19 +++--
.../ignite/internal/sql/engine/ItIntervalTest.java | 7 +-
.../sql/types/decimal/cast_from_decimal.test | 2 +-
.../sql/types/decimal/cast_to_decimal.test | 2 +-
.../src/main/codegen/includes/parserImpls.ftl | 7 +-
.../sql/engine/exec/exp/IgniteSqlFunctions.java | 98 ----------------------
.../internal/sql/engine/exec/exp/RexImpTable.java | 3 +-
.../sql/engine/exec/exp/RexToLixTranslator.java | 16 +++-
.../sql/engine/sql/fun/IgniteSqlOperatorTable.java | 22 +----
.../internal/sql/engine/util/IgniteMethod.java | 4 -
.../planner/AbstractAggregatePlannerTest.java | 12 +--
.../sql/engine/planner/CastResolutionTest.java | 4 +-
.../sql/engine/sql/DecimalLiteralTest.java | 5 +-
16 files changed, 51 insertions(+), 158 deletions(-)
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 77fb022c8b..6c76386761 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -56,10 +56,9 @@ hamcrestOptional = "2.0.0"
hamcrestPath = "1.0.1"
hamcrestJson = "0.3"
scalecube = "2.6.15"
-calcite = "1.36.0"
+calcite = "1.37.0"
value = "2.10.1"
janino = "3.1.12"
-avatica = "1.25.0"
jsonpath = "2.9.0"
javassist = "3.30.2-GA"
rocksdb = "9.2.1"
@@ -243,7 +242,6 @@ caffeine = { module =
"com.github.ben-manes.caffeine:caffeine", version.ref = "c
calcite-core = { module = "org.apache.calcite:calcite-core", version.ref =
"calcite" }
calcite-linq4j = { module = "org.apache.calcite:calcite-linq4j", version.ref =
"calcite" }
-calcite-avatica = { module = "org.apache.calcite.avatica:avatica-core",
version.ref = "avatica" }
fmpp = { module = "net.sourceforge.fmpp:fmpp", version.ref = "fmpp" }
value-annotations = { module = "org.immutables:value-annotations", version.ref
= "value" }
diff --git a/modules/sql-engine/build.gradle b/modules/sql-engine/build.gradle
index b24dbd327d..6f732b96cc 100644
--- a/modules/sql-engine/build.gradle
+++ b/modules/sql-engine/build.gradle
@@ -57,7 +57,6 @@ dependencies {
implementation libs.value.annotations
implementation libs.janino.compiler
implementation libs.janino.core
- implementation libs.calcite.avatica
implementation libs.jackson.core
implementation libs.jackson.databind
implementation libs.jackson.annotations
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
index 4dbf36a2e3..a9f3d73d69 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
@@ -549,8 +549,7 @@ public class ItDmlTest extends BaseSqlIntegrationTest {
public void testInsertDefaultNullValue() {
checkDefaultValue(defaultValueArgs()
.filter(a -> !a.sqlType.endsWith("NOT NULL"))
- // TODO: uncomment after
https://issues.apache.org/jira/browse/IGNITE-21243
- // .map(a -> new DefaultValueArg(a.sqlType, "NULL", null))
+ .map(a -> new DefaultValueArg(a.sqlType, "NULL", null))
.collect(Collectors.toList()));
}
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java
index 8657456186..c4486d51ce 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java
@@ -381,10 +381,19 @@ public class ItFunctionsTest extends
BaseSqlIntegrationTest {
assertQuery("SELECT SUBSTRING(s from i for l) from (values ('abc',
null, 2)) as t (s, i, l);").returns(null).check();
- assertQuery("SELECT SUBSTRING('1234567', 2.1,
3.1);").returns("234").check();
- assertQuery("SELECT SUBSTRING('1234567', 2.1,
3);").returns("234").check();
- assertQuery("SELECT SUBSTRING('1234567', 2,
3.1);").returns("234").check();
- assertQuery("SELECT SUBSTRING('1234567',
2.1);").returns("234567").check();
+ assertThrowsSqlException(Sql.STMT_VALIDATION_ERR,
+ "Cannot apply 'SUBSTRING' to arguments of type
'SUBSTRING(<CHAR(7)> FROM <DECIMAL(2, 1)> FOR <DECIMAL(2, 1)>)'",
+ () -> sql("SELECT SUBSTRING('1234567', 2.1, 3.1)"));
+ assertThrowsSqlException(Sql.STMT_VALIDATION_ERR,
+ "Cannot apply 'SUBSTRING' to arguments of type
'SUBSTRING(<CHAR(7)> FROM <DECIMAL(2, 1)> FOR <INTEGER>)'",
+ () -> sql("SELECT SUBSTRING('1234567', 2.1, 3)"));
+ assertThrowsSqlException(Sql.STMT_VALIDATION_ERR,
+ "Cannot apply 'SUBSTRING' to arguments of type
'SUBSTRING(<CHAR(7)> FROM <INTEGER> FOR <DECIMAL(2, 1)>)'",
+ () -> sql("SELECT SUBSTRING('1234567', 2, 3.1)"));
+ // Uncomment after IGNITE-22417
+ // assertThrowsSqlException(Sql.STMT_VALIDATION_ERR,
+ // "Cannot apply 'SUBSTRING' to arguments of type
'SUBSTRING(<CHAR(7)> FROM <DECIMAL(2, 1)>)'",
+ // () -> sql("SELECT SUBSTRING('1234567', 2.1)"));
// type coercion
assertQuery("SELECT SUBSTRING('1234567', 2,
'1');").returns("2").check();
@@ -395,8 +404,6 @@ public class ItFunctionsTest extends BaseSqlIntegrationTest
{
assertQuery(String.format("SELECT SUBSTRING('1234567', %d::BIGINT)",
1)).returns("1234567").check();
assertQuery(String.format("SELECT SUBSTRING('1234567', %d)",
Long.MIN_VALUE)).returns("1234567").check();
assertQuery(String.format("SELECT SUBSTRING('1234567', %d)",
Integer.MIN_VALUE)).returns("1234567").check();
- assertQuery(String.format("SELECT SUBSTRING('1234567', %d, %d)",
Integer.MIN_VALUE, 10L + Integer.MAX_VALUE))
- .returns("1234567").check();
assertQuery(String.format("SELECT SUBSTRING('1234567', %d, %d)", -1,
5)).returns("123").check();
assertThrowsSqlException(Sql.RUNTIME_ERR, "negative substring length",
() -> sql("SELECT SUBSTRING('1234567', 1, -1)"));
diff --git
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIntervalTest.java
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIntervalTest.java
index 100f84a9f4..be97bdeae0 100644
---
a/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIntervalTest.java
+++
b/modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItIntervalTest.java
@@ -82,7 +82,10 @@ public class ItIntervalTest extends BaseSqlIntegrationTest {
assertEquals(Duration.ofSeconds(3723), eval("INTERVAL '1:2:3' HOUR TO
SECOND"));
assertEquals(Duration.ofMillis(3723456), eval("INTERVAL '0 1:2:3.456'
DAY TO SECOND"));
- assertThrowsEx("SELECT INTERVAL '123' SECONDS", IgniteException.class,
"exceeds precision");
+ assertEquals(Duration.ofSeconds(123), eval("INTERVAL '123' SECONDS"));
+ assertEquals(Duration.ofMillis(123987), eval("INTERVAL '123.987'
SECONDS"));
+ // TODO: uncomment after IGNITE-19162
+ // assertEquals(Duration.ofMillis(123987654), eval("INTERVAL
'123.987654' SECONDS"));
// Interval range overflow
assertThrowsSqlException(Sql.RUNTIME_ERR, "INTEGER out of range", ()
-> sql("SELECT INTERVAL 5000000 MONTHS * 1000"));
@@ -419,8 +422,8 @@ public class ItIntervalTest extends BaseSqlIntegrationTest {
assertEquals(-3L, eval("EXTRACT(MINUTE FROM INTERVAL '-1 2:3:4.567'
DAY TO SECOND)"));
assertEquals(-4L, eval("EXTRACT(SECOND FROM INTERVAL '-1 2:3:4.567'
DAY TO SECOND)"));
assertEquals(-4567L, eval("EXTRACT(MILLISECOND FROM INTERVAL '-1
2:3:4.567' DAY TO SECOND)"));
+ assertEquals(0L, eval("EXTRACT(DAY FROM INTERVAL 1 MONTH)"));
- assertThrowsEx("SELECT EXTRACT(DAY FROM INTERVAL 1 MONTH)",
IgniteException.class, "Cannot apply");
assertThrowsEx("SELECT EXTRACT(MONTH FROM INTERVAL 1 DAY)",
IgniteException.class, "Cannot apply");
}
diff --git
a/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_from_decimal.test
b/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_from_decimal.test
index 766520cb94..0a11413c11 100644
---
a/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_from_decimal.test
+++
b/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_from_decimal.test
@@ -95,7 +95,7 @@ SELECT 14751947891758972421513::DECIMAL(38,0)::BIGINT
query IIIII
SELECT 127::DECIMAL(3,0)::FLOAT,
-17014118346046923173168730371588410572::DECIMAL(38,0)::FLOAT,
-7::DECIMAL(9,1)::FLOAT, 27::DECIMAL(18,1)::FLOAT, 33::DECIMAL(38,1)::FLOAT
----
-127 -1.701412E37 -7 27 33
+127 -1.7014119E37 -7 27 33
# double
query IIIII
diff --git
a/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_to_decimal.test
b/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_to_decimal.test
index 4758fb3353..3f32af9f71 100644
---
a/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_to_decimal.test
+++
b/modules/sql-engine/src/integrationTest/sql/types/decimal/cast_to_decimal.test
@@ -139,7 +139,7 @@ SELECT 100::FLOAT::DECIMAL(18,3), 100::FLOAT::DECIMAL(3,0),
(-100)::FLOAT::DECIM
query RRRR
SELECT 100::FLOAT::DECIMAL(38,35)::FLOAT, 100::FLOAT::DECIMAL(9,6)::FLOAT,
17014118346046923173168730371588410572::FLOAT::DECIMAL(38,0)::FLOAT,
(-17014118346046923173168730371588410572)::FLOAT::DECIMAL(38,0)::FLOAT
----
-100 100 1.701412E37 -1.701412E37
+100 100 1.7014119E37 -1.7014119E37
query I
SELECT 1.25::FLOAT::DECIMAL(3,2)
diff --git a/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
b/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
index a859029f3a..7370d10c1e 100644
--- a/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
+++ b/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
@@ -660,13 +660,8 @@ SqlTypeNameSpec IgniteDateTimeTypeName() :
|
<TIMESTAMP> { s = span(); }
precision = PrecisionOpt()
- withLocalTimeZone = TimeZoneOpt()
+ typeName = TimeZoneOpt(false)
{
- if (withLocalTimeZone) {
- typeName = SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE;
- } else {
- typeName = SqlTypeName.TIMESTAMP;
- }
return new SqlBasicTypeNameSpec(typeName, precision, s.end(this));
}
}
diff --git
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java
index 313b7a275d..1b32ca19e0 100644
---
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java
+++
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java
@@ -17,8 +17,6 @@
package org.apache.ignite.internal.sql.engine.exec.exp;
-import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE;
-import static java.time.format.DateTimeFormatter.ISO_LOCAL_TIME;
import static org.apache.calcite.runtime.SqlFunctions.charLength;
import static
org.apache.ignite.internal.sql.engine.prepare.IgniteSqlValidator.NUMERIC_FIELD_OVERFLOW_ERROR;
import static org.apache.ignite.lang.ErrorGroups.Sql.RUNTIME_ERR;
@@ -27,11 +25,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.math.RoundingMode;
-import java.time.LocalDateTime;
import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeFormatterBuilder;
-import java.time.format.ResolverStyle;
import java.util.TimeZone;
import java.util.UUID;
import org.apache.calcite.DataContext;
@@ -52,21 +46,8 @@ import org.jetbrains.annotations.Nullable;
* Ignite SQL functions.
*/
public class IgniteSqlFunctions {
- private static final DateTimeFormatter ISO_LOCAL_DATE_TIME_EX;
private static final RoundingMode roundingMode = RoundingMode.HALF_UP;
- private static final BigDecimal MAX_INT = new
BigDecimal(Integer.MAX_VALUE);
- private static final BigDecimal MIN_INT = new
BigDecimal(Integer.MIN_VALUE);
-
- static {
- ISO_LOCAL_DATE_TIME_EX = new DateTimeFormatterBuilder()
- .parseCaseInsensitive()
- .append(ISO_LOCAL_DATE)
- .appendLiteral(' ')
- .append(ISO_LOCAL_TIME)
- .toFormatter();
- }
-
/**
* Default constructor.
*/
@@ -74,21 +55,6 @@ public class IgniteSqlFunctions {
// No-op.
}
- /** Just a stub. Validates Date\Time literal, still use calcite
implementation for numeric representation.
- * Otherwise need to fix {@code DateTimeUtils#unixTimestampToString} usage
additionally.
- */
- public static long timestampStringToNumeric(String dtStr) {
- dtStr = dtStr.trim();
- // "YYYY-MM-dd HH:mm:ss.ninenanos"
- if (dtStr.length() > 29) {
- dtStr = dtStr.substring(0, 29);
- }
-
- LocalDateTime.parse(dtStr,
ISO_LOCAL_DATE_TIME_EX.withResolverStyle(ResolverStyle.STRICT));
-
- return DateTimeUtils.timestampStringToUnixDate(dtStr);
- }
-
/** CAST(DECIMAL AS VARCHAR). */
public static String toString(BigDecimal x) {
return x == null ? null : x.toPlainString();
@@ -207,70 +173,6 @@ public class IgniteSqlFunctions {
return roundedValue.setScale(originalScale, RoundingMode.UNNECESSARY);
}
- /** Returns {@link Integer} bounded value. */
- private static int normalizeRegardingInt(BigDecimal num) {
- int res;
-
- if (num.compareTo(MAX_INT) >= 0) {
- res = Integer.MAX_VALUE;
- } else if (num.compareTo(MIN_INT) <= 0) {
- res = Integer.MIN_VALUE;
- } else {
- res = num.intValue();
- }
-
- return res;
- }
-
- /** SQL SUBSTRING(string FROM ...) function. */
- public static String substring(String c, int s) {
- if (s <= 1) {
- return c;
- }
-
- return SqlFunctions.substring(c, s);
- }
-
- /** SQL SUBSTRING(string FROM ...) function. */
- public static String substring(String c, BigDecimal s) {
- if (s.compareTo(BigDecimal.ONE) <= 0) {
- return c;
- }
-
- int s0 = normalizeRegardingInt(s);
- return SqlFunctions.substring(c, s0);
- }
-
- /** SQL SUBSTRING(string FROM ...) function. */
- public static String substring(String c, int s, int l) {
- return SqlFunctions.substring(c, s, l);
- }
-
- /** SQL SUBSTRING(string FROM ...) function. */
- public static String substring(String c, int s, BigDecimal l) {
- if (s < 0) {
- if (l.signum() > 0) {
- l = l.add(BigDecimal.valueOf(s));
- return substring(c, 0, l);
- }
- }
- int l0 = normalizeRegardingInt(l);
- return SqlFunctions.substring(c, s, l0);
- }
-
- /** SQL SUBSTRING(string FROM ...) function. */
- public static String substring(String c, BigDecimal s, BigDecimal l) {
- if (s.signum() < 0) {
- if (l.signum() > 0) {
- l = l.add(s);
- return substring(c, 0, l);
- }
- }
- int s0 = normalizeRegardingInt(s);
- int l0 = normalizeRegardingInt(l);
- return SqlFunctions.substring(c, s0, l0);
- }
-
// TRUNCATE function
/** SQL {@code TRUNCATE} operator applied to byte values. */
diff --git
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java
index 185cf95be0..ad47a99e78 100644
---
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java
+++
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexImpTable.java
@@ -318,6 +318,7 @@ import static
org.apache.calcite.sql.fun.SqlStdOperatorTable.SLICE;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SOME;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.STRUCT_ACCESS;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBMULTISET_OF;
+import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBSTRING;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM0;
import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SYSTEM_USER;
@@ -505,6 +506,7 @@ public class RexImpTable {
defineMethod(SHA1, BuiltInMethod.SHA1.method, NullPolicy.STRICT);
defineMethod(SHA256, BuiltInMethod.SHA256.method, NullPolicy.STRICT);
defineMethod(SHA512, BuiltInMethod.SHA512.method, NullPolicy.STRICT);
+ defineMethod(SUBSTRING, BuiltInMethod.SUBSTRING.method,
NullPolicy.STRICT);
defineMethod(LEFT, BuiltInMethod.LEFT.method, NullPolicy.ANY);
defineMethod(RIGHT, BuiltInMethod.RIGHT.method, NullPolicy.ANY);
defineMethod(LPAD, BuiltInMethod.LPAD.method, NullPolicy.STRICT);
@@ -1014,7 +1016,6 @@ public class RexImpTable {
defineMethod(SUBSTR, IgniteMethod.SUBSTR.method(), NullPolicy.STRICT);
defineMethod(ROUND, IgniteMethod.ROUND.method(), NullPolicy.STRICT);
defineMethod(TRUNCATE, IgniteMethod.TRUNCATE.method(),
NullPolicy.STRICT);
- defineMethod(IgniteSqlOperatorTable.SUBSTRING,
IgniteMethod.SUBSTRING.method(), NullPolicy.STRICT);
defineMethod(IgniteSqlOperatorTable.DECIMAL_DIVIDE,
IgniteMethod.DECIMAL_DIVIDE.method(), NullPolicy.ARG0);
map.put(TYPEOF, systemFunctionImplementor);
diff --git
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java
index 30e8ae436e..9dab3002b5 100644
---
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java
+++
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java
@@ -66,6 +66,8 @@ import org.apache.calcite.rex.RexCorrelVariable;
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;
@@ -356,7 +358,7 @@ public class RexToLixTranslator implements
RexVisitor<RexToLixTranslator.Result>
case CHAR:
case VARCHAR:
convert =
-
Expressions.call(IgniteMethod.STRING_TO_TIMESTAMP.method(), operand);
+
Expressions.call(BuiltInMethod.STRING_TO_TIMESTAMP.method, operand);
break;
case DATE:
convert =
@@ -403,7 +405,7 @@ public class RexToLixTranslator implements
RexVisitor<RexToLixTranslator.Result>
// Since this type implies a local timezone, its
explicit indication seems redundant,
// so we prohibit the user from explicitly setting a
timezone.
convert =
-
Expressions.call(IgniteMethod.STRING_TO_TIMESTAMP.method(), operand);
+
Expressions.call(BuiltInMethod.STRING_TO_TIMESTAMP.method, operand);
break;
case DATE:
convert =
@@ -1531,6 +1533,16 @@ public class RexToLixTranslator implements
RexVisitor<RexToLixTranslator.Result>
return visitInputRef(fieldRef);
}
+ @Override
+ public Result visitLambda(RexLambda lambda) {
+ throw new RuntimeException("cannot translate expression " + lambda);
+ }
+
+ @Override
+ public Result visitLambdaRef(RexLambdaRef lambdaRef) {
+ throw new RuntimeException("cannot translate expression " + lambdaRef);
+ }
+
Expression checkNull(Expression expr) {
if (Primitive.flavor(expr.getType())
== Primitive.Flavor.PRIMITIVE) {
diff --git
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java
index 5556873c2b..c6bf7b562e 100644
---
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java
+++
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.sql.engine.sql.fun;
-import com.google.common.collect.ImmutableList;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.sql.SqlBasicFunction;
@@ -32,8 +31,6 @@ import org.apache.calcite.sql.fun.SqlSubstringFunction;
import org.apache.calcite.sql.type.OperandTypes;
import org.apache.calcite.sql.type.ReturnTypes;
import org.apache.calcite.sql.type.SqlReturnTypeInference;
-import org.apache.calcite.sql.type.SqlSingleOperandTypeChecker;
-import org.apache.calcite.sql.type.SqlTypeFamily;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.type.SqlTypeTransforms;
import org.apache.calcite.sql.util.ReflectiveSqlOperatorTable;
@@ -109,23 +106,6 @@ public class IgniteSqlOperatorTable extends
ReflectiveSqlOperatorTable {
OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER,
SqlFunctionCategory.STRING);
- private static final SqlSingleOperandTypeChecker
STRING_NUMERIC_OPTIONAL_NUMERIC =
- OperandTypes.family(
- ImmutableList.of(SqlTypeFamily.STRING,
SqlTypeFamily.NUMERIC,
- SqlTypeFamily.NUMERIC), i -> i == 2);
-
- public static final SqlFunction SUBSTRING =
- new SqlFunction(
- "SUBSTRING",
- SqlKind.OTHER_FUNCTION,
- ReturnTypes.ARG0_NULLABLE_VARYING,
- null,
- OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER
- .or(STRING_NUMERIC_OPTIONAL_NUMERIC)
- .or(OperandTypes.STRING_INTEGER)
- .or(OperandTypes.STRING_NUMERIC),
- SqlFunctionCategory.STRING);
-
/**
* The {@code RAND_UUID()} function, which yields a random UUID.
*/
@@ -279,7 +259,7 @@ public class IgniteSqlOperatorTable extends
ReflectiveSqlOperatorTable {
register(SqlLibraryOperators.FROM_BASE64);
register(SqlLibraryOperators.MD5);
register(SqlLibraryOperators.SHA1);
- register(SUBSTRING);
+ register(SqlStdOperatorTable.SUBSTRING);
register(SqlLibraryOperators.LEFT);
register(SqlLibraryOperators.RIGHT);
register(SqlStdOperatorTable.REPLACE);
diff --git
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java
index 01b6a69539..8605a54231 100644
---
a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java
+++
b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteMethod.java
@@ -68,8 +68,6 @@ public enum IgniteMethod {
/** See {@link BiScalar#execute(ExecutionContext, Object, Object,
RowBuilder)}. */
BI_SCALAR_EXECUTE(BiScalar.class, "execute", ExecutionContext.class,
Object.class, Object.class, RowBuilder.class),
- STRING_TO_TIMESTAMP(IgniteSqlFunctions.class, "timestampStringToNumeric",
String.class),
-
/** See {@link IgniteSqlFunctions#subtractTimeZoneOffset(long, TimeZone)}.
**/
SUBTRACT_TIMEZONE_OFFSET(IgniteSqlFunctions.class,
"subtractTimeZoneOffset", long.class, TimeZone.class),
@@ -118,8 +116,6 @@ public enum IgniteMethod {
*/
TRUNCATE(IgniteSqlFunctions.class, "struncate", true),
- SUBSTRING(IgniteSqlFunctions.class, "substring", true),
-
/**
* Division operator used by REDUCE phase of AVG aggregate.
* See {@link IgniteSqlFunctions#decimalDivide(BigDecimal, BigDecimal,
int, int)}.
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractAggregatePlannerTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractAggregatePlannerTest.java
index c8ac94287d..46fd8f68ab 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractAggregatePlannerTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/AbstractAggregatePlannerTest.java
@@ -647,23 +647,23 @@ public abstract class AbstractAggregatePlannerTest
extends AbstractPlannerTest {
*/
CASE_16B("SELECT ID FROM test WHERE VAL0 IN (SELECT VAL0 FROM test)",
schema(identity(), indexByVal0Desc())),
/**
- * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1)
FROM test.
+ * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2)
FROM test.
*
* <p>Distribution single
*/
- CASE_17("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1) FROM
test", schema(single())),
+ CASE_17("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2) FROM
test", schema(single())),
/**
- * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1)
FROM test.
+ * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2)
FROM test.
*
* <p>Distribution hash(0)
*/
- CASE_17A("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1)
FROM test", schema(hash())),
+ CASE_17A("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2)
FROM test", schema(hash())),
/**
- * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1)
FROM test.
+ * Query: SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2)
FROM test.
*
* <p>Distribution identity(0)
*/
- CASE_17B("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 1)
FROM test", schema(identity())),
+ CASE_17B("SELECT (SELECT test.val0 FROM test t ORDER BY 1 LIMIT 2)
FROM test", schema(identity())),
/**
* Query: SELECT val0, val1, COUNT(*) cnt FROM test GROUP BY val0,
val1 ORDER BY val0, val1.
*
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CastResolutionTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CastResolutionTest.java
index 853354d341..2f8514b3ab 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CastResolutionTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CastResolutionTest.java
@@ -152,7 +152,9 @@ public class CastResolutionTest extends AbstractPlannerTest
{
for (String toType : toTypes) {
// TODO: https://issues.apache.org/jira/browse/IGNITE-21555
- if
(toType.equals(SqlTypeName.TIME_WITH_LOCAL_TIME_ZONE.getName())) {
+ if
(toType.equals(SqlTypeName.TIME_WITH_LOCAL_TIME_ZONE.getName())
+ || toType.equals(SqlTypeName.TIME_TZ.getName())
+ || toType.equals(SqlTypeName.TIMESTAMP_TZ.getName())) {
continue;
}
diff --git
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/DecimalLiteralTest.java
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/DecimalLiteralTest.java
index 0789b59e86..4095fb89b3 100644
---
a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/DecimalLiteralTest.java
+++
b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/DecimalLiteralTest.java
@@ -39,13 +39,12 @@ public class DecimalLiteralTest extends AbstractPlannerTest
{
/**
* Type of numeric decimal literal and type of decimal literal should
match.
*/
- // TODO: uncomment below after
https://issues.apache.org/jira/browse/IGNITE-21243")
@ParameterizedTest
@CsvSource({
- /* "-0.01",
+ "-0.01",
"-0.1",
"-10.0",
- "-10.122",*/
+ "-10.122",
"0.0",
"0.1",
"0.01",