use of io.prestosql.sql.tree.ShowColumns in project hetu-core by openlookeng.
the class HiveAstBuilder method visitDescribeTable.
@Override
public Node visitDescribeTable(HiveSqlParser.DescribeTableContext context) {
if (context.EXTENDED() != null) {
addDiff(DiffType.UNSUPPORTED, context.EXTENDED().getText(), "[EXTENDED] is not supported");
throw unsupportedError(ErrorType.UNSUPPORTED_STATEMENT, "Unsupported attribute: EXTENDED", context);
}
if (context.FORMATTED() != null) {
addDiff(DiffType.UNSUPPORTED, context.FORMATTED().getText(), "[FORMATTED] is not supported");
throw unsupportedError(ErrorType.UNSUPPORTED_STATEMENT, "Unsupported attribute: FORMATTED", context);
}
if (context.describeTableOption() != null) {
addDiff(DiffType.UNSUPPORTED, context.describeTableOption().getText(), "[DESCRIBE TABLE OPTION] is not supported");
throw unsupportedError(ErrorType.UNSUPPORTED_STATEMENT, "Unsupported Describe statement", context.describeTableOption());
}
String source = context.DESCRIBE() != null ? context.DESCRIBE().getText() : context.DESC().getText();
addDiff(DiffType.MODIFIED, source, "SHOW COLUMNS FROM", format("keyword: [%s] is updated to [SHOW COLUMNS FROM]", source.toUpperCase(ENGLISH)));
QualifiedName qualifiedName = QualifiedName.of(visit(context.describeName().identifier(), Identifier.class));
return new ShowColumns(getLocation(context), qualifiedName);
}
use of io.prestosql.sql.tree.ShowColumns in project hetu-core by openlookeng.
the class TestSqlParser method testShowColumns.
@Test
public void testShowColumns() {
assertStatement("SHOW COLUMNS FROM a", new ShowColumns(QualifiedName.of("a")));
assertStatement("SHOW COLUMNS FROM a.b", new ShowColumns(QualifiedName.of("a", "b")));
assertStatement("SHOW COLUMNS FROM \"awesome table\"", new ShowColumns(QualifiedName.of("awesome table")));
assertStatement("SHOW COLUMNS FROM \"awesome schema\".\"awesome table\"", new ShowColumns(QualifiedName.of("awesome schema", "awesome table")));
}
Aggregations