无法使用exact_count_distinct BigQuery聚合函数

时间:2016-08-14 18:09:08

标签: google-bigquery

执行以下查询时,我收到查询执行期间超出资源错误:

SELECT EXACT_COUNT_DISTINCT(id)FROM [bigquery-public-data:github_repos.contents]

我使用了EXACT_COUNT_DISTINCT聚合函数,因为COUNT([DISTINCT])函数只给出了统计近似值。

1 个答案:

答案 0 :(得分:3)

尝试以下

for BigQuery Legacy SQL

HTTP Status 500 - php.java.bridge.http.FCGIConnectException: Could not connect to server

type Exception report

message php.java.bridge.http.FCGIConnectException: Could not connect to server

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: Could not connect to server
    php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:133)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Unknown Source)
root cause

php.java.bridge.http.FCGIConnectException: Could not connect to server
    php.java.bridge.http.NPChannelFactory.test(NPChannelFactory.java:64)
    php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Unknown Source)
root cause

java.io.IOException: File \\.\pipe\C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\temp\JavaBridge4557505765763204955.socket not writable
    php.java.bridge.http.FCGIConnectException.<init>(FCGIConnectException.java:37)
    php.java.bridge.http.NPChannelFactory.test(NPChannelFactory.java:64)
    php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
    org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
    org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    java.lang.Thread.run(Unknown Source)
root cause

java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [php-cgi, -v] 
    php.java.bridge.Util$Process.start(Util.java:1145)
    php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68)
    php.java.bridge.http.NPChannelFactory.doBind(NPChannelFactory.java:94)
    php.java.bridge.http.FCGIConnectionFactory.runFcgi(FCGIConnectionFactory.java:88)
    php.java.bridge.http.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109)
note The full stack trace of the root cause is available in the Apache Tomcat/8.5.4 logs.

Apache Tomcat/8.5.4

for BigQuery Standard SQL

SELECT COUNT(1) AS cnt FROM (
  SELECT id 
  FROM [bigquery-public-data:github_repos.contents]
  GROUP BY id
)