1. A computer storage medium storing computer-executable instructions that, when executed, cause one or more processors to perform acts comprising:
generating a first execution plan for a job that includes a plurality of tasks;
collecting statistics regarding operations performed in the plurality of tasks while the plurality of tasks are executed via parallel distributed execution;
generating a second execution plan for a recurring job, the second execution plan having at least one task in common with the first execution plan for the job; and
optimizing the second execution plan based at least on the statistics to produce an optimized execution plan, wherein the optimizing includes at least one of:
reducing a number of parallelisms for operations at a tail end of the job; or
replacing pair-wise joins of data with broadcast joins of data process by at least one of the operations.
2. The computer storage medium of claim 1, further comprising:
executing a plurality of further tasks specified in the optimized execution plan to generate execution results for the recurring job; and
outputting the execution results of the recurring job.
3. The computer storage medium of claim 2, further comprising:
collecting additional statistics regarding additional operations performed in the further tasks while the further tasks are executed via parallel distributed execution; and
optimizing the additional operations on-the-fly during the parallel distributed execution of the further tasks based at least on the additional statistics.
4. The computer storage medium of claim 1, wherein the generating the first execution plan includes translating a job script for the job into the first execution plan.
5. The computer storage medium of claim 1, wherein the collecting the statistics includes:
inserting collectors into a set of operations selected from the operations performed in the tasks;
receiving local statistical data from the collectors while the set of the operations are executed via parallel distributed execution; and
composing the local statistical data provided by the collectors into the statistics.
6. The computer storage medium of claim 5, further comprising selecting the set of operations from the operations performed in the task by ignoring at least one operation that produces a predictable result.
7. The computer storage medium of claim 5, wherein the optimizing includes matching the statistics captured by the collectors to expressions specified in the second execution plan based at least on hash values that represent locations of the collectors in a query graph of the first execution plan.
8. The computer storage medium of claim 1, wherein the statistics include a first number of distinctive values in a data table column and a second number of values that repeat over a predetermined fraction of rows in the data table column, and wherein the optimizing includes avoiding skewing in partitioning of operations in the recurring job based at least on the first number and the second number.
9. The computer storage medium of claim 8, further comprising:
estimating the first number via distributed hash sketching; and
estimating the second number by at least receiving frequency estimates obtained by each collector, totaling up the frequency estimates, and tallying up distinct values, wherein each frequency estimate is obtained by a corresponding collector through lossy counting of a subset of data observed by a task that is monitored by the corresponding collector.
10. The computer storage medium of claim 1, wherein the optimizing includes at least one of:
determining a sequence of operations based at least on operator selectivity and computation costs of the operations; or
determining a degree of parallelism for the operations, a number of partitions for the operations, or operations to fit into a particular task based at least on the computation costs of the operations and a size of data to be processed.
11. A computer-implemented method, comprising:
generating a first execution plan for a job that includes a plurality of tasks;
collecting statistics regarding operations performed in the plurality of tasks while the plurality of tasks are executed via parallel distributed execution;
optimizing a second execution plan for a recurring job based at least on the statistics to produce an optimized execution plan, the second execution plan having at least one task in common with the first execution plan, wherein the optimizing includes at least one of:
reducing a number of parallelisms for operations at a tail end of the job; or
replacing pair-wise joins of data with broadcast joins of data process by at least one of the operations;
executing a plurality of further tasks specified in the optimized execution plan to generate execution results for the recurring job; and
outputting the execution results of the recurring job.
12. The computer-implemented method of claim 11, further comprising:
collecting additional statistics regarding additional operations performed in the further tasks while the further tasks are executed via parallel distributed execution; and
optimizing the additional operations on-the-fly during the parallel distributed execution of the further tasks based at least on the additional statistics.
13. The computer-implemented method of claim 11, wherein the collecting the statistics includes:
inserting collectors into a set of operations selected from the operations performed in the tasks;
receiving local statistical data from the collectors while the set of the operations are executed via parallel distributed execution; and
composing the local statistical data provided by the collectors into the statistics.
14. The computer-implemented method of claim 11, wherein the optimizing includes at least one of:
determining a sequence of operations based at least on operator selectivity and computation costs of the operations; or
determining a degree of parallelism for the operations, a number of partitions for the operations, or operations to fit into a particular task based at least on the computation costs of operations.
15. The computer-implemented method of claim 11, wherein the collecting the statistics includes:
selecting a set of operations from the operations performed in the tasks by ignoring at least one operation that produces a predictable result;
inserting collectors into the set of operations; and
receiving at least some of the statistics from the collectors.
16. A computing device, comprising:
one or more processors; and
a memory that includes a plurality of computer-executable components executed by the one or more processors, comprising:
a compiler that generates a first execution plan for a job that includes a plurality of tasks;
at least one job manager that collects statistics regarding operations performed in the plurality of tasks while the plurality of tasks are executed via parallel distributed execution; and
a compile-time optimizer that optimizes a second execution plan based at least on the statistics to produce an optimized execution plan, the second execution plan having at least one task in common with the first execution plan, wherein the compile-time optimizer is configured to perform at least one of:
reducing a number of parallelisms for operations at a tail end of the job; or
replacing pair-wise joins of data with broadcast joins of data process by at least one of the operations.
17. The computing device of claim 16, wherein the compiler generates the second execution plan for a recurring job that is similar to the job.
18. The computing device of claim 16, wherein the at least one job manager collects additional statistics regarding additional operations performed in further tasks of the second execution plan as the further tasks are executed via parallel distributed execution, and optimizes the additional operations on-the-fly during the parallel distributed execution of the further tasks based at least on the additional statistics.
19. The computing device of claim 16, wherein the at least one job manager collects the statistics by:
inserting collectors into a set of operations selected from the operations performed in the tasks;
receiving local statistical data from the collectors as the set of the operations are executed via parallel distributed execution; and
composing the local statistical data provided by the collectors into the statistics.
20. The computing device of claim 16, wherein the statistics include a first number of distinctive values in a data table column and a second number of values that repeat over a predetermined fraction of rows in the data table column, and wherein the compile-time optimizer is configured to:
avoid skewing in partitioning of operations in the recurring job based at least on the first number and the second number;
estimate the first number via distributed hash sketching; and
estimate the second number by at least receiving frequency estimates obtained by each collector, totaling up the frequency estimates, and tallying up distinct values, wherein each frequency estimate is obtained by a corresponding collector through lossy counting of a subset of data observed by a task that is monitored by the corresponding collector.
The claims below are in addition to those above.
All refrences to claim(s) which appear below refer to the numbering after this setence.
1. A medication dispensing device, comprising:
a medication supply unit configured to supply solid medications in accordance with a prescription;
at least one storage unit configured to store and discharge the solid medications supplied by the medication supply unit in a predetermined amount for packaging;
a medication monitoring mount on which the solid medications are placed;
an imaging unit fixed above the medication monitoring mount and configured to capture a plurality of images of the solid medications, discharged in accordance with a dose based on the prescription, on the medication monitoring mount;
a counting unit configured to
count a quantity of the solid medications on the medication monitoring mount, by an image recognizing and processing means, based on each of the images captured by the imaging unit, and
compare the counted quantity of the solid medications with a quantity of solid medications corresponding to the dose based on the prescription.
2. The medication dispensing device of claim 1, further comprising a vibrating unit coupled to the medication monitoring mount and configured to vibrate the medication monitoring mount in a predetermined direction while the plurality of images is being captured.
3. The medication dispensing device of claim 2, wherein the vibrating unit is configured to vibrate the medication monitoring mount by reciprocating the medication monitoring mount in the predetermined direction.
4. The medication dispensing device of claim 2, wherein
the counting unit is configured to
set a largest quantity among the counted quantities as the quantity of the solid medications with regard to the dose based on the prescription.
5. The medication dispensing device of claim 2, wherein the medication monitoring mount includes a plurality of grooves extending along the predetermined direction.
6. The medication dispensing device of claim 1, comprising a plurality of the storage units, wherein
the storage units are aligned in a circular shape, constituting a partition-forming body,
the medication monitoring mount is positioned adjacent to an outer or inner periphery of the partition-forming body, and
the partition-forming body is configured to move each of the storage units to a position facing the medication monitoring mount, and
each of the storage units is configured to discharge the solid medications toward the medication monitoring mount when moved to the position facing the medication monitoring mount.
7. The medication dispensing device of claim 1, wherein the imaging unit is a single camera fixed above the medication monitoring mount.
8. A medication dispensing device, comprising:
a medication supply unit configured to supply medications in accordance with a prescription;
a storage unit configured to store and discharge the medications supplied by the medication supply unit in a predetermined amount for packaging;
a medication monitoring mount on which the medications are placed;
an imaging unit configured to capture a plurality of images of the medications on the medication monitoring mount; and
a counting unit configured to
count a quantity of the medications based on each of the images captured by the imaging unit, and
set a largest quantity among the counted quantities as the quantity of the medications with regard to the prescription.
9. A method of counting a quantity of medications, the method comprising:
discharging solid medications by a dose;
placing the discharged solid medications on a medication monitoring mount;
capturing a plurality of images of the solid medications on the medication monitoring mount;
counting a quantity of the solid medications on the medication monitoring mount based on each of the captured images to set a largest counted quantity among the counted quantities as the quantity of medications with regard to a prescription; and
comparing each of the counted quantities with a quantity of medications determined based on prescription data of the prescription.
10. A method of counting a quantity of medications, the method comprising:
discharging medications by a dose in accordance with a prescription;
placing the discharged medications on a medication monitoring mount;
capturing a plurality of images of the medications on the medication monitoring mount;
counting a quantity of the medications on the medication monitoring mount based on each of the captured images; and
setting a largest quantity among the counted quantities as the quantity of the medications with regard to the prescription.