Skip to content

Commit 345413c

Browse files
committed
[fix][core] Optimize decorrelate
1 parent 0b9633e commit 345413c

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

core/src/main/java/org/apache/calcite/rel/type/RelDataTypeSystemImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ && getDefaultPrecision(typeName) != -1) {
243243
if(argumentType.getSqlTypeName() == SqlTypeName.TINYINT ||
244244
argumentType.getSqlTypeName() == SqlTypeName.INTEGER ||
245245
argumentType.getSqlTypeName() == SqlTypeName.BIGINT) {
246-
return typeFactory.createSqlType(SqlTypeName.DECIMAL);
246+
return typeFactory.createSqlType(SqlTypeName.DECIMAL, 14, 4);
247247
}
248248
return argumentType;
249249
}

core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -706,16 +706,6 @@ private static void shiftMapping(Map<Integer, Integer> mapping, int startIndex,
706706
public @Nullable Frame getInvoke(RelNode r, boolean isCorVarDefined, @Nullable RelNode parent) {
707707
final Frame frame = dispatcher.invoke(r, isCorVarDefined);
708708
currentRel = parent;
709-
if (frame != null && isCorVarDefined && r instanceof Sort) {
710-
final Sort sort = (Sort) r;
711-
// Can not decorrelate if the sort has per-correlate-key attributes like
712-
// offset or fetch limit, because these attributes scope would change to
713-
// global after decorrelation. They should take effect within the scope
714-
// of the correlation key actually.
715-
if (sort.offset != null || sort.fetch != null) {
716-
return null;
717-
}
718-
}
719709
if (frame != null) {
720710
map.put(r, frame);
721711
}

0 commit comments

Comments
 (0)