Source:
<code>public static AbstractExpression createToTimestampFunctionExpression( RelDataType relDataType, ExpressionType intervalOperatorType, List<AbstractExpression> aeOperands) { Preconditions.checkArgument(2 == aeOperands.size()); AbstractExpression timestamp = null; AbstractExpression interval = null; if (aeOperands.get(0).getValueType() == VoltType.TIMESTAMP) { timestamp = aeOperands.get(0); } else if (aeOperands.get(0).getValueType() == VoltType.BIGINT) { interval = aeOperands.get(0); } if (aeOperands.get(1).getValueType() == VoltType.TIMESTAMP) { timestamp = aeOperands.get(1); } else if (aeOperands.get(1).getValueType() == VoltType.BIGINT) { interval = aeOperands.get(1); } if (timestamp == null || interval == null) { throw new CalcitePlanningException("Invalid arguments for VoltDB TO_TIMESTAMP function"); } TypeConverter.setType(timestamp, VoltType.TIMESTAMP, VoltType.TIMESTAMP.getLengthInBytesForFixedTypes()); TypeConverter.setType(interval, VoltType.BIGINT, VoltType.BIGINT.getLengthInBytesForFixedTypes()); List<AbstractExpression> epochOperands = new ArrayList<>(); epochOperands.add(timestamp); String impliedArgMicrosecond = "MICROSECOND"; AbstractExpression sinceEpochExpr = createFunctionExpression( VoltType.BIGINT, "since_epoch", <START> FunctionSQL.voltGetSinceEpochId(impliedArgMicrosecond), <END> epochOperands, impliedArgMicrosecond); AbstractExpression plusExpr = new OperatorExpression(intervalOperatorType, sinceEpochExpr, interval); TypeConverter.setType(plusExpr, VoltType.BIGINT, VoltType.BIGINT.getLengthInBytesForFixedTypes()); List<AbstractExpression> timestampOperands = new ArrayList<>(); timestampOperands.add(plusExpr); AbstractExpression timestampExpr = createFunctionExpression( relDataType, "to_timestamp", FunctionSQL.voltGetToTimestampId(impliedArgMicrosecond), timestampOperands, impliedArgMicrosecond); TypeConverter.setType(timestampExpr, relDataType); return timestampExpr; }</code><technical_language>Is a eliminate a dependency hsqldb package? For a quick get Calcite is meant replace / eliminate HSQL depend it</technical_language>

Target:
public static AbstractExpression createToTimestampFunctionExpression( RelDataType relDataType, ExpressionType intervalOperatorType, List<AbstractExpression> aeOperands) { Preconditions.checkArgument(2 == aeOperands.size()); AbstractExpression timestamp = null; AbstractExpression interval = null; if (aeOperands.get(0).getValueType() == VoltType.TIMESTAMP) { timestamp = aeOperands.get(0); } else if (aeOperands.get(0).getValueType() == VoltType.BIGINT) { interval = aeOperands.get(0); } if (aeOperands.get(1).getValueType() == VoltType.TIMESTAMP) { timestamp = aeOperands.get(1); } else if (aeOperands.get(1).getValueType() == VoltType.BIGINT) { interval = aeOperands.get(1); } if (timestamp == null || interval == null) { throw new CalcitePlanningException("Invalid arguments for VoltDB TO_TIMESTAMP function"); } RexConverter.setType(timestamp, VoltType.TIMESTAMP, VoltType.TIMESTAMP.getLengthInBytesForFixedTypes()); RexConverter.setType(interval, VoltType.BIGINT, VoltType.BIGINT.getLengthInBytesForFixedTypes()); List<AbstractExpression> epochOperands = new ArrayList<>(); epochOperands.add(timestamp); String impliedArgMicrosecond = "MICROSECOND"; AbstractExpression sinceEpochExpr = createFunctionExpression( VoltType.BIGINT, "since_epoch", FunctionSQL.voltGetSinceEpochId(impliedArgMicrosecond), epochOperands, impliedArgMicrosecond); AbstractExpression plusExpr = new OperatorExpression(intervalOperatorType, sinceEpochExpr, interval); RexConverter.setType(plusExpr, VoltType.BIGINT, VoltType.BIGINT.getLengthInBytesForFixedTypes()); List<AbstractExpression> timestampOperands = new ArrayList<>(); timestampOperands.add(plusExpr); AbstractExpression timestampExpr = createFunctionExpression( relDataType, "to_timestamp", FunctionSQL.voltGetToTimestampId(impliedArgMicrosecond), timestampOperands, impliedArgMicrosecond); RexConverter.setType(timestampExpr, relDataType); return timestampExpr; }