works but not correct result
dataset write to file
optimize