我正在使用Python Apache Hive客戶端(https://cwiki.apache.org/confluence/display/Hive/HiveClient#HiveClient-Python)在Shark服務器上運行查詢。Python Hive查詢被限制爲100
probelm是當我在Shark CLI中正常運行查詢時我得到了一整套結果,但是當我使用Hive Python客戶端時,它只返回100行。我的選擇查詢沒有限制。
鯊魚CLI:
[localhost:10000] shark> SELECT COUNT(*) FROM table;
46831
的Python:
import sys
from hive_service import ThriftHive
from hive_service.ttypes import HiveServerException
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
transport = TSocket.TSocket('localhost', 10000)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = ThriftHive.Client(protocol)
transport.open()
client.execute("SELECT * from table")
hdata = client.fetchAll()
transport.close()
....
In [97]: len(hdata)
Out[97]: 100
奇怪的是,當我運行在Python代碼COUNT(*)我得到:
In [104]: hdata
Out[104]: ['46831']
是否有設置文件或變量,我可以訪問解鎖此限制?
您的意思是說,在fetchAll()方法上設置了maxRows? – greenafrican
@greenAfrican:確實如此。如果你按照第二個鏈接,你會找到'driver.setMaxRows(numRows);'''在'fetchN()'' – JensG
的合適的調用謝謝。使用臨時緩存表解決此問題,然後運行COUNT,然後執行fetchN(count_var)。謝謝。 – greenafrican