Search in sources :

Example 6 with QualifiedNameReference

use of io.crate.sql.tree.QualifiedNameReference in project crate by crate.

the class TestStatementBuilder method testCaseSensitivity.

@Test
public void testCaseSensitivity() {
    Expression expression = SqlParser.createExpression("\"firstName\" = 'myName'");
    QualifiedNameReference nameRef = (QualifiedNameReference) ((ComparisonExpression) expression).getLeft();
    StringLiteral myName = (StringLiteral) ((ComparisonExpression) expression).getRight();
    assertThat(nameRef.getName().getSuffix(), is("firstName"));
    assertThat(myName.getValue(), is("myName"));
    expression = SqlParser.createExpression("FIRSTNAME = 'myName'");
    nameRef = (QualifiedNameReference) ((ComparisonExpression) expression).getLeft();
    assertThat(nameRef.getName().getSuffix(), is("firstname"));
    expression = SqlParser.createExpression("ABS(1)");
    QualifiedName functionName = ((FunctionCall) expression).getName();
    assertThat(functionName.getSuffix(), is("abs"));
}
Also used : ArrayComparisonExpression(io.crate.sql.tree.ArrayComparisonExpression) ComparisonExpression(io.crate.sql.tree.ComparisonExpression) EscapedCharStringLiteral(io.crate.sql.tree.EscapedCharStringLiteral) StringLiteral(io.crate.sql.tree.StringLiteral) SubqueryExpression(io.crate.sql.tree.SubqueryExpression) SubscriptExpression(io.crate.sql.tree.SubscriptExpression) ParameterExpression(io.crate.sql.tree.ParameterExpression) ArrayComparisonExpression(io.crate.sql.tree.ArrayComparisonExpression) Expression(io.crate.sql.tree.Expression) ComparisonExpression(io.crate.sql.tree.ComparisonExpression) NegativeExpression(io.crate.sql.tree.NegativeExpression) QualifiedName(io.crate.sql.tree.QualifiedName) FunctionCall(io.crate.sql.tree.FunctionCall) QualifiedNameReference(io.crate.sql.tree.QualifiedNameReference) Test(org.junit.Test)

Aggregations

QualifiedNameReference (io.crate.sql.tree.QualifiedNameReference)6 Expression (io.crate.sql.tree.Expression)4 QualifiedName (io.crate.sql.tree.QualifiedName)3 Symbol (io.crate.expression.symbol.Symbol)2 ColumnIdent (io.crate.metadata.ColumnIdent)2 ArrayComparisonExpression (io.crate.sql.tree.ArrayComparisonExpression)2 ComparisonExpression (io.crate.sql.tree.ComparisonExpression)2 NegativeExpression (io.crate.sql.tree.NegativeExpression)2 ParameterExpression (io.crate.sql.tree.ParameterExpression)2 StringLiteral (io.crate.sql.tree.StringLiteral)2 SubqueryExpression (io.crate.sql.tree.SubqueryExpression)2 SubscriptExpression (io.crate.sql.tree.SubscriptExpression)2 Test (org.junit.Test)2 OrderBy (io.crate.analyze.OrderBy)1 ExpressionAnalysisContext (io.crate.analyze.expressions.ExpressionAnalysisContext)1 ColumnUnknownException (io.crate.exceptions.ColumnUnknownException)1 AlterBlobTable (io.crate.sql.tree.AlterBlobTable)1 AlterTable (io.crate.sql.tree.AlterTable)1 ArithmeticExpression (io.crate.sql.tree.ArithmeticExpression)1 ArraySliceExpression (io.crate.sql.tree.ArraySliceExpression)1