function out = summary(t)
%SUMMARY Print summary of a  distributed table.
%   SUMMARY(T)
%   
%   See also TABLE/SUMMARY, DISTRIBUTED.
%   


%   Copyright 2016-2020 The MathWorks, Inc.

if ~istable(t)
    error(message('parallel:array:UnsupportedFunction', upper(mfilename), underlyingType(t)));
end

% Call the codistributed version to get the summary info and then gather it
spmd
    summaryInfo = distributedutil.calculateSummary(t);
    p = distributedutil.AutoTransfer(subsref(t, substruct('.', 'Properties' )));
    t = distributedutil.AutoTransfer(summaryInfo);
end
summaryInfo = t.Value;
tableProps  = p.Value;

% Show the results
if nargout == 0
    matlab.bigdata.internal.util.printSummary(summaryInfo, tableProps);
else
    out = matlab.bigdata.internal.util.emitSummary(summaryInfo, tableProps);
end
end
