You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/03 14:45:00 UTC
[jira] [Commented] (PHOENIX-6596) Schema extraction double quotes expressions, resulting in un-executabe create statements
[ https://issues.apache.org/jira/browse/PHOENIX-6596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17453056#comment-17453056 ]
ASF GitHub Bot commented on PHOENIX-6596:
-----------------------------------------
richardantal commented on pull request #1354:
URL: https://github.com/apache/phoenix/pull/1354#issuecomment-985576450
@Test
public void testCreateLocalIndexStatementLowerCase() throws Exception {
String tableName = generateUniqueName();
String schemaName = generateUniqueName();
String indexName = generateUniqueName();
String properties = "TTL=2592000,IMMUTABLE_ROWS=true,DISABLE_WAL=true";
String pTableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName);
String createTableStatement = "CREATE TABLE "+pTableFullName + "(k VARCHAR NOT NULL PRIMARY KEY, \"v1\" VARCHAR, v2 VARCHAR)"
+ properties;
String createIndexStatement = "CREATE LOCAL INDEX "+indexName + " ON "+pTableFullName+"( LPAD(\"v1\",10) DESC, k) INCLUDE (v2)";
List<String> queries = new ArrayList<String>(){};
queries.add(createTableStatement);
queries.add(createIndexStatement);
String result = runSchemaExtractionTool(schemaName, indexName, null, queries);
Assert.assertEquals(createIndexStatement, result);
}
@Test
public void testCreateIndexStatementLowerCaseCombined() throws Exception {
String tableName = "lowercase" + generateUniqueName();
String schemaName = "lowercase" + generateUniqueName();
String indexName = "\"lowercaseIND" + generateUniqueName() + "\"";
String properties = "TTL=2592000,IMMUTABLE_ROWS=true,DISABLE_WAL=true";
String pTableFullName = SchemaUtil.getEscapedTableName(schemaName, tableName);
String createTableStatement = "CREATE TABLE " + pTableFullName + "(id varchar primary key, \"number\" integer, currency decimal(6,2), lista varchar[])"
+ properties;
String createIndexStatement = "CREATE INDEX " + indexName + " ON "+ pTableFullName + "(\"number\" * currency, id) INCLUDE (LISTA)";
List<String> queries = new ArrayList<String>(){};
queries.add(createTableStatement);
queries.add(createIndexStatement);
String result = runSchemaExtractionTool("\"" + schemaName + "\"", indexName, null, queries);
Assert.assertEquals(createIndexStatement, result);
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
> Schema extraction double quotes expressions, resulting in un-executabe create statements
> ----------------------------------------------------------------------------------------
>
> Key: PHOENIX-6596
> URL: https://issues.apache.org/jira/browse/PHOENIX-6596
> Project: Phoenix
> Issue Type: Bug
> Components: core
> Affects Versions: 4.17.0, 5.2.0, 4.16.2, 5.1.3
> Reporter: Istvan Toth
> Priority: Major
>
> {noformat}
> create table data (id varchar primary key, number integer,currency decimal(6,2),
> lista varchar[]);
> create index data_index on data (currency*number) INCLUDE (LISTA);
> show create table data_index;
> +-----------------------------------------------------------------------------+
> | CREATE STATEMENT |
> +-----------------------------------------------------------------------------+
> | CREATE INDEX DATA_INDEX ON DATA("(CURRENCY * NUMBER)", ID) INCLUDE (LISTA) |
> +-----------------------------------------------------------------------------+
> {noformat}
> The create statement double quotes the expression, and cannot be executed directly.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)