Пример #1
0
 def test_row_coder(self):
     from pyflink.table import Row
     field_coder = BigIntCoder()
     field_count = 10
     coder = RowCoder([field_coder for _ in range(field_count)])
     v = Row(*[None if i % 2 == 0 else i for i in range(field_count)])
     self.check_coder(coder, v)
Пример #2
0
 def test_row_coder(self):
     from pyflink.common import Row, RowKind
     field_coder = BigIntCoder()
     field_count = 10
     coder = RowCoder([field_coder for _ in range(field_count)])
     v = Row(*[None if i % 2 == 0 else i for i in range(field_count)])
     v.set_row_kind(RowKind.INSERT)
     self.check_coder(coder, v)
     v.set_row_kind(RowKind.UPDATE_BEFORE)
     self.check_coder(coder, v)
     v.set_row_kind(RowKind.UPDATE_AFTER)
     self.check_coder(coder, v)
     v.set_row_kind(RowKind.DELETE)
     self.check_coder(coder, v)
Пример #3
0
    def test_row_coder(self):
        from pyflink.common import Row, RowKind
        field_coder = BigIntCoder()
        field_count = 10
        field_names = ['f{}'.format(i) for i in range(field_count)]
        coder = RowCoder([field_coder for _ in range(field_count)],
                         field_names)
        v = Row(**{
            field_names[i]: None if i % 2 == 0 else i
            for i in range(field_count)
        })
        v.set_row_kind(RowKind.INSERT)
        self.check_coder(coder, v)
        v.set_row_kind(RowKind.UPDATE_BEFORE)
        self.check_coder(coder, v)
        v.set_row_kind(RowKind.UPDATE_AFTER)
        self.check_coder(coder, v)
        v.set_row_kind(RowKind.DELETE)
        self.check_coder(coder, v)

        coder = RowCoder([BigIntCoder(), CharCoder()], ['f1', 'f0'])
        v = Row(f0="flink", f1=11)
        self.check_coder(coder, v)