[ 
https://issues.apache.org/jira/browse/DRILL-7919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352086#comment-17352086
 ] 

ASF GitHub Bot commented on DRILL-7919:
---------------------------------------

vdiravka commented on a change in pull request #2232:
URL: https://github.com/apache/drill/pull/2232#discussion_r640131705



##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java
##########
@@ -318,6 +318,27 @@ protected void readField(long recordsToReadInThisPass) {
             }
           }
           break;
+        case FIXED_LEN_BYTE_ARRAY:
+        case BINARY:
+          if (usingDictionary) {
+            NullableVarDecimalVector.Mutator mutator = valueVec.getMutator();
+            for (int i = 0; i < recordsReadInThisIteration; i++) {
+              Binary currDictValToWrite = 
pageReader.dictionaryValueReader.readBytes();
+              mutator.setSafe(valuesReadInCurrentPass + i, 
currDictValToWrite.toByteBuffer().slice(), 0,
+                  currDictValToWrite.length());
+            }
+            // Set the write Index. The next page that gets read might be a 
page that does not use dictionary encoding
+            // and we will go into the else condition below. The readField 
method of the parent class requires the
+            // writer index to be set correctly.
+            int writerIndex = valueVec.getBuffer().writerIndex();
+            valueVec.getBuffer().setIndex(0, writerIndex + (int) readLength);
+          } else {
+            for (int i = 0; i < recordsToReadInThisPass; i++) {
+              Binary valueToWrite = pageReader.valueReader.readBytes();
+              valueVec.getMutator().setSafe(valuesReadInCurrentPass + i, 
valueToWrite.toByteBuffer().slice(), 0,

Review comment:
       Originally it was `valueVec.getMutator().setSafe(index, 1, start, start 
+ dataTypeLengthInBytes, bytebuf);`. Why it is different now?

##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/NullableFixedByteAlignedReaders.java
##########
@@ -318,6 +318,27 @@ protected void readField(long recordsToReadInThisPass) {
             }
           }
           break;
+        case FIXED_LEN_BYTE_ARRAY:
+        case BINARY:
+          if (usingDictionary) {

Review comment:
       Am I right, this is the main code to solve the ticket issue and all 
other changes from this PR are just refactoring?

##########
File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/columnreaders/ColumnReaderFactory.java
##########
@@ -252,91 +222,110 @@
     }
   }
 
-  public static NullableColumnReader<?> 
getNullableColumnReader(ParquetRecordReader parentReader,
+  public static ColumnReader<?> getNullableColumnReader(ParquetRecordReader 
parentReader,

Review comment:
       The method is names as `getNullableColumnReader`, so why the returned 
type is not `NullableColumnReader` anymore?




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


> NullReferenceException when reading optional Decimal(29,6) column from parquet
> ------------------------------------------------------------------------------
>
>                 Key: DRILL-7919
>                 URL: https://issues.apache.org/jira/browse/DRILL-7919
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Data Types
>    Affects Versions: 1.18.0
>         Environment: Running Apache Drill from docker using "FROM 
> apache/drill:latest"
> File is stored in Azure Blob Storage
>            Reporter: Nick Stenroos-Dam
>            Assignee: Vova Vysotskyi
>            Priority: Critical
>              Labels: decimal, optional, parquet, parquetReader
>         Attachments: latest.parquet
>
>
> When trying to read the column "RegHrs" from the attached parquet file, the 
> following exception is thrown:
> {noformat}
> 2021-05-05 10:19:57,717 [qtp1340625046-100] ERROR 
> o.a.d.e.server.rest.QueryResources - Query from Web UI Failed: {}
> org.apache.drill.common.exceptions.UserRemoteException: INTERNAL_ERROR ERROR: 
> nullFragment: 0:0Please, refer to logs for more information.[Error Id: 
> abe692c3-29a7-4a99-81ea-2c166538396b on 31c193952dc7:31010]
>       at 
> org.apache.drill.exec.server.rest.RestQueryRunner.submitQuery(RestQueryRunner.java:181)
>       at 
> org.apache.drill.exec.server.rest.RestQueryRunner.run(RestQueryRunner.java:70)
>       at 
> org.apache.drill.exec.server.rest.QueryResources.submitQueryJSON(QueryResources.java:96)
>       at 
> org.apache.drill.exec.server.rest.QueryResources.submitQuery(QueryResources.java:114)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at 
> org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
>       at 
> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
>       at 
> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
>       at 
> org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205)
>       at 
> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
>       at 
> org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
>       at 
> org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
>       at 
> org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
>       at 
> org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
>       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
>       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
>       at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
>       at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
>       at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
>       at 
> org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
>       at 
> org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
>       at 
> org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
>       at 
> org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
>       at 
> org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
>       at 
> org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
>       at 
> org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
>       at 
> org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1780)
>       at 
> org.apache.drill.exec.server.rest.header.ResponseHeadersSettingFilter.doFilter(ResponseHeadersSettingFilter.java:71)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
>       at 
> org.apache.drill.exec.server.rest.CsrfTokenValidateFilter.doFilter(CsrfTokenValidateFilter.java:55)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
>       at 
> org.apache.drill.exec.server.rest.CsrfTokenInjectFilter.doFilter(CsrfTokenInjectFilter.java:54)
>       at 
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1767)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:513)
>       at 
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
>       at org.eclipse.jetty.server.Server.handle(Server.java:539)
>       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
>       at 
> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
>       at 
> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
>       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
>       at 
> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
>       at 
> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.NullPointerException: 
>       at 
> org.apache.drill.exec.store.parquet.columnreaders.ParquetRecordReader.next(ParquetRecordReader.java:234)
>       at 
> org.apache.drill.exec.physical.impl.ScanBatch.internalNext(ScanBatch.java:234)
>       at 
> org.apache.drill.exec.physical.impl.ScanBatch.next(ScanBatch.java:298)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:111)
>       at 
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext(AbstractUnaryRecordBatch.java:59)
>       at 
> org.apache.drill.exec.physical.impl.limit.LimitRecordBatch.innerNext(LimitRecordBatch.java:93)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:170)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:111)
>       at 
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext(AbstractUnaryRecordBatch.java:59)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:170)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:119)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:111)
>       at 
> org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext(AbstractUnaryRecordBatch.java:59)
>       at 
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:85)
>       at 
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:170)
>       at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:103)
>       at 
> org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:81)
>       at 
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:93)
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:323)
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor$1.run(FragmentExecutor.java:310)
>       at .......(:0)
>       at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1730)
>       at 
> org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:310)
>       at 
> org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38)
>       at .......(:0){noformat}
> However if we leave out the column we can query the table.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to