use of org.apache.flink.table.api.internal.TableEnvironmentImpl in project flink by apache.
the class ArrowUtils method isAppendOnlyTable.
private static boolean isAppendOnlyTable(Table table) {
if (isStreamingMode(table)) {
TableEnvironmentImpl tableEnv = (TableEnvironmentImpl) ((TableImpl) table).getTableEnvironment();
try {
OutputConversionModifyOperation modifyOperation = new OutputConversionModifyOperation(table.getQueryOperation(), TypeConversions.fromLegacyInfoToDataType(TypeExtractor.createTypeInfo(Row.class)), OutputConversionModifyOperation.UpdateMode.APPEND);
tableEnv.getPlanner().translate(Collections.singletonList(modifyOperation));
} catch (Throwable t) {
if (t.getMessage().contains("doesn't support consuming update") || t.getMessage().contains("Table is not an append-only table")) {
return false;
} else {
throw new RuntimeException("Failed to determine whether the given table is append only.", t);
}
}
}
return true;
}
Aggregations