apache / apache/parquet-java

Class Summary does not provide a getter to return inputSchema

Abierto
#1,881 7 comentarios 0 reacciones 0 asignados Ver en GitHub
Component: Java Component: Parquet Priority: Critical Type: bug
Lenguaje dominante
Java
Estrellas
3.1k
Forks
1.6k
Merge medio
3 d 12 h
PR fusionados (30 d)
33

Descripción

In Pig code, https://github.com/apache/pig/blob/trunk/src/org/apache/pig/EvalFunc.java. A private number "inputSchemaInternal" represents the schema. Setter and Getter are also provided
```Java
316 private Schema inputSchemaInternal=null;

328 /**
329 * This method is for internal use. It is called by Pig core in both front-end
330 * and back-end to setup the right input schema for EvalFunc
331 */
332 public void setInputSchema(Schema input){
333 this.inputSchemaInternal=input;
334 }
335
336 /**
337 * This method is intended to be called by the user in {@link EvalFunc} to get the input
338 * schema of the EvalFunc
339 */
340 public Schema getInputSchema(){
341 return this.inputSchemaInternal;
342 }
```

In parquet-mr/parquet-pig/src/main/java/parquet/pig/summary/Summary.java, class Summary extends EvalFunc. It uses a new number called inputSchema(vs. inputSchemaInternal used in class EvalFunc in Pig) to represent schema and override setInputSchema(), but the class does not override getInputSchema() to return inputSchema.

```Java
51 public class Summary extends EvalFunc implements Algebraic {

54 private Schema inputSchema;

257 @Override
258 public void setInputSchema(Schema input) {
259 try {
260 // relation.bag.tuple
261 this.inputSchema=input.getField(0).schema.getField(0).schema;
262 saveSchemaToUDFContext();
263 } catch (FrontendException e) {
264 throw new RuntimeException("Usage: B = FOREACH (GROUP A ALL) GENERATE Summary(A); Can not get schema from " + input, e);
265 } catch (RuntimeException e) {
266 throw new RuntimeException("Usage: B = FOREACH (GROUP A ALL) GENERATE Summary(A); Can not get schema from "+input, e);
267 }
268 }
```

If setInputSchema() of class Summary is called, inputSchema is set. But if we call getInputSchema() afterwards, it will return the value of inputSchemaInternal, which can be still null.

**Reporter**: [Xiang Li](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=xiangli)
#### Related issues:
- [UT TestSummary failed with "java.lang.RuntimeException: Usage: B = FOREACH (GROUP A ALL) GENERATE Summary(A); Can not get schema from null" when Pig >=0.15](https://github.com/apache/parquet-java/issues/1853) (blocks)

**Note**: *This issue was originally created as [PARQUET-365](https://issues.apache.org/jira/browse/PARQUET-365). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza en parquet-pig/src/main/java/parquet/pig/summary/Summary.java, leyendo su campo inputSchema y el método sobrescrito setInputSchema junto con el getter de EvalFunc. Confirma el contexto existente de las pruebas relacionadas y, después, asegúrate de que las llamadas a getInputSchema devuelvan el esquema establecido por Summary; se considera terminado cuando el getter ya no devuelve un valor separado que no ha sido establecido.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
backend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.