[ 
https://issues.apache.org/jira/browse/PHOENIX-3394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15631632#comment-15631632
 ] 

ASF GitHub Bot commented on PHOENIX-3394:
-----------------------------------------

Github user maryannxue commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/220#discussion_r86287165
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java ---
    @@ -329,24 +333,14 @@ private TableRef fixTableMultiTenancy(TableRef 
tableRef) throws SQLException {
         
         private PhoenixSequence resolveSequence(String name) {
             try {
    -            // FIXME: Do this the same way as resolving a table after 
PHOENIX-2489.
    -            String tenantId = pc.getTenantId() == null ? null : 
pc.getTenantId().getString();
    -            String q = "select 1 from " + 
PhoenixDatabaseMetaData.SYSTEM_SEQUENCE
    -                    + " where " + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA
    -                    + (schemaName == null ? " is null" : " = '" + 
schemaName + "'")
    -                    + " and " + PhoenixDatabaseMetaData.SEQUENCE_NAME
    -                    + " = '" + name + "'"
    -                    + " and " + PhoenixDatabaseMetaData.TENANT_ID
    -                    + (tenantId == null ? " is null" : " = '" + tenantId + 
"'");
    -            ResultSet rs = pc.createStatement().executeQuery(q);
    -            if (rs.next()) {
    -                return new PhoenixSequence(schemaName, name, pc);
    -            }
    -        } catch (SQLException e) {
    -            throw new RuntimeException(e);
    +            SequenceManager manager = new 
SequenceManager((PhoenixStatement)pc.createStatement());
    +            manager.newSequenceReference(pc.getTenantId(), 
TableName.createNormalized(schemaName, name) , null, 
SequenceValueParseNode.Op.NEXT_VALUE);
    --- End diff --
    
    @JamesRTaylor Could you also take a look here to make sure that the method 
is called with right parameters? And is there a chance (and a need) we can 
avoid creating a new "Statement" each time?


> Handle SequenceResolving through ConnectionQueryServices interface
> ------------------------------------------------------------------
>
>                 Key: PHOENIX-3394
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3394
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Eric Lomore
>            Assignee: Eric Lomore
>
> Tons of unit tests have this same stack trace. It appears that this call 
> shouldn't reach ConnectionlessQueryServicesImpl.getTable?
> {code}
> Caused by: java.lang.UnsupportedOperationException
>       at 
> org.apache.phoenix.query.ConnectionlessQueryServicesImpl.getTable(ConnectionlessQueryServicesImpl.java:157)
>       at 
> org.apache.phoenix.query.DelegateConnectionQueryServices.getTable(DelegateConnectionQueryServices.java:70)
>       at 
> org.apache.phoenix.execute.MutationState.getHTable(MutationState.java:360)
>       at 
> org.apache.phoenix.iterate.TableResultIterator.<init>(TableResultIterator.java:101)
>       at 
> org.apache.phoenix.iterate.DefaultTableResultIteratorFactory.newIterator(DefaultTableResultIteratorFactory.java:33)
>       at 
> org.apache.phoenix.iterate.ParallelIterators.submitWork(ParallelIterators.java:104)
>       at 
> org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:871)
>       ... 71 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to