| 1943 | |
| 1944 | |
| 1945 | def test_table_flatten(): |
| 1946 | ty1 = pa.struct([pa.field('x', pa.int16()), |
| 1947 | pa.field('y', pa.float32())]) |
| 1948 | ty2 = pa.struct([pa.field('nest', ty1)]) |
| 1949 | a = pa.array([(1, 2.5), (3, 4.5)], type=ty1) |
| 1950 | b = pa.array([((11, 12.5),), ((13, 14.5),)], type=ty2) |
| 1951 | c = pa.array([False, True], type=pa.bool_()) |
| 1952 | |
| 1953 | table = pa.Table.from_arrays([a, b, c], names=['a', 'b', 'c']) |
| 1954 | t2 = table.flatten() |
| 1955 | t2.validate() |
| 1956 | expected = pa.Table.from_arrays([ |
| 1957 | pa.array([1, 3], type=pa.int16()), |
| 1958 | pa.array([2.5, 4.5], type=pa.float32()), |
| 1959 | pa.array([(11, 12.5), (13, 14.5)], type=ty1), |
| 1960 | c], |
| 1961 | names=['a.x', 'a.y', 'b.nest', 'c']) |
| 1962 | assert t2.equals(expected) |
| 1963 | |
| 1964 | |
| 1965 | def test_table_combine_chunks(): |