[
https://issues.apache.org/jira/browse/PHOENIX-3394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15633019#comment-15633019
]
ASF GitHub Bot commented on PHOENIX-3394:
-----------------------------------------
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.
> 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)