Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#Org.apache.calcite.sql.SqlCall' - 1 code snippet(s) found

 Sample 1. Code Sample / Example / Snippet of org.apache.calcite.sql.SqlCall

  public void checkIntervalConv(String sql, String expected) {

SqlValidator validator = getValidator();

final SqlCall n = (SqlCall) parseAndValidate(validator, sql);



SqlNode node = null;

for (int i = 0; i < n.operandCount(); i++) {

node = stripAs(n.operand(i));

if (node instanceof SqlCall) {

node = ((SqlCall) node).operand(0);

break;

}

}



assertNotNull(node);

SqlIntervalLiteral intervalLiteral = (SqlIntervalLiteral) node;

SqlIntervalLiteral.IntervalValue interval =

(SqlIntervalLiteral.IntervalValue) intervalLiteral.getValue();

long l =

interval.getIntervalQualifier().isYearMonth()

? SqlParserUtil.intervalToMonths(interval)

: SqlParserUtil.intervalToMillis(interval);

String actual = l + "";

assertEquals(expected, actual);

}


   Like      Feedback      org.apache.calcite.sql.SqlCall



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner