/** * Mix-in interface for {@link SqlNode} that allows DDL commands to be * executed directly. * * <p>NOTE: Subject to change without notice. */ @Experimental public interface SqlExecutableStatement { void execute(CalcitePrepare.Context context); }
/** Whether to attempt to merge consecutive {@link Project} operators. * * <p>The default implementation returns {@code true}; * sub-classes may disable merge by overriding to return {@code false}. */ @Experimental protected boolean shouldMergeProject() { return true; }
/** * Returns whether the dialect supports VALUES in a sub-query with * and an "AS t(column, ...)" values to define column names. * * <p>Currently, only Oracle does not. For this, we generate "SELECT v0 AS c0, * v1 AS c1 ... UNION ALL ...". We may need to refactor this method when we * support VALUES for other dialects. */ @Experimental public boolean supportsAliasedValues() { return true; }
/** Whether to attempt to merge consecutive {@link Project} operators. * * <p>The default implementation returns {@code true}; * sub-classes may disable merge by overriding to return {@code false}. */ @Experimental protected boolean shouldMergeProject() { return true; }
/** * Returns whether the dialect supports VALUES in a sub-query with * and an "AS t(column, ...)" values to define column names. * * <p>Currently, only Oracle does not. For this, we generate "SELECT v0 AS c0, * v1 AS c1 ... UNION ALL ...". We may need to refactor this method when we * support VALUES for other dialects. */ @Experimental public boolean supportsAliasedValues() { return false; }
/** * Mix-in interface for {@link SqlNode} that allows DDL commands to be * executed directly. * * <p>NOTE: Subject to change without notice. */ @Experimental public interface SqlExecutableStatement { void execute(CalcitePrepare.Context context); }
@Experimental public V remove(String key) { return map.remove(key); } }
@Experimental public V remove(String key) { return map.remove(key); } }
@Experimental public final RelDataTypeFactory typeFactory;
/** Removes all entries that have the given case-sensitive key. * * @return Whether a value was removed */ @Experimental public boolean remove(String key, V value) { final List<V> list = map().get(key); if (list == null) { return false; } return list.remove(value); }
/** Removes all entries that have the given case-sensitive key. * * @return Whether a value was removed */ @Experimental public boolean remove(String key, V value) { final List<V> list = map().get(key); if (list == null) { return false; } return list.remove(value); }
@Experimental public boolean removeSubSchema(String name) { return subSchemaMap.remove(name) != null; }
@Experimental public boolean removeTable(String name) { return tableMap.remove(name) != null; }
@Experimental public boolean removeTable(String name) { return tableMap.remove(name) != null; }
@Experimental public boolean removeType(String name) { return typeMap.remove(name) != null; }
@Experimental public boolean removeSubSchema(String name) { return subSchemaMap.remove(name) != null; }
@Experimental public boolean removeType(String name) { return typeMap.remove(name) != null; }
@Experimental public boolean removeFunction(String name) { final FunctionEntry remove = nullaryFunctionMap.remove(name); if (remove == null) { return false; } functionMap.remove(name, remove); return true; }
@Experimental public boolean removeFunction(String name) { final FunctionEntry remove = nullaryFunctionMap.remove(name); if (remove == null) { return false; } functionMap.remove(name, remove); return true; }
/** * Implements the {@code .} (field access) operator on an object * whose type is not known until runtime. * * <p>A struct object can be represented in various ways by the * runtime and depends on the * {@link org.apache.calcite.adapter.enumerable.JavaRowFormat}. */ @Experimental public static Object structAccess(Object structObject, int index, String fieldName) { if (structObject == null) { return null; } if (structObject instanceof Object[]) { return ((Object[]) structObject)[index]; } else if (structObject instanceof List) { return ((List) structObject).get(index); } else if (structObject instanceof Row) { return ((Row) structObject).getObject(index); } else { Class<?> beanClass = structObject.getClass(); try { Field structField = beanClass.getDeclaredField(fieldName); return structField.get(structObject); } catch (NoSuchFieldException | IllegalAccessException ex) { throw RESOURCE.failedToAccessField(fieldName, beanClass.getName()).ex(ex); } } }