zstan commented on code in PR #5145:
URL: https://github.com/apache/ignite-3/pull/5145#discussion_r1937371483
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rex/IgniteRexBuilder.java:
##########
@@ -77,6 +78,8 @@ public RexNode makeLiteral(@Nullable Object value,
RelDataType type, boolean all
}
return makeCharLiteral(string);
+ } else if (type.getSqlTypeName() == SqlTypeName.BINARY) {
Review Comment:
This is very tricky place, if my approach is correct seems i need to fill
appropriate comment here.
I think this is calcite related bug, but due to incorrect behavior with
binary types it can`t be reproduced without calcite core code changes, after
similar to
[IgniteTypeCoercion](https://github.com/apache/ignite-3/pull/5145/files#diff-e321e723c2ee035a28656a0ed73aff3429b5ea855934cdfb8e51dd7c91157f03)
fix, related code (i think bug is inside)
RelBuilder#setOp ->
...
RelDataType rowType = getTypeFactory()
.leastRestrictive(inputTypes);
and as a result will be called padding:
org.apache.calcite.rex.RexBuilder#makeLiteral
case BINARY:
return makeBinaryLiteral(
padRight((ByteString) value, type.getPrecision()));
fast reproducers :
1. comment this code and run: test_blob_function.test
2. the same - comment and check result for
```
sql("CREATE TABLE blobs (b varbinary);");
sql("INSERT INTO blobs VALUES (x'aa'::binary), (x'bbcc')");
List<List<Object>> res = sql("SELECT OCTET_LENGTH(b) FROM blobs
ORDER BY 1");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]