[ 
https://issues.apache.org/jira/browse/IGNITE-24152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-24152:
--------------------------------------
    Description: 
it is possible to create a table with that has a VARBINARY column with length 
that is larger than 65536 but inserting byte strings longer than 65536 results 
in data truncation upon write. 

{code:java}
@Test
    public void test() {
        sql("CREATE TABLE t(id INT PRIMARY KEY, val VARBINARY(2000000))");

        Object s = "1".repeat(1024*1024*20).getBytes(StandardCharsets.UTF_8);
        sql("INSERT INTO t VALUES(1, ?)", s);

        for (var row : sql("SELECT id, val FROM t")) {
            byte[] bytes = (byte[]) row.get(1);
            System.err.println( bytes.length);
            // Prints 65536
        }
    }
{code}





  was:
it is possible to create a table with that has a VARBINARY column with length 
that is larger than 65536 but inserting byte strings longer than 65536 results 
in data truncation upon write. 

{code:java}
@Test
    public void test() {
        sql("CREATE TABLE t(id INT PRIMARY KEY, val VARBINARY(2000000))");

        Object s = "1".repeat(1024*1024*20).getBytes(StandardCharsets.UTF_8);
        sql("INSERT INTO t VALUES(1, ?)", s);

        for (var row : sql("SELECT id, val FROM t")) {
            byte[] bytes = (byte[]) row.get(1);
            System.err.println(row.get(0) + ", " + bytes.length);
            // Prints 1, 65536
        }
    }
{code}






> Sql. Dml. Varbinary value in dynamic parameter is truncated if its length is 
> larger than 65536 
> -----------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-24152
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24152
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> it is possible to create a table with that has a VARBINARY column with length 
> that is larger than 65536 but inserting byte strings longer than 65536 
> results in data truncation upon write. 
> {code:java}
> @Test
>     public void test() {
>         sql("CREATE TABLE t(id INT PRIMARY KEY, val VARBINARY(2000000))");
>         Object s = "1".repeat(1024*1024*20).getBytes(StandardCharsets.UTF_8);
>         sql("INSERT INTO t VALUES(1, ?)", s);
>         for (var row : sql("SELECT id, val FROM t")) {
>             byte[] bytes = (byte[]) row.get(1);
>             System.err.println( bytes.length);
>             // Prints 65536
>         }
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to