You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "chener (Jira)" <ji...@apache.org> on 2020/12/18 03:27:00 UTC
[jira] [Created] (CALCITE-4442) Incompatible types:
org.apache.calcite.sql. parser.Span can not cast to
org.apache.calcite.sql.parser.SqlParserPos
chener created CALCITE-4442:
-------------------------------
Summary: Incompatible types: org.apache.calcite.sql. parser.Span can not cast to org.apache.calcite.sql.parser.SqlParserPos
Key: CALCITE-4442
URL: https://issues.apache.org/jira/browse/CALCITE-4442
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.18.0
Environment: Here is my code:
{code:java}
// code for parserImpls.ftl
SqlAlter SqlAlterTableRename(SqlParserPos pos, String scope) :
{
final SqlIdentifier oldTableName;
final SqlIdentifier newTableName;
}
{
<TABLE> oldTableName = CompoundIdentifier()
<RENAME> <TO> newTableName = CompoundIdentifier()
{
return new SqlAlterTableRename(pos,scope,oldTableName,newTableName) ;
}
}
{code}
{code:java}
// code for SqlAlterTableRename class
package org.apache.calcite.sql;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.util.ImmutableNullableList;
import java.util.List;
public class SqlAlterTableRename extends SqlAlter{
private SqlIdentifier oldTableName;
private SqlIdentifier newTableName;
public SqlIdentifier getOldTableName() {
return oldTableName;
}
public SqlIdentifier getNewTableName() {
return newTableName;
}
private static final SqlOperator OPERATOR =
new SqlSpecialOperator("ALTER TABLE RENAME", SqlKind.ALTER_TABLE);
public SqlAlterTableRename(SqlParserPos pos) {
super(pos);
}
public SqlAlterTableRename(SqlParserPos pos, String scope) {
super(pos, scope);
}
public SqlAlterTableRename(SqlParserPos pos, String scope,SqlIdentifier oldTableName,SqlIdentifier newTableName) {
super(pos, scope);
this.oldTableName = oldTableName;
this.newTableName = newTableName;
}
@Override
protected void unparseAlterOperation(SqlWriter writer, int leftPrec, int rightPrec) {
writer.keyword("ALTER");
writer.keyword("TABLE");
writer.print(oldTableName.toString());
writer.keyword("RENAME");
writer.keyword("TO");
writer.print(newTableName.toString());
}
@Override
public SqlOperator getOperator() {
return OPERATOR;
}
@Override
public List<SqlNode> getOperandList() {
return ImmutableNullableList.of(oldTableName,newTableName);
}
}
{code}
Reporter: chener
When i am extending a customer sql parser which to resolve ALTER TABLE statement,I got this error when compile:
{quote}
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/workspace/java/dtstack/test/calcite-test/target/generated-sources/org/apache/calcite/sql/parser/impl/SqlAlterParserImpl.java:[3673,39] 不兼容的类型: org.apache.calcite.sql.
parser.Span无法转换为org.apache.calcite.sql.parser.SqlParserPos
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.905 s
[INFO] Finished at: 2020-12-17T21:20:36+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project calcite-test: Compilation failure
[ERROR] /C:/workspace/java/dtstack/test/calcite-test/target/generated-sources/org/apache/calcite/sql/parser/impl/SqlAlterParserImpl.java:[3673,39] 不兼容的类型: org.apache.calcite.sql.
parser.Span无法转换为org.apache.calcite.sql.parser.SqlParserPos
{quote}
undefined
--
This message was sent by Atlassian Jira
(v8.3.4#803005)