Skip to content

ORC-1488: [Java] Mark getFileMetadata as deprecated - #1592

Closed
deshanxiao wants to merge 1 commit into
apache:mainfrom
deshanxiao:orc-1483-2
Closed

deshanxiao wants to merge 1 commit into
apache:mainfrom
deshanxiao:orc-1483-2

Conversation

@deshanxiao

@deshanxiao deshanxiao commented Aug 21, 2023 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR is aimed to mark getFileMetadata as deprecated.
This PR targets for ORC 1.9.x.
For ORC 2.0, please see #1588

Why are the changes needed?

1.FileMetadata has been marked as deprecated in ORC 1.6.0 Jira PR
2.FileMetadata does not have any class to implement it, and inside ORC apache1.9, getFileMetadata always returns null.

How was this patch tested?

Exist UT

@github-actions github-actions Bot added the JAVA label Aug 21, 2023
@deshanxiao

Copy link
Copy Markdown
Contributor Author

cc @mystic-lama @dongjoon-hyun

@paliwalashish paliwalashish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @deshanxiao . We need a new JIRA issue for this because the deprecation should happen in 1.9.x and the removal might happen in 2.0.x.

@dongjoon-hyun

Copy link
Copy Markdown
Member

Let me repeat once more.

  • Deprecation is not the same with Removal and Depreciation should happen before the actual removal to give the users enough preparation time .
  • Deprecation doesn't mean an automatic Removal. We don't know when Apache ORC become able to remove it yet.

@deshanxiao deshanxiao changed the title ORC-1483: [Java] Mark getFileMetadata as deprecated ORC-1488: [Java] Mark getFileMetadata as deprecated Aug 22, 2023
@deshanxiao

Copy link
Copy Markdown
Contributor Author

Yes I agree with you @dongjoon-hyun . Thank you for your reminder. I have created a new JIRA ORC-1488

@dongjoon-hyun dongjoon-hyun left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM . Thank you, @deshanxiao .

@dongjoon-hyun dongjoon-hyun added this to the 1.9.2 milestone Aug 22, 2023

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. The PR description seems to be misleading in another way. What do you want to mean by the following?

2.There is not any class implementing FileMetadata

Apache ORC 1.9 is still using it here, isn't it?

FileMetadata fileMetadata = options.getFileMetadata();

@deshanxiao

deshanxiao commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor Author

Oops. The PR description seems to be misleading in another way. What do you want to mean by the following?

2.There is not any class implementing FileMetadata

Apache ORC 1.9 is still using it here, isn't it?

FileMetadata fileMetadata = options.getFileMetadata();

The interface FileMetadata does not have any class to implement it and getFileMetadata always returns empty in ORC apache1.9.

@dongjoon-hyun

dongjoon-hyun commented Aug 22, 2023 •

Copy link
Copy Markdown
Member

What do you mean by empty?

FileMetadata does not have any class to implement it, and in ORC apache1.9, getFileMetadata always returns empty

If it means null, could you revise the PR description in that way? In addition, we can change the code like the following.

public FileMetadata getFileMetadata() {
   return null;
}

@deshanxiao

deshanxiao commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor Author

@dongjoon-hyun I have another point of view. After we figure out whether there is a downstream useful method to set filemeta, we should not reimplement it for compatibility reasons.

@dongjoon-hyun

dongjoon-hyun commented Aug 22, 2023 •

Copy link
Copy Markdown
Member

If we are not sure yet, we had better not touch this until we figure out it, @deshanxiao .

@deshanxiao

Copy link
Copy Markdown
Contributor Author

OK, actually FileMetadata has been marked as deprecated for so long. It confuses me. Let me find more evidence to verify it.

image

@dongjoon-hyun

Copy link
Copy Markdown
Member

Could you answer my question, #1592 (comment)?

@deshanxiao

deshanxiao commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor Author

Could you answer my question, #1592 (comment)?

@dongjoon-hyun Yes, I mean getFileMetadata always returns null inside ORC 1.9. Changed the PR description.

@deshanxiao

deshanxiao commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor Author

Unfortunately, hive implements FileMetadata interface which is not implemented in ORC, and also sets it:

Judging from its implementation and comments, Hive OrcFileMetadata extends ConsumerFileMetadata because FileMetadata lacks some information. But ORC have all of information it needs. This reminds us that we may need to reconsider the implementation of FileMetadata, or provide a new interface. @dongjoon-hyun

/** ORC file metadata. Currently contains some duplicate info due to how different parts
 * of ORC use different info. Ideally we would get rid of protobuf structs in code beyond reading,
 * or instead use protobuf structs everywhere instead of the mix of things like now.
 */
public final class OrcFileMetadata implements FileMetadata, ConsumerFileMetadata {
  private final List<StripeInformation> stripes;
  private final List<Integer> versionList;
  private final List<OrcProto.StripeStatistics> stripeStats;
  private final List<OrcProto.Type> types;
public interface ConsumerFileMetadata {
  int getStripeCount();
  CompressionKind getCompressionKind();
  List<Type> getTypes();
  TypeDescription getSchema() throws FileFormatException;
  OrcFile.Version getFileVersion();
  CalendarKind getCalendar();
}
    long startTime = counters.startTimeCounter();
    ReaderOptions opts = EncodedOrcFile.readerOptions(jobConf).filesystem(fsSupplier).fileMetadata(fileMetadata);
    if (split instanceof OrcSplit) {
      OrcTail orcTail = ((OrcSplit) split).getOrcTail();
      if (orcTail != null) {
        LlapIoImpl.ORC_LOGGER.debug("Setting OrcTail. path={}", path);
        opts.orcTail(orcTail);
      }
    }

https://github.com/apache/hive/blob/3d3acc7a19399d749a39818573a76a0dbbaf2598/llap-server/src/java/org/apache/hadoop/hive/llap/io/metadata/OrcFileMetadata.java#L39

@deshanxiao

Copy link
Copy Markdown
Contributor Author

Overall, main downstreams of Apache ORC that depend on FileMetadata are:

1.Apache Hive (OrcFileMetadata implements FileMetadata)
2.Apache Spark (None)
3.Apache Iceberg (None)

Apache ORC v1.9 and higher do not implement the interface FileMetadata and the reference in ReaderImpl.java will always be null.

@deshanxiao deshanxiao closed this Aug 23, 2023
@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you for the investigation and sharing, @deshanxiao .

@dongjoon-hyun dongjoon-hyun removed this from the 1.9.2 milestone Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants