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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ private StandardFunctions() {}
public static final FunctionName LESS_THAN_OR_EQUAL_OPERATOR_FUNCTION_NAME = new FunctionName("$less_than_or_equal");
public static final FunctionName GREATER_THAN_OPERATOR_FUNCTION_NAME = new FunctionName("$greater_than");
public static final FunctionName GREATER_THAN_OR_EQUAL_OPERATOR_FUNCTION_NAME = new FunctionName("$greater_than_or_equal");
/**
* $identical function is equivalent to the SQL operator "IS NOT DISTINCT FROM".
*/
public static final FunctionName IDENTICAL_OPERATOR_FUNCTION_NAME = new FunctionName("$identical");

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static Optional<Domain> createDomain(FunctionName functionName, Type typ
return Optional.of(Domain.create(ValueSet.ofRanges(Range.greaterThanOrEqual(type, startOfDate)), false));
}
if (functionName.equals(IDENTICAL_OPERATOR_FUNCTION_NAME)) {
return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, startOfDate, true, startOfNextDate, false)), true));
return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, startOfDate, true, startOfNextDate, false)), false));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add a jdoc to IDENTICAL_OPERATOR_FUNCTION_NAME documenting semantics (like SQL's NOT DISTINCT FROM, i assume)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be great to document it where io.trino.spi.expression.StandardFunctions#IDENTICAL_OPERATOR_FUNCTION_NAME is defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a jdoc like:
$identical function is equivalent to the SQL operator "IS NOT DISTINCT FROM".

}

return Optional.empty();
Expand Down Expand Up @@ -363,7 +363,7 @@ private static Optional<Domain> unwrapDateTruncInComparison(String unit, Functio
if (!constantAtPeriodStart) {
return Optional.of(Domain.none(type));
}
return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, start, true, end, false)), true));
return Optional.of(Domain.create(ValueSet.ofRanges(Range.range(type, start, true, end, false)), false));
}
if (functionName.equals(LESS_THAN_OPERATOR_FUNCTION_NAME)) {
if (constantAtPeriodStart) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testExtractTimestampTzMillisDateComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), false))));
}

/**
Expand Down Expand Up @@ -216,7 +216,7 @@ public void testExtractTimestampTzMicrosDateComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), false))));
}

/**
Expand Down Expand Up @@ -302,7 +302,7 @@ public void testExtractDateTruncTimestampTzMillisComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), false))));
}

/**
Expand Down Expand Up @@ -388,7 +388,7 @@ public void testExtractDateTruncTimestampTzMicrosComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfDateUtc, true, startOfNextDateUtc, false)), false))));
}

/**
Expand Down Expand Up @@ -461,7 +461,7 @@ public void testExtractYearTimestampTzMicrosComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfYearUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfYearUtc, true, startOfNextDateUtc, false)), false))));
}

/**
Expand Down Expand Up @@ -534,7 +534,7 @@ public void testExtractYearTimestampTzMillisComparison()
Map.of(timestampTzColumnSymbol, columnHandle))))
.isEqualTo(TupleDomain.withColumnDomains(Map.of(
columnHandle,
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfYearUtc, true, startOfNextDateUtc, false)), true))));
Domain.create(ValueSet.ofRanges(Range.range(columnType, startOfYearUtc, true, startOfNextDateUtc, false)), false))));
}

@Test
Expand Down