找到第一个&最后的Array结构

时间:2018-04-24 10:52:39

标签: arrays hive hiveql

在文件中有一个数组结构,如下所示

[{"A":"1","B":"2","C":"3"},{"A":"4","B":"5","C":"6"},{"A":"7","B":"8","C":"9"}]

我怎样才能获得第一个&列"A" ("1","7")的最后一个值

需要在Hive中编写 SQL

提前致谢。

1 个答案:

答案 0 :(得分:0)

数组的第一个元素是import gdax import time public = gdax.PublicClient() while True: endtime = time.time() + 60 x = [] while time.time() < endtime: ticker = public.get_product_ticker('BTC-USD') ticker = ticker['price'] ticker = float(ticker) x.append(ticker) change = ((x[0]-x[-1])/x[-1]) print(ticker) time.sleep(1) print("Open: {} High: {} Low: {} Close: {} Change: {}%".format(x[0], max(x), min(x), x[-1], change*100)) time.sleep(0) ,最后一个是array_name[0]

演示:

array_name[size(array_name)-1]