MartijnVisser commented on a change in pull request #17839: URL: https://github.com/apache/flink/pull/17839#discussion_r755110746
########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format Review comment: ```suggestion # Parquet ``` ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. Review comment: This could imply that adding the dependency is necessary to make the DataStream API compatible with both batch & streaming mode :) I think we can remove this sentence. ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). Review comment: I'm wondering if it makes sense to include 'producing Flink rows' here. Doesn't Flink "just" support reading and writing Parquet files? Rows are just an intermediary concept of Flink itself? ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: Review comment: ```suggestion To use the format you need to add the Flink Parquet dependency to your project. ``` ########## File path: docs/content/docs/connectors/datastream/formats/text_files.md ########## @@ -0,0 +1,69 @@ +--- +title: "Text files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/text_files.html +- /apis/streaming/connectors/formats/text_files.html +--- +<!-- +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. +--> + + +# Text files format Review comment: I don't have a better suggestion, but I think `Text files format` is ambiguous. It could be CSV, JSON, AVRO etc. WDYT? ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing parquet records as flink Rows. We project the schema to read only certain fields ("f7", "f4" and "f99"). Review comment: ```suggestion In this example we create a DataStream-based application containing Parquet records as Flink Rows. We project the schema to read only certain fields ("f7", "f4" and "f99"). ``` ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear Review comment: ```suggestion After adding the dependency, you can read and write Parquet data in either the [Batch Execution Mode or Streaming Execution Mode]({{< ref "/docs/dev/datastream/execution_mode" >}}). ``` ########## File path: docs/content/docs/connectors/datastream/formats/text_files.md ########## @@ -0,0 +1,69 @@ +--- +title: "Text files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/text_files.html +- /apis/streaming/connectors/formats/text_files.html +--- +<!-- +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. +--> + + +# Text files format + +Flink supports reading from text lines from a file using `TextLineInputFormat`. This format uses Java's built-in InputStreamReader to decode the byte stream using various supported charset encodings. +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-connector-files >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing the lines of a text file as Strings. +There is no need for a watermark strategy as records do not contain event timestamps. Review comment: My feedback from earlier also applies to this paragraph. ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing parquet records as flink Rows. We project the schema to read only certain fields ("f7", "f4" and "f99"). +We read records by batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC +and the second boolean tells the format if the projected parquet fields names are to be interpreted in a case sensitive way. +There is no need for a watermark strategy as records do not contain event timestamps. + +```java +final LogicalType[] fieldTypes = + new LogicalType[] { + new DoubleType(), new IntType(), new VarCharType() + }; + +final ParquetColumnarRowInputFormat<FileSourceSplit> format = + new ParquetColumnarRowInputFormat<>( + new Configuration(), + RowType.of(fieldTypes, new String[] {"f7", "f4", "f99"}), + 500, + false, + true); +final FileSource<RowData> source = + FileSource.forBulkFileFormat(format, /* Flink Path */) + .build(); +final DataStream<RowData> stream = + env.fromSource(source, WatermarkStrategy.noWatermarks(), "file-source"); +``` + +**Continuous read example**: + +In this example we create a DataStream containing parquet records as flink Rows that will infinitely grow +as new files are added to the directory. We monitor for new files each second. +We project the schema to read only certain fields ("f7", "f4" and "f99"). +We read records by batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC +and the second boolean tells the format if the projected parquet fields names are to be interpreted in a case sensitive way. +There is no need for a watermark strategy as records do not contain event timestamps. Review comment: ```suggestion In this example we create a DataStream-based application containing Parquet records as Flink Rows that will infinitely grow as new files are added to the directory. We monitor for new files each second. We project the schema to read only certain fields ("f7", "f4" and "f99"). We read records in batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC, The second boolean instructs the application if the projected Parquet fields names are to be interpreted in a case sensitive way. There is no need for a watermark strategy as records do not contain event timestamps. ``` ########## File path: docs/content/docs/connectors/datastream/formats/text_files.md ########## @@ -0,0 +1,69 @@ +--- +title: "Text files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/text_files.html +- /apis/streaming/connectors/formats/text_files.html +--- +<!-- +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. +--> + + +# Text files format + +Flink supports reading from text lines from a file using `TextLineInputFormat`. This format uses Java's built-in InputStreamReader to decode the byte stream using various supported charset encodings. +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-connector-files >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing the lines of a text file as Strings. +There is no need for a watermark strategy as records do not contain event timestamps. + +```java +final FileSource<String> source = + FileSource.forRecordStreamFormat(new TextLineInputFormat(), /* Flink Path */) + .build(); +final DataStream<String> stream = + env.fromSource(source, WatermarkStrategy.noWatermarks(), "file-source"); +``` + +**Continuous read example**: +In this example, we create a DataStream containing the lines of text files as Strings that will infinitely grow +as new files are added to the directory. We monitor for new files each second. +There is no need for a watermark strategy as records do not contain event timestamps. Review comment: My feedback from earlier also applies to this paragraph. ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing parquet records as flink Rows. We project the schema to read only certain fields ("f7", "f4" and "f99"). +We read records by batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC Review comment: ```suggestion We read records in batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC. ``` ########## File path: docs/content/docs/connectors/datastream/formats/parquet.md ########## @@ -0,0 +1,99 @@ +--- +title: "Parquet files" +weight: 4 +type: docs +aliases: +- /dev/connectors/formats/parquet.html +- /apis/streaming/connectors/formats/parquet.html +--- +<!-- +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. +--> + + +# Parquet format + +Flink supports reading [parquet](https://parquet.apache.org/) files and producing [Flink rows](https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/types/Row.html). +To use that format you need to add the dependency below to your project: + +```xml +{{< artifact flink-parquet >}} +``` + +The DataStream API is now compatible with both batch and streaming execution modes. +And this format is compatible with the new Source that can be used in both modes. +Thus, you can use this format in two ways: +- Bounded read for batch mode +- Continuous read for streaming mode: monitors a directory for new files that appear + +**Bounded read example**: + +In this example we create a DataStream containing parquet records as flink Rows. We project the schema to read only certain fields ("f7", "f4" and "f99"). +We read records by batches of 500 records. The first boolean parameter specifies if timestamp columns need to be interpreted as UTC +and the second boolean tells the format if the projected parquet fields names are to be interpreted in a case sensitive way. Review comment: ```suggestion The second boolean instructs the application if the projected Parquet fields names are to be interpreted in a case sensitive way. ``` -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
