如何在BigQuery上以与CSV相同的顺序加载数据 [英] How can I load data in same order as CSV on BigQuery
问题描述
是否可以按照与原始输入CSV文件相同的行顺序加载数据?这些文件不按任何特定顺序或任何特定列进行排序。
看起来像BigQuery的加载是分布式的,顺序是不可预测的,然而往往会先将空值组合。
$ b
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 as BigQuery loading is distributed, the order is not predictible, however tends to group nulls first.
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.
这篇关于如何在BigQuery上以与CSV相同的顺序加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!