wgtmac commented on code in PR #3199:
URL: https://github.com/apache/parquet-java/pull/3199#discussion_r2057928127


##########
parquet-avro/src/main/java/org/apache/parquet/avro/ReflectClassValidator.java:
##########
@@ -0,0 +1,94 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.parquet.avro;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+abstract class ReflectClassValidator {
+
+  abstract void validate(String className);
+
+  static class PackageValidator extends ReflectClassValidator {
+
+    private final List<String> trustedPackagePrefixes = 
Stream.of(AvroConverters.SERIALIZABLE_PACKAGES)
+        .map(p -> p.endsWith(".") ? p : p + ".")
+        .collect(Collectors.toList());
+    private final boolean trustAllPackages =
+        trustedPackagePrefixes.size() == 1 && 
"*".equals(trustedPackagePrefixes.get(0));
+    // The primitive "class names" based on Class.isPrimitive()
+    private static final Set<String> PRIMITIVES = new HashSet<>(Arrays.asList(

Review Comment:
   Why do we need this?



##########
parquet-avro/README.md:
##########
@@ -26,21 +26,22 @@ Apache Avro integration
 
 ### Configuration for reading
 
-| Name                                    | Type      | Description            
                                              |
-|-----------------------------------------|-----------|----------------------------------------------------------------------|
-| `parquet.avro.data.supplier`            | `Class`   | The implementation of 
the interface org.apache.parquet.avro.AvroDataSupplier. Available 
implementations in the library: GenericDataSupplier, ReflectDataSupplier, 
SpecificDataSupplier.<br/>The default value is 
`org.apache.parquet.avro.SpecificDataSupplier` |
-| `parquet.avro.read.schema`              | `String`  | The Avro schema to be 
used for reading. It shall be compatible with the file schema. The file schema 
will be used directly if not set. |
-| `parquet.avro.projection`               | `String`  | The Avro schema to be 
used for projection.                           |
-| `parquet.avro.compatible`               | `boolean` | Flag for compatibility 
mode. `true` for materializing Avro `IndexedRecord` objects, `false` for 
materializing the related objects for either generic, specific, or reflect 
records.<br/>The default value is `true`. |
-| `parquet.avro.readInt96AsFixed`        | `boolean` | Flag for handling the 
`INT96` Parquet types. `true` for converting it to the `fixed` Avro type, 
`false` for not handling `INT96` types (throwing exception).<br/>The default 
value is `false`.<br/>**NOTE: The `INT96` Parquet type is deprecated. This 
option is only to support old data.** |
+| Name                                | Type      | Description                
                                                                                
                                                                                
                                                                                
                   |
+|-------------------------------------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `parquet.avro.data.supplier`        | `Class`   | The implementation of the 
interface org.apache.parquet.avro.AvroDataSupplier. Available implementations 
in the library: GenericDataSupplier, ReflectDataSupplier, 
SpecificDataSupplier.<br/>The default value is 
`org.apache.parquet.avro.SpecificDataSupplier`                               |
+| `parquet.avro.read.schema`          | `String`  | The Avro schema to be used 
for reading. It shall be compatible with the file schema. The file schema will 
be used directly if not set.                                                    
                                                                                
                    |
+| `parquet.avro.projection`           | `String`  | The Avro schema to be used 
for projection.                                                                 
                                                                                
                                                                                
                   |
+| `parquet.avro.compatible`           | `boolean` | Flag for compatibility 
mode. `true` for materializing Avro `IndexedRecord` objects, `false` for 
materializing the related objects for either generic, specific, or reflect 
records.<br/>The default value is `true`.                                       
                                   |
+| `parquet.avro.readInt96AsFixed`     | `boolean` | Flag for handling the 
`INT96` Parquet types. `true` for converting it to the `fixed` Avro type, 
`false` for not handling `INT96` types (throwing exception).<br/>The default 
value is `false`.<br/>**NOTE: The `INT96` Parquet type is deprecated. This 
option is only to support old data.** |
+| `parquet.avro.serializable.classes` | `String`  | List of the fully 
qualified class names separated by ',' that may be referenced from the Avro 
schema by "java-class" or "java-key-class" and are allowed to be loaded.        
                                                                                
                                |
 
 ### Configuration for writing
 
-| Name                                    | Type      | Description            
                                              |
-|-----------------------------------------|-----------|----------------------------------------------------------------------|
-| `parquet.avro.write.data.supplier`      | `Class`   | The implementation of 
the interface org.apache.parquet.avro.AvroDataSupplier. Available 
implementations in the library: GenericDataSupplier, ReflectDataSupplier, 
SpecificDataSupplier.<br/>The default value is 
`org.apache.parquet.avro.SpecificDataSupplier` |
-| `parquet.avro.schema`                   | `String`  | The Avro schema to be 
used for generating the Parquet schema of the file. |
-| `parquet.avro.write-old-list-structure` | `boolean` | Flag whether to write 
list structures in the old way (2 levels) or the new one (3 levels). When 
writing at 2 levels no null values are available at the element level.<br/>The 
default value is `true` |
-| `parquet.avro.add-list-element-records` | `boolean` | Flag whether to assume 
that any repeated element in the schema is a list element.<br/>The default 
value is `true`. |
-| `parquet.avro.write-parquet-uuid`       | `boolean` | Flag whether to write 
the [Parquet UUID logical 
type](https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#uuid)
 in case of an [Avro UUID 
type](https://avro.apache.org/docs/current/spec.html#UUID) is present.<br/>The 
default value is `false`. |
-| `parquet.avro.writeFixedAsInt96`    | `String` | Comma separated list of 
paths pointing to Avro schema elements which are to be converted to `INT96` 
Parquet types.<br/>The path is a `'.'` separated list of field names and does 
not contain the name of the schema nor the namespace. The type of the 
referenced schema elements must be `fixed` with the size of 12 
bytes.<br/>**NOTE: The `INT96` Parquet type is deprecated. This option is only 
to support old data.** |
+| Name                                    | Type      | Description            
                                                                                
                                                                                
                                                                                
                                                                                
                                                                      |

Review Comment:
   Could we avoid these irrelevant changes? Does IntelliJ IDEA format it 
automatically? 



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to