org.apache.flink.types.Row.copy()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.apache.flink.types.Row.copy方法的一些代码示例,展示了Row.copy的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.copy方法的具体详情如下:
包路径:org.apache.flink.types.Row
类名称:Row
方法名:copy

Row.copy介绍

[英]Creates a new Row which copied from another row. This method does not perform a deep copy.
[中]创建从另一行复制的新行。此方法不执行深度复制。

代码示例

代码示例来源:origin: apache/flink

@Test
public void testRowCopy() {
  Row row = new Row(5);
  row.setField(0, 1);
  row.setField(1, "hello");
  row.setField(2, null);
  row.setField(3, new Tuple2<>(2, "hi"));
  row.setField(4, "hello world");
  Row copy = Row.copy(row);
  assertEquals(row, copy);
  assertTrue(row != copy);
}

代码示例来源:origin: com.alibaba.blink/flink-table

@Override
  protected Row convert(Row current) {
    if (reuse == null) {
      return Row.copy(current);
    } else {
      for (int i = 0; i < current.getArity(); ++i) {
        reuse.setField(i, current.getField(i));
      }
      return reuse;
    }
  }
}

代码示例来源:origin: com.alibaba.blink/flink-table

@Override
public Row convert(Row current) {
  if (reuse == null) {
    return Row.copy(current);
  } else {
    Preconditions.checkArgument(current.getArity() == reuse.getArity());
    for (int i = 0; i < current.getArity(); ++i) {
      reuse.setField(i, current.getField(i));
    }
    return reuse;
  }
}

相关文章