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

Iurii Gerzhedovich updated IGNITE-23898:
----------------------------------------
    Description: 
Under IGNITE-23727, the method `map` has been moved from the RowHandler class 
into the RowFactory class, which is logically right because the method 
producing a new row should be placed in a factory instead of a handler. Also, 
it helps to avoid calculating schema for each method invocation or passing it 
as a parameter each time. 

Right now we have another similar method in RowHandler named `concat`. Let's 
also move it into the RowFactory and calculate scham just once.
Also, let's do a little refactoring for existed method 
ModifyNode.getMappedRowSchema, need to extract a new static method for mapping 
into RowSchema class like a :
{code:java}
class RowSchema {
    static RowSchema map(RowSchema schema, int[] mapping) {
        List<TypeSpec> fields = schema.fields();
        Builder builder = builder();

        for (int i : mapping) {
            TypeSpec typeSpec = fields.get(i);
            builder.addField(typeSpec);
        }

        return builder.build();
    }
} {code}
 

  was:
Under IGNITE-23727, the method `map` has been moved from the RowHandler class 
into the RowFactory class, which is logically right because the method 
producing a new row should be placed in a factory instead of a handler. Also, 
it helps to avoid calculating schema for each method invocation or passing it 
as a parameter each time. 

Right now we have another similar method in RowHandler named `concat`. Let's 
also move it into the RowFactory and calculate scham just once.
Also, let's do a little refactoring for existed method 
ModifyNode.getMappedRowSchema, need to extract a new static method for mapping 
into RowSchema class like a :
{code:java}
class RowSchema {
static RowSchema map(RowSchema schema, int[] mapping) {
List<TypeSpec> fields = schema.fields();
Builder builder = builder();
for (int i : mapping)
{ TypeSpec typeSpec = fields.get(i); builder.addField(typeSpec); }
return builder.build();
}
{code}

{{}}


> Sql. Calculate schema for concat two rows just once
> ---------------------------------------------------
>
>                 Key: IGNITE-23898
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23898
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Iurii Gerzhedovich
>            Priority: Major
>
> Under IGNITE-23727, the method `map` has been moved from the RowHandler class 
> into the RowFactory class, which is logically right because the method 
> producing a new row should be placed in a factory instead of a handler. Also, 
> it helps to avoid calculating schema for each method invocation or passing it 
> as a parameter each time. 
> Right now we have another similar method in RowHandler named `concat`. Let's 
> also move it into the RowFactory and calculate scham just once.
> Also, let's do a little refactoring for existed method 
> ModifyNode.getMappedRowSchema, need to extract a new static method for 
> mapping into RowSchema class like a :
> {code:java}
> class RowSchema {
>     static RowSchema map(RowSchema schema, int[] mapping) {
>         List<TypeSpec> fields = schema.fields();
>         Builder builder = builder();
>         for (int i : mapping) {
>             TypeSpec typeSpec = fields.get(i);
>             builder.addField(typeSpec);
>         }
>         return builder.build();
>     }
> } {code}
>  



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

Reply via email to