org.apache.calcite.runtime.Feature Java Examples

The following examples show how to use org.apache.calcite.runtime.Feature. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlValidatorFeatureTest.java    From calcite with Apache License 2.0 6 votes vote down vote up
protected void validateFeature(
    Feature feature,
    SqlParserPos context) {
  if (feature.equals(disabledFeature)) {
    CalciteException ex =
        new CalciteException(
            FEATURE_DISABLED,
            null);
    if (context == null) {
      throw ex;
    }
    throw new CalciteContextException(
        "location",
        ex,
        context.getLineNum(),
        context.getColumnNum(),
        context.getEndLineNum(),
        context.getEndColumnNum());
  }
}
 
Example #2
Source File: SqlValidatorFeatureTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
private void checkFeature(String sql, Feature feature) {
  // Test once with feature enabled:  should pass
  sql(sql).ok();

  // Test once with feature disabled:  should fail
  try {
    disabledFeature = feature;
    sql(sql).fails(FEATURE_DISABLED);
  } finally {
    disabledFeature = null;
  }
}
 
Example #3
Source File: SqlValidatorImpl.java    From Flink-CEPplus with Apache License 2.0 3 votes vote down vote up
/**
 * Validates that a particular feature is enabled. By default, all features
 * are enabled; subclasses may override this method to be more
 * discriminating.
 *
 * @param feature feature being used, represented as a resource instance
 * @param context parser position context for error reporting, or null if
 */
protected void validateFeature(
	Feature feature,
	SqlParserPos context) {
	// By default, do nothing except to verify that the resource
	// represents a real feature definition.
	assert feature.getProperties().get("FeatureDefinition") != null;
}
 
Example #4
Source File: SqlValidatorImpl.java    From flink with Apache License 2.0 3 votes vote down vote up
/**
 * Validates that a particular feature is enabled. By default, all features
 * are enabled; subclasses may override this method to be more
 * discriminating.
 *
 * @param feature feature being used, represented as a resource instance
 * @param context parser position context for error reporting, or null if
 */
protected void validateFeature(
	Feature feature,
	SqlParserPos context) {
	// By default, do nothing except to verify that the resource
	// represents a real feature definition.
	assert feature.getProperties().get("FeatureDefinition") != null;
}