ccciudatu commented on a change in pull request #13572: URL: https://github.com/apache/beam/pull/13572#discussion_r547989936
########## File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/SqlRows.java ########## @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.beam.sdk.util; + +import static org.apache.beam.sdk.util.Preconditions.checkArgumentNotNull; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import org.apache.beam.sdk.coders.Coder; +import org.apache.beam.sdk.schemas.Schema; +import org.apache.beam.sdk.schemas.SchemaProvider; +import org.apache.beam.sdk.transforms.ProcessFunction; +import org.apache.beam.sdk.transforms.SerializableFunction; +import org.apache.beam.sdk.transforms.SimpleFunction; +import org.apache.beam.sdk.values.Row; +import org.apache.beam.sdk.values.TypeDescriptor; + +public final class SqlRows { Review comment: It's just a tiny step towards whatever abstractions we want to end up with, as it doesn't even cover Avro yet. I'm still trying to wrap my head around how would a proper data format abstraction look like in Beam. I mean, instead of `FileIO`, `AvroIO`, `KafkaIO`, `ThriftIO` plus Kafka tables for each data format, what if we took the format out of the IO as an entirely different concern and provide the ability to mix those freely. If IOs are just `[File, Kafka, PubSub, Socket, whatever]`, and data formats are `[Avro, Protobuf, CSV, Thrift, whatever]`, we can (in theory) allow any combination like PubSub+Thrift or File+Proto with no extra cost (except for incompatible candidates, like Kafka+parquet, perhaps). Do you think this is worth considering (for 3.0, of course)? I am aware that such an abstraction is really difficult to get right (if at all feasible), but I still think it may be worth trying, as we should at least end up reducing the number of data_source+data_format combinations that are now modelled as new datasource types. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
