def test_table_function(): dataset = mock_data_set() schema = resolve_schema( dataset, Function('flatten', LoadOp('employees'), StringConst('roles')) ).schema eq_(schema['roles'].type,'STRING') eq_(schema['roles'].mode,'NULLABLE')
def test_slice_op(): dataset = mock_data_set() employees = dataset.get_relation('employees') op = resolve_schema( dataset, OrderByOp(LoadOp('employees'), 'manager_id') ) schema = op.schema eq_( schema, dataset.get_schema('employees') )
def test_slice_op(): dataset = mock_data_set() employees = dataset.get_relation('employees') op = resolve_schema( dataset, SliceOp(LoadOp('employees'), 1) ) schema = op.schema eq_( schema, dataset.get_schema('employees') )
def test_no_operations(): """ Without any operations the schema should be equal to the given relation. """ dataset = mock_data_set() employees = dataset.get_relation('employees') schema = resolve_schema(dataset, LoadOp('employees')).schema assert_sequence_equal( schema.fields, employees.schema.fields )