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.validate.SqlValidator' - 4 code snippet(s) found

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

  public void checkMonotonic(String query,

SqlMonotonicity expectedMonotonicity) {

SqlValidator validator = getValidator();

SqlNode n = parseAndValidate(validator, query);

final RelDataType rowType = validator.getValidatedNodeType(n);

final SqlValidatorNamespace selectNamespace = validator.getNamespace(n);

final String field0 = rowType.getFieldList().get(0).getName();

final SqlMonotonicity monotonicity =

selectNamespace.getMonotonicity(field0);

assertThat(monotonicity, equalTo(expectedMonotonicity));

}


   Like      Feedback      org.apache.calcite.sql.validate.SqlValidatorNamespace


 Sample 2. Code Sample / Example / Snippet of org.apache.calcite.sql.validate.SqlValidator

  public void checkFieldOrigin(String sql, String fieldOriginList) {

SqlValidator validator = getValidator();

SqlNode n = parseAndValidate(validator, sql);

final List<List<String>> list = validator.getFieldOrigins(n);

final StringBuilder buf = new StringBuilder("{");

int i = 0;

for (List<String> strings : list) {

if (i++ > 0) {

buf.append(", ");

}

if (strings == null) {

buf.append("null");

} else {

int j = 0;

for (String s : strings) {

if (j++ > 0) {

buf.append('.');

}

buf.append(s);

}

}

}

buf.append("}");

assertEquals(fieldOriginList, buf.toString());

}


   Like      Feedback      org.apache.calcite.sql.validate.SqlValidator


 Sample 3. Code Sample / Example / Snippet of org.apache.calcite.sql.validate.SqlValidatorScope

  public SqlMonotonicity getMonotonicity(String sql) {

final SqlValidator validator = getValidator();

final SqlNode node = parseAndValidate(validator, sql);

final SqlSelect select = (SqlSelect) node;

final SqlNode selectItem0 = select.getSelectList().get(0);

final SqlValidatorScope scope = validator.getSelectScope(select);

return selectItem0.getMonotonicity(scope);

}


   Like      Feedback      org.apache.calcite.sql.validate.SqlValidatorScope


 Sample 4. Code Sample / Example / Snippet of org.apache.calcite.sql.validate.SqlValidatorTable

    public RelOptTable getTableForMember(List<String> names) {

final SqlValidatorTable table = catalogReader.getTable(names);

final RelDataType rowType = table.getRowType();

final List<RelCollation> collationList = deduceMonotonicity(table);

if (names.size() < 3) {

String[] newNames2 = {"CATALOG", "SALES", ""};

List<String> newNames = new ArrayList<>();

int i = 0;

while (newNames.size() < newNames2.length) {

newNames.add(i, newNames2[i]);

++i;

}

names = newNames;

}

return createColumnSet(table, names, rowType, collationList);

}


   Like      Feedback      org.apache.calcite.sql.validate.SqlValidatorTable



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