You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/04/29 12:53:08 UTC

[GitHub] [incubator-doris] EmmyMiao87 opened a new issue #3435: The error result when assert num rows node is used

EmmyMiao87 opened a new issue #3435:
URL: https://github.com/apache/incubator-doris/issues/3435


   **Describe the bug**
   select sum from (select sum(k1) sum from baseall)t1 where sum >  (select avg from (select avg(k1) avg from baseall) t2 ) ;
   
   The first level of subquery returns a non-scalar value, so the assert num rows node is needed.
   The second level of subquery has a aggregation function, so the child of assert node is aggregate node.
   
   The result is empty.
   
   **To Reproduce**
   
   Query: select sum from (select sum(k1) sum from baseall)t1 where sum >  (select avg from (select min(k1) avg from baseall) t2 ) ;
   
   explain:
   
   ```
   +-----------------------------------------------------------------------------+
   | Explain String                                                              |
   +-----------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                             |
   |  OUTPUT EXPRS:<slot 1>                                                      |
   |   PARTITION: UNPARTITIONED                                                  |
   |                                                                             |
   |   RESULT SINK                                                               |
   |                                                                             |
   |   5:CROSS JOIN                                                              |
   |   |  cross join:                                                            |
   |   |  predicates: <slot 1> > <slot 4>                                        |
   |   |  tuple ids: 1 4                                                         |
   |   |                                                                         |
   |   |----10:EXCHANGE                                                          |
   |   |       tuple ids: 4                                                      |
   |   |                                                                         |
   |   7:AGGREGATE (merge finalize)                                              |
   |   |  output: sum(<slot 1>)                                                  |
   |   |  group by:                                                              |
   |   |  tuple ids: 1                                                           |
   |   |                                                                         |
   |   6:EXCHANGE                                                                |
   |      tuple ids: 1                                                           |
   |                                                                             |
   | PLAN FRAGMENT 1                                                             |
   |  OUTPUT EXPRS:                                                              |
   |   PARTITION: UNPARTITIONED                                                  |
   |                                                                             |
   |   STREAM DATA SINK                                                          |
   |     EXCHANGE ID: 10                                                         |
   |     UNPARTITIONED                                                           |
   |                                                                             |
   |   4:ASSERT NUMBER OF ROWS                                                   |
   |   |  assert number of rows: 1                                               |
   |   |  tuple ids: 4                                                           |
   |   |                                                                         |
   |   9:AGGREGATE (merge finalize)                                              |
   |   |  output: min(<slot 4>)                                                  |
   |   |  group by:                                                              |
   |   |  tuple ids: 4                                                           |
   |   |                                                                         |
   |   8:EXCHANGE                                                                |
   |      tuple ids: 4                                                           |
   |                                                                             |
   | PLAN FRAGMENT 2                                                             |
   |  OUTPUT EXPRS:                                                              |
   |   PARTITION: RANDOM                                                         |
   |                                                                             |
   |   STREAM DATA SINK                                                          |
   |     EXCHANGE ID: 08                                                         |
   |     UNPARTITIONED                                                           |
   |                                                                             |
   |   3:AGGREGATE (update serialize)                                            |
   |   |  output: min(`k1`)                                                      |
   |   |  group by:                                                              |
   |   |  tuple ids: 4                                                           |
   |   |                                                                         |
   |   2:OlapScanNode                                                            |
   |      TABLE: baseall                                                         |
   |      PREAGGREGATION: ON                                                     |
   |      partitions=1/1                                                         |
   |      rollup: baseall                                                        |
   |      tabletRatio=10/10                                                      |
   |      tabletList=12033,12035,12037,12039,12041,12043,12045,12047,12049,12051 |
   |      cardinality=0                                                          |
   |      avgRowSize=0.0                                                         |
   |      numNodes=0                                                             |
   |      tuple ids: 3                                                           |
   |                                                                             |
   | PLAN FRAGMENT 3                                                             |
   |  OUTPUT EXPRS:                                                              |
   |   PARTITION: RANDOM                                                         |
   |                                                                             |
   |   STREAM DATA SINK                                                          |
   |     EXCHANGE ID: 06                                                         |
   |     UNPARTITIONED                                                           |
   |                                                                             |
   |   1:AGGREGATE (update serialize)                                            |
   |   |  output: sum(`k1`)                                                      |
   |   |  group by:                                                              |
   |   |  tuple ids: 1                                                           |
   |   |                                                                         |
   |   0:OlapScanNode                                                            |
   |      TABLE: baseall                                                         |
   |      PREAGGREGATION: ON                                                     |
   |      partitions=1/1                                                         |
   |      rollup: baseall                                                        |
   |      tabletRatio=10/10                                                      |
   |      tabletList=12033,12035,12037,12039,12041,12043,12045,12047,12049,12051 |
   |      cardinality=0                                                          |
   |      avgRowSize=0.0                                                         |
   |      numNodes=0                                                             |
   |      tuple ids: 0                                                           |
   +-----------------------------------------------------------------------------+
   91 rows in set (0.14 sec)
   ```
   
   profile:
   
   No data is processed in fragment 1 while the data sender of fragment 2 already send 12.00 B .
   
   ```
   Query:
     Summary:
       Query ID: 728affa5a2bc4808-b254b75ca1324f8c
       Start Time: 2020-04-29 19:19:43
       End Time: 2020-04-29 19:19:43
       Total: 42ms
       Query Type: Query
       Query State: EOF
       Doris Version: trunk
       User: root
       Default Db: default_cluster:test
       Sql Statement: select sum from (select sum(k1) sum from baseall)t1 where sum >  (select avg from (select min(k1) avg from baseall) t2 )
     Execution Profile 728affa5a2bc4808-b254b75ca1324f8c:(Active: 41.149ms, % non-child: 0.00%)
       Fragment 0:
         Instance 728affa5a2bc4808-b254b75ca1324f8e (host=TNetworkAddress(hostname:10.74.167.16, port:9060)):(Active: 6.517ms, % non-child: 0.00%)
            - MemoryLimit: 2.00 GB
            - BytesReceived: 24.00 B
            - PeakUsedReservation: 0.00 
            - SendersBlockedTimer: 0ns
            - DeserializeRowBatchTimer: 3.36us
            - PeakMemoryUsage: 52.01 KB
            - RowsProduced: 0
            - SendersBlockedTotalTimer(*): 0ns
            - AverageThreadTokens: 0.00
            - PeakReservation: 0.00 
            - FirstBatchArrivalWaitTime: 0ns
           BlockMgr:
              - BlocksCreated: 0
              - BlockWritesOutstanding: 0
              - BytesWritten: 0.00 
              - TotalEncryptionTime: 0ns
              - BufferedPins: 0
              - TotalReadBlockTime: 0ns
              - TotalBufferWaitTime: 0ns
              - BlocksRecycled: 0
              - TotalIntegrityCheckTime: 0ns
              - MaxBlockSize: 8.00 MB
           DataBufferSender (dst_fragment_instance_id=728affa5a2bc4808-b254b75ca1324f8e):
           CROSS_JOIN_NODE (id=5):(Active: 6.609ms, % non-child: 0.00%)
             ExecOption: Join Build-Side Prepared Asynchronously
              - BuildRows: 0
              - RowsReturned: 0
              - LeftChildRows: 1
              - LeftChildTime: 1.513us
              - MemoryUsed: 0.00 
              - BuildTime: 237ns
              - RowsReturnedRate: 0
             EXCHANGE_NODE (id=10):(Active: 1.957ms, % non-child: 0.00%)
                - ConvertRowBatchTime: 593ns
                - RowsReturned: 0
                - MemoryUsed: 0.00 
                - RowsReturnedRate: 0
           AGGREGATION_NODE (id=7):(Active: 6.517ms, % non-child: 0.00%)
              - GetResultsTime: 0ns
              - RowsReturned: 1
              - BuildTime: 2.429us
              - RowsRepartitioned: 0
              - NumRepartitions: 0
              - HTResizeTime: 0ns
              - MaxPartitionLevel: 0
              - SpilledPartitions: 0
              - LargestPartitionPercent: 0
              - PartitionsCreated: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 153
              - HashBuckets: 0
           EXCHANGE_NODE (id=6):(Active: 6.443ms, % non-child: 0.00%)
              - ConvertRowBatchTime: 657ns
              - RowsReturned: 1
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 155
       Fragment 1:
         Instance 728affa5a2bc4808-b254b75ca1324f90 (host=TNetworkAddress(hostname:10.74.167.16, port:9060)):(Active: 214.238us, % non-child: 0.00%)
            - MemoryLimit: 2.00 GB
            - BytesReceived: 0.00 
            - PeakUsedReservation: 0.00 
            - SendersBlockedTimer: 0ns
            - DeserializeRowBatchTimer: 0ns
            - PeakMemoryUsage: 44.00 KB
            - RowsProduced: 0
            - SendersBlockedTotalTimer(*): 0ns
            - AverageThreadTokens: 0.00
            - PeakReservation: 0.00 
            - FirstBatchArrivalWaitTime: 0ns
           BlockMgr:
              - BlocksCreated: 0
              - BlockWritesOutstanding: 0
              - BytesWritten: 0.00 
              - TotalEncryptionTime: 0ns
              - BufferedPins: 0
              - TotalReadBlockTime: 0ns
              - TotalBufferWaitTime: 0ns
              - BlocksRecycled: 0
              - TotalIntegrityCheckTime: 0ns
              - MaxBlockSize: 8.00 MB
           DataStreamSender (dst_id=10):(Active: 18.428us, % non-child: 0.00%)
              - OverallThroughput: 0.0 /sec
              - SerializeBatchTime: 0ns
              - IgnoreRows: 0
              - BytesSent: 0.00 
              - NetworkThroughput(*): 0.0 /sec
              - ThriftTransmitTime(*): 0ns
              - UncompressedRowBatchSize: 0.00 
           ASSERT_NUM_ROWS_NODE (id=4):(Active: 3.145us, % non-child: 0.00%)
              - RowsReturned: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 0
           AGGREGATION_NODE (id=9):(Active: 44.827us, % non-child: 0.00%)
              - GetResultsTime: 0ns
              - RowsReturned: 0
              - BuildTime: 0ns
              - RowsRepartitioned: 0
              - NumRepartitions: 0
              - HTResizeTime: 0ns
              - MaxPartitionLevel: 0
              - SpilledPartitions: 0
              - LargestPartitionPercent: 0
              - PartitionsCreated: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 0
              - HashBuckets: 0
           EXCHANGE_NODE (id=8):
              - ConvertRowBatchTime: 0ns
              - RowsReturned: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 0
       Fragment 2:
         Instance 728affa5a2bc4808-b254b75ca1324f8f (host=TNetworkAddress(hostname:10.74.167.16, port:9060)):(Active: 732.599us, % non-child: 0.00%)
            - MemoryLimit: 2.00 GB
            - PeakUsedReservation: 0.00 
            - PeakMemoryUsage: 60.00 KB
            - RowsProduced: 1
            - AverageThreadTokens: 0.00
            - PeakReservation: 0.00 
           BlockMgr:
              - BlocksCreated: 0
              - BlockWritesOutstanding: 0
              - BytesWritten: 0.00 
              - TotalEncryptionTime: 0ns
              - BufferedPins: 0
              - TotalReadBlockTime: 0ns
              - TotalBufferWaitTime: 0ns
              - BlocksRecycled: 0
              - TotalIntegrityCheckTime: 0ns
              - MaxBlockSize: 8.00 MB
           DataStreamSender (dst_id=8):(Active: 65.359us, % non-child: 0.00%)
              - OverallThroughput: 179.2978515625 KB/sec
              - SerializeBatchTime: 7.580us
              - IgnoreRows: 0
              - BytesSent: 12.00 B
              - NetworkThroughput(*): 0.0 /sec
              - ThriftTransmitTime(*): 0ns
              - UncompressedRowBatchSize: 12.00 B
           AGGREGATION_NODE (id=3):(Active: 649.172us, % non-child: 0.00%)
              - GetResultsTime: 0ns
              - RowsReturned: 1
              - BuildTime: 5.68us
              - RowsRepartitioned: 0
              - NumRepartitions: 0
              - HTResizeTime: 0ns
              - MaxPartitionLevel: 0
              - SpilledPartitions: 0
              - LargestPartitionPercent: 0
              - PartitionsCreated: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 1.54K /sec
              - HashBuckets: 0
           OLAP_SCAN_NODE (id=2):(Active: 487.241us, % non-child: 0.00%)
              - NumThread: 0
              - TotalRawReadTime(*): 0ns
              - CompressedBytesRead: 24.00 B
              - RowsPushedCondFiltered: 0
              - ScanRangesComplete: 0
              - ScanTime: 7.537us
              - BitmapIndexFilterTimer: 0ns
              - BitmapIndexFilterCount: 0
              - RowsStatsFiltered: 0
              - VectorPredEvalTime: 0ns
              - BlockSeekTime: 12.939us
              - RawRowsRead: 4
              - ScannerThreadsVoluntaryContextSwitches: 0
              - RowsDelFiltered: 0
              - IndexLoadTime: 40.32us
              - ScannerThreadsTotalWallClockTime: 0ns
                - MaterializeTupleTime(*): 0ns
                - ScannerThreadsUserTime: 0ns
                - ScannerThreadsSysTime: 0ns
              - MemoryUsed: 0.00 
              - TotalPagesNum: 0
              - RowsReturnedRate: 4.104K /sec
              - BlockLoadTime: 5.200us
              - CachedPagesNum: 0
              - BlocksLoad: 4
              - UncompressedBytesRead: 0.00 
              - RowsBloomFilterFiltered: 0
              - TabletCount : 10
              - RowsReturned: 2
              - ScannerThreadsInvoluntaryContextSwitches: 0
              - DecompressorTimer: 0ns
              - RowsVectorPredFiltered: 0
              - ReaderInitTime: 460.77us
              - RowsRead: 2
              - PerReadThreadRawHdfsThroughput: 0.0 /sec
              - BlockFetchTime: 120.814us
              - ShowHintsTime: 82.832us
              - TotalReadThroughput: 0.0 /sec
              - IOTimer: 9.622us
              - BytesRead: 8.00 B
              - BlockConvertTime: 2.744us
              - BlockSeekCount: 0
       Fragment 3:
         Instance 728affa5a2bc4808-b254b75ca1324f8d (host=TNetworkAddress(hostname:10.74.167.16, port:9060)):(Active: 549.390us, % non-child: 0.00%)
            - MemoryLimit: 2.00 GB
            - PeakUsedReservation: 0.00 
            - PeakMemoryUsage: 36.00 KB
            - RowsProduced: 1
            - AverageThreadTokens: 0.00
            - PeakReservation: 0.00 
           BlockMgr:
              - BlocksCreated: 0
              - BlockWritesOutstanding: 0
              - BytesWritten: 0.00 
              - TotalEncryptionTime: 0ns
              - BufferedPins: 0
              - TotalReadBlockTime: 0ns
              - TotalBufferWaitTime: 0ns
              - BlocksRecycled: 0
              - TotalIntegrityCheckTime: 0ns
              - MaxBlockSize: 8.00 MB
           DataStreamSender (dst_id=6):(Active: 57.883us, % non-child: 0.00%)
              - OverallThroughput: 404.9111328125 KB/sec
              - SerializeBatchTime: 2.666us
              - IgnoreRows: 0
              - BytesSent: 24.00 B
              - NetworkThroughput(*): 0.0 /sec
              - ThriftTransmitTime(*): 0ns
              - UncompressedRowBatchSize: 24.00 B
           AGGREGATION_NODE (id=1):(Active: 459.270us, % non-child: 0.00%)
              - GetResultsTime: 0ns
              - RowsReturned: 1
              - BuildTime: 5.967us
              - RowsRepartitioned: 0
              - NumRepartitions: 0
              - HTResizeTime: 0ns
              - MaxPartitionLevel: 0
              - SpilledPartitions: 0
              - LargestPartitionPercent: 0
              - PartitionsCreated: 0
              - MemoryUsed: 0.00 
              - RowsReturnedRate: 2.177K /sec
              - HashBuckets: 0
           OLAP_SCAN_NODE (id=0):(Active: 322.524us, % non-child: 0.00%)
              - NumThread: 0
              - TotalRawReadTime(*): 0ns
              - CompressedBytesRead: 24.00 B
              - RowsPushedCondFiltered: 0
              - ScanRangesComplete: 0
              - ScanTime: 4.911us
              - BitmapIndexFilterTimer: 0ns
              - BitmapIndexFilterCount: 0
              - RowsStatsFiltered: 0
              - VectorPredEvalTime: 0ns
              - BlockSeekTime: 6.843us
              - RawRowsRead: 4
              - ScannerThreadsVoluntaryContextSwitches: 0
              - RowsDelFiltered: 0
              - IndexLoadTime: 16.974us
              - ScannerThreadsTotalWallClockTime: 0ns
                - MaterializeTupleTime(*): 0ns
                - ScannerThreadsUserTime: 0ns
                - ScannerThreadsSysTime: 0ns
              - MemoryUsed: 0.00 
              - TotalPagesNum: 0
              - RowsReturnedRate: 6.201K /sec
              - BlockLoadTime: 1.582us
              - CachedPagesNum: 0
              - BlocksLoad: 4
              - UncompressedBytesRead: 0.00 
              - RowsBloomFilterFiltered: 0
              - TabletCount : 10
              - RowsReturned: 2
              - ScannerThreadsInvoluntaryContextSwitches: 0
              - DecompressorTimer: 0ns
              - RowsVectorPredFiltered: 0
              - ReaderInitTime: 306.152us
              - RowsRead: 2
              - PerReadThreadRawHdfsThroughput: 0.0 /sec
              - BlockFetchTime: 56.71us
              - ShowHintsTime: 46.216us
              - TotalReadThroughput: 0.0 /sec
              - IOTimer: 5.484us
              - BytesRead: 8.00 B
              - BlockConvertTime: 1.92us
              - BlockSeekCount: 0
   ```
   **Expected behavior**
   
   The result should be same as 
   
   ```
   select sum from (select sum(k1) sum from baseall)t1 where sum >  (select avg(k1) avg from baseall) ;
   ```
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org