Maksim Zhuravkov created IGNITE-25320:
-----------------------------------------
Summary: Sql. Cast FORMAT. Improve code generation in
RexToLitTransator
Key: IGNITE-25320
URL: https://issues.apache.org/jira/browse/IGNITE-25320
Project: Ignite
Issue Type: Improvement
Components: sql
Reporter: Maksim Zhuravkov
CAST FORMAT operation creates an instance of SqlFunctions.ParseFunction on
every call.
This function has an internal cache for each format it encounters but the cache
is not use because each instance is used once per row.
{noformat}
public void project(org.apache.ignite.internal.sql.engine.exec.ExecutionContext
ctx, Object row,
org.apache.ignite.internal.sql.engine.exec.RowHandler.RowBuilder outBuilder) {
try {
final String value_dynamic_param = ctx.getParameter("?0",
java.lang.String.class) == null ? null : ctx.getParameter("?0",
java.lang.String.class).toString();
outBuilder.addField(value_dynamic_param == null ? 0L :
org.apache.ignite.internal.sql.engine.exec.exp.IgniteSqlFunctions.toTimestampExact(org.apache.ignite.internal.sql.engine.exec.exp.IgniteSqlFunctions.toTimestampExact(new
org.apache.calcite.runtime.SqlFunctions.DateParseFunction().parseTimestamp("yyyy-MM-dd
HH:mm:ss", value_dynamic_param))));
} catch (Exception e) {
throw new org.apache.ignite.sql.SqlException(
262151,
e);
}
}
{noformat}
IgniteSqlFunctions.toTimestampWithLocalTimeZone creates an instance of that
function as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)