How can I load data in same order as CSV on BigQuery

前端 未结 2 886
梦谈多话
梦谈多话 2021-01-29 00:22

Is it possible to load data in the same row order as in the original input CSV file? These files are not sorted in any particular order or by any particular column. Looks like a

相关标签:
2条回答
  • 2021-01-29 00:26

    The only way to achieve this given the way BigQuery works behind the scenes would be to add an extra column to the csv that defines the desired order. BigQuery shuffles data around behind the scenes to optimise storage and query speed so relying on any order is impossible.

    But sorting is easy, so if your dataset contains the equivalent of a rownumber, you can always recover any ordering of rows with a simple sort.

    0 讨论(0)
  • 2021-01-29 00:53

    No, it is not possible. Moreover - once data is loaded into BigQuery table, and doesn't preserve static order, as BigQuery may reshuffle rows in order to optimize storage and future query performance. Result rows of any SELECT query without outermost ORDER BY may come in different order on different invocations.

    0 讨论(0)
提交回复
热议问题