[
https://issues.apache.org/jira/browse/BEAM-5274?focusedWorklogId=139924&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-139924
]
ASF GitHub Bot logged work on BEAM-5274:
----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Aug/18 23:58
Start Date: 30/Aug/18 23:58
Worklog Time Spent: 10m
Work Description: akedin commented on issue #6309: [BEAM-5274][SQL] Check
if iterator.hasNext
URL: https://github.com/apache/beam/pull/6309#issuecomment-417505481
@apilloud I assume you've looked at the updated PR.
> LGTM, but there is an implied // this should never happen here.
I don't think that's an implication with `.hasNext()`.
"`.hasNext()+.next()`" is the contract of the iterator interface and it's a
good practice to guard `.next()` with `.hasNext()`. In this case it's similar
to if you needed to check `if (counters.size() > 0)` before `counters.get(0)`,
which you probably want to always check unless there's clear guarantee of
non-emptiness. In this case there's no clear guarantee of the non-emptiness so
I think that it's correct to handle the emptiness. I don't know whether lack of
metrics always means that `count = 0`, but to me it seems reasonable to assume
this.
I agree that it's unclear from just reading this line of code what the
behavior of metrics is expected to be for an empty pipeline, or if there are
other cases when metrics can be empty. My opinion though is that ambiguity in
this case is caused by the fact that iterator is picked as an interface to
extract metrics and not by how we handle it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 139924)
Time Spent: 1h 20m (was: 1h 10m)
> Handle NoSuchElementException When select from an empty table and insert into
> another table
> -------------------------------------------------------------------------------------------
>
> Key: BEAM-5274
> URL: https://issues.apache.org/jira/browse/BEAM-5274
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: Major
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)