org.apache.flink.table.types.logical.utils.LogicalTypeDefaultVisitor Java Examples

The following examples show how to use org.apache.flink.table.types.logical.utils.LogicalTypeDefaultVisitor. 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: DataTypeUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
private static TableSchema expandCompositeType(FieldsDataType dataType) {
	DataType[] fieldDataTypes = dataType.getChildren().toArray(new DataType[0]);
	return dataType.getLogicalType().accept(new LogicalTypeDefaultVisitor<TableSchema>() {
		@Override
		public TableSchema visit(RowType rowType) {
			return expandCompositeType(rowType, fieldDataTypes);
		}

		@Override
		public TableSchema visit(StructuredType structuredType) {
			return expandCompositeType(structuredType, fieldDataTypes);
		}

		@Override
		public TableSchema visit(DistinctType distinctType) {
			return distinctType.getSourceType().accept(this);
		}

		@Override
		protected TableSchema defaultMethod(LogicalType logicalType) {
			throw new IllegalArgumentException("Expected a composite type");
		}
	});
}