You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Thomas D'Silva (JIRA)" <ji...@apache.org> on 2014/07/13 01:51:04 UTC
[jira] [Comment Edited] (PHOENIX-1016) Support MINVALUE, MAXVALUE,
and CYCLE options in CREATE SEQUENCE
[ https://issues.apache.org/jira/browse/PHOENIX-1016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059954#comment-14059954 ]
Thomas D'Silva edited comment on PHOENIX-1016 at 7/12/14 11:49 PM:
-------------------------------------------------------------------
[~jamestaylor]
I tried changing ConnectionQueryServicesImpl to add columns to SYSTEM.SEQUENCE if the table already exists, but I am getting an exception in MetadataEndpointImpl.java
An exception is being thrown because the PTableType of SYSTEM.SEQUENCE is SYSTEM TABLE" whereas the PTableType of the mutation is "TABLE"
{code}
// server-side, except for indexing, we always expect the keyvalues to be standard KeyValues
PTableType expectedType = MetaDataUtil.getTableType(tableMetadata, GenericKeyValueBuilder.INSTANCE, new ImmutableBytesPtr());
// We said to drop a table, but found a view or visa versa
if (type != expectedType) {
return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
}
{code}
Do you know how I can fix this? I have attached a diff with my changes to ConnectionQueryServicesImpl
Thanks,
Thomas
was (Author: tdsilva):
[~jamestaylor]
I tried changing ConnectionQueryServicesImpl to add columns to SYSTEM.SEQUENCE if the table already exists, but I am getting an exception in MetadataEndpointImpl.java
{code}
if (type != expectedType) {
return new MetaDataMutationResult(MutationCode.TABLE_NOT_FOUND, EnvironmentEdgeManager.currentTimeMillis(), null);
}
{code}
> Support MINVALUE, MAXVALUE, and CYCLE options in CREATE SEQUENCE
> ----------------------------------------------------------------
>
> Key: PHOENIX-1016
> URL: https://issues.apache.org/jira/browse/PHOENIX-1016
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: Thomas D'Silva
> Attachments: PHOENIX-1016.3.0.patch, PHOENIX-1016.patch, PHOENIX-1016.v2.3.0.patch, PHOENIX-1016.v2.patch, diff.txt
>
>
> We currently don't support MINVALUE, MAXVALUE, and CYCLE options in CREATE SEQUENCE, but we should. See http://msdn.microsoft.com/en-us/library/ff878091.aspx for the syntax.
> I believe MINVALUE applies if the INCREMENT is negative while MAXVALUE applies otherwise. If the value of a sequence goes beyond MINVALUE/MAXVALUE, then:
> - if CYCLE is true, then the sequence value should start again at the START WITH value (or the MINVALUE if specified too? Not sure about this).
> - if CYCLE is false, then an exception should be thrown.
> To implement this:
> - make the grammar changes in PhoenixSQL.g
> - add member variables for MINVALUE, MAXVALUE, and CYCLE to CreateSequenceStatement
> - add the appropriate error checking and handle bind variables for these new options in CreateSequenceCompiler
> - modify the MetaDataClient.createSequence() call by passing along these new parameters.
> - same for ConnectionQueryServices.createSequence() call
> - same for Sequence.createSequence().
> - pass along these parameters as new KeyValues in the Append that constitutes the RPC call
> - act on these in the SequenceRegionObserver coprocessor as indicated above.
--
This message was sent by Atlassian JIRA
(v6.2#6252)