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

    https://github.com/apache/phoenix/pull/220#discussion_r86365551
  
    --- 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 --
    
    Good question. From my testing, passing in null doesn't work. A static 
member is an option if nothing else.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to