Codota Logo
NullIfExpression.<init>
Code IndexAdd Codota to your IDE (free)

How to use
com.facebook.presto.sql.tree.NullIfExpression
constructor

Best Java code snippets using com.facebook.presto.sql.tree.NullIfExpression.<init> (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: prestodb/presto

return new NullIfExpression(toExpression(first, firstType), toExpression(second, secondType));
origin: prestodb/presto

check(!filter.isPresent(), "FILTER not valid for 'nullif' function", context);
return new NullIfExpression(
    getLocation(context),
    (Expression) visit(context.expression(0)),
origin: prestodb/presto

@Test
public void testNullIf()
{
  assertExpression("nullif(42, 87)", new NullIfExpression(new LongLiteral("42"), new LongLiteral("87")));
  assertExpression("nullif(42, null)", new NullIfExpression(new LongLiteral("42"), new NullLiteral()));
  assertExpression("nullif(null, null)", new NullIfExpression(new NullLiteral(), new NullLiteral()));
  assertInvalidExpression("nullif(1)", "Invalid number of arguments for 'nullif' function");
  assertInvalidExpression("nullif(1, 2, 3)", "Invalid number of arguments for 'nullif' function");
  assertInvalidExpression("nullif(42, 87) filter (where true)", "FILTER not valid for 'nullif' function");
  assertInvalidExpression("nullif(42, 87) OVER ()", "OVER clause not valid for 'nullif' function");
}
origin: prestodb/presto

@Test
public void testExpressionsThatMayReturnNullOnNonNullInput()
{
  List<Expression> candidates = ImmutableList.of(
      new Cast(nameReference("b"), "BIGINT", true), // try_cast
      new FunctionCall(QualifiedName.of("try"), ImmutableList.of(nameReference("b"))),
      new NullIfExpression(nameReference("b"), number(1)),
      new IfExpression(nameReference("b"), number(1), new NullLiteral()),
      new DereferenceExpression(nameReference("b"), identifier("x")),
      new InPredicate(nameReference("b"), new InListExpression(ImmutableList.of(new NullLiteral()))),
      new SearchedCaseExpression(ImmutableList.of(new WhenClause(new IsNotNullPredicate(nameReference("b")), new NullLiteral())), Optional.empty()),
      new SimpleCaseExpression(nameReference("b"), ImmutableList.of(new WhenClause(number(1), new NullLiteral())), Optional.empty()),
      new SubscriptExpression(new ArrayConstructor(ImmutableList.of(new NullLiteral())), nameReference("b")));
  for (Expression candidate : candidates) {
    EqualityInference.Builder builder = new EqualityInference.Builder();
    builder.extractInferenceCandidates(equals(nameReference("b"), nameReference("x")));
    builder.extractInferenceCandidates(equals(nameReference("a"), candidate));
    EqualityInference inference = builder.build();
    List<Expression> equalities = inference.generateEqualitiesPartitionedBy(matchesSymbols("b")).getScopeStraddlingEqualities();
    assertEquals(equalities.size(), 1);
    assertTrue(equalities.get(0).equals(equals(nameReference("x"), nameReference("b"))) || equalities.get(0).equals(equals(nameReference("b"), nameReference("x"))));
  }
}
origin: uk.co.nichesolutions.presto/presto-main

return new NullIfExpression(toExpression(first, firstType), toExpression(second, secondType));
origin: com.facebook.presto/presto-parser

check(!filter.isPresent(), "FILTER not valid for 'nullif' function", context);
return new NullIfExpression(
    getLocation(context),
    (Expression) visit(context.expression(0)),
origin: com.facebook.presto/presto-parser

@Test
public void testNullIf()
{
  assertExpression("nullif(42, 87)", new NullIfExpression(new LongLiteral("42"), new LongLiteral("87")));
  assertExpression("nullif(42, null)", new NullIfExpression(new LongLiteral("42"), new NullLiteral()));
  assertExpression("nullif(null, null)", new NullIfExpression(new NullLiteral(), new NullLiteral()));
  assertInvalidExpression("nullif(1)", "Invalid number of arguments for 'nullif' function");
  assertInvalidExpression("nullif(1, 2, 3)", "Invalid number of arguments for 'nullif' function");
  assertInvalidExpression("nullif(42, 87) filter (where true)", "FILTER not valid for 'nullif' function");
  assertInvalidExpression("nullif(42, 87) OVER ()", "OVER clause not valid for 'nullif' function");
}
origin: uk.co.nichesolutions.presto/presto-parser

check(!distinct, "DISTINCT not valid for 'nullif' function", context);
return new NullIfExpression(
    getLocation(context),
    (Expression) visit(context.expression(0)),
com.facebook.presto.sql.treeNullIfExpression<init>

Popular methods of NullIfExpression

  • getFirst
  • getSecond

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getSharedPreferences (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now