Skip to content

Fix avro test failures in prestodb project#51

Closed
beinan wants to merge 1 commit intoprestodb:masterfrom
beinan:fix_avro_test_failure
Closed

Fix avro test failures in prestodb project#51
beinan wants to merge 1 commit intoprestodb:masterfrom
beinan:fix_avro_test_failure

Conversation

@beinan
Copy link
Member

@beinan beinan commented Sep 10, 2021

This pr is a cherry pick of https://github.com/apache/hive/pull/1715/commits
We fixed the compatibility issue which caused by Avro's NULL_DEFAULT_VALUE Many thanks to @shangxinli for his contribution in Hive project.
This PR will fix the avro test failures when we're using new version of avro. See the discussion here. prestodb/presto#16545. Quite a few new features of Iceberg connector is blocked by this one.

@shangxinli
Copy link
Contributor

Yeah, I agree. In that case, we have to shade I guess. Any suggestion on this solution?

@beinan
Copy link
Member Author

beinan commented Sep 10, 2021

Yeah, I agree. In that case, we have to shade I guess. Any suggestion on this solution?

Any chance to bump up the hive version in this project? then I think we only need to copy one class (the one you changed on hive)

But bump up hive would cause lots of other test failures, I had tried that actually

@shangxinli
Copy link
Contributor

@beinan What tests are still falling in your side? I just incorporated your change along with my change in Presto and see the tests that testAvro[1000] passed.
image

I also tried other falling tests that failed before and they also passed. Some tests on my local run still fail(test context not set for current thread)but they failed even without upgrading anything. I don't think it is related.

Do you think we can have a try with your current change? If yes, you can go ahead to land it, create the jar and I can see if my PR in Presto repo can succeed.

@shangxinli
Copy link
Contributor

@beinan Do you think we can release a snapshot version with your change and see if my PR can pass?

@beinan
Copy link
Member Author

beinan commented Sep 17, 2021

@beinan Do you think we can release a snapshot version with your change and see if my PR can pass?

@beinan What tests are still falling in your side? I just incorporated your change along with my change in Presto and see the tests that testAvro[1000] passed.
image

I also tried other falling tests that failed before and they also passed. Some tests on my local run still fail(test context not set for current thread)but they failed even without upgrading anything. I don't think it is related.

Do you think we can have a try with your current change? If yes, you can go ahead to land it, create the jar and I can see if my PR in Presto repo can succeed.

Really? I was so frustrated last week just because the tests kept failing. let me try to ping some other contributor who are more familiar hive and avro to review this PR. Many thanks for your help!

@beinan beinan changed the title [WIP]Fix avro test failures in prestodb project Fix avro test failures in prestodb project Sep 17, 2021
@beinan
Copy link
Member Author

beinan commented Sep 17, 2021

@zhenxiao could you help take a look? Thanks!


return prunedSchemas;
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Add new line

@shangxinli
Copy link
Contributor

Did you just copy those code? Any change on top of that?

@shangxinli
Copy link
Contributor

shangxinli commented Sep 24, 2021

Hi @beinan,

@zhenxiao might be very busy. Do you think we can release a SNAPSHOT version and then we can try it out on Presto? If no issues are found, we can go ahead to create a formal version release. What do you think?

I would like to move a little faster. Our Presto team push me several times to upstream the changes I made internally for parquet Column Index and Column Encryption that have been running in production for quite a while. Our Presto team suffers a lot from maintaining those changes as private. Since I open the PR 14960, it has been 1+ years and we cannot even upgrade the parquet version as the first step yet. We need your and communities' help to relieve their pain. Thanks a lot @beinan and the community!

cc @chliang71

Xinli Shang

@beinan
Copy link
Member Author

beinan commented Sep 24, 2021

Hi @beinan,

@zhenxiao might be very busy. Do you think we can release a SNAPSHOT version and then we can try it out on Presto? If no issues are found, we can go ahead to create a formal version release. What do you think?

I would like to move a little faster. Our Presto team push me several times to upstream the changes I made internally for parquet Column Index and Column Encryption that have been running in production for quite a while. Our Presto team suffers a lot from maintaining those changes as private. Since I open the PR 14960, it has been 1+ years and we cannot even upgrade the parquet version as the first step yet. We need your and communities' help to relieve their pain. Thanks a lot @beinan and the community!

cc @chliang71

Xinli Shang

@tdcmeehan @zhenxiao could you help take a look? this one have been blocked Xili for more than a year. Thanks!

@aweisberg is it possible for us to make a SNAPSHOT release? And do you happen to know if the presto CI would pick up the SNAPSHOT dependencies? because we wanna run the CI (includes the facebook integration test) of presto to make sure there is no other failures. Thanks!

@aweisberg
Copy link
Contributor

Presto CI will build with anything that is in maven because it is just running maven commands. I will try to upload a SNAPSHOT artifact with this change.

@aweisberg
Copy link
Contributor

Published a snapshot artifact off this branch https://pastebin.com/nJWfrAm8

@shangxinli
Copy link
Contributor

Just tried it out and the issue still exists. prestodb/presto#16545

Caused by: java.lang.NoSuchMethodError: org.apache.avro.Schema$Field.(Ljava/lang/String;Lorg/apache/avro/Schema;Ljava/lang/String;Lcom/facebook/presto/hive/$internal/org/codehaus/jackson/JsonNode;)V
at org.apache.hadoop.hive.serde2.avro.TypeInfoToSchema.createAvroField(TypeInfoToSchema.java:76)
at org.apache.hadoop.hive.serde2.avro.TypeInfoToSchema.convert(TypeInfoToSchema.java:61)
at org.apache.hadoop.hive.serde2.avro.AvroSerDe.getSchemaFromCols(AvroSerDe.java:179)
at org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:117)
at com.facebook.presto.hive.HiveWriteUtils.initializeSerializer(HiveWriteUtils.java:227)
at com.facebook.presto.hive.RecordFileWriter.(RecordFileWriter.java:102)
at com.facebook.presto.hive.HiveWriterFactory.createWriter(HiveWriterFactory.java:395)
at com.facebook.presto.hive.HivePageSink.getWriterIndexes(HivePageSink.java:491)
at com.facebook.presto.hive.HivePageSink.writePage(HivePageSink.java:360)
at com.facebook.presto.hive.HivePageSink.doAppend(HivePageSink.java:355)
at com.facebook.presto.hive.HivePageSink.lambda$appendPage$4(HivePageSink.java:341)
at com.facebook.presto.hive.authentication.HdfsAuthentication.lambda$doAs$0(HdfsAuthentication.java:24)
at com.facebook.presto.hive.authentication.NoHdfsAuthentication.doAs(NoHdfsAuthentication.java:23)
at com.facebook.presto.hive.authentication.HdfsAuthentication.doAs(HdfsAuthentication.java:23)
at com.facebook.presto.hive.HdfsEnvironment.doAs(HdfsEnvironment.java:86)
at com.facebook.presto.hive.HivePageSink.appendPage(HivePageSink.java:341)
at com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSink.appendPage(ClassLoaderSafeConnectorPageSink.java:66)
at com.facebook.presto.operator.TableWriterOperator.addInput(TableWriterOperator.java:338)
at com.facebook.presto.operator.Driver.processInternal(Driver.java:428)
at com.facebook.presto.operator.Driver.lambda$processFor$9(Driver.java:301)
at com.facebook.presto.operator.Driver.tryWithLock(Driver.java:722)
at com.facebook.presto.operator.Driver.processFor(Driver.java:294)
at com.facebook.presto.execution.SqlTaskExecution$DriverSplitRunner.processFor(SqlTaskExecution.java:1077)
at com.facebook.presto.execution.executor.PrioritizedSplitRunner.process(PrioritizedSplitRunner.java:162)
at com.facebook.presto.execution.executor.TaskExecutor$TaskRunner.run(TaskExecutor.java:599)
at com.facebook.presto.$gen.Presto_0_264_SNAPSHOT_4a44853__testversion____20211001_173033_4.run(Unknown Source)

@beinan
Copy link
Member Author

beinan commented Oct 5, 2021

Just tried it out and the issue still exists. prestodb/presto#16545

Caused by: java.lang.NoSuchMethodError: org.apache.avro.Schema$Field.(Ljava/lang/String;Lorg/apache/avro/Schema;Ljava/lang/String;Lcom/facebook/presto/hive/$internal/org/codehaus/jackson/JsonNode;)V at org.apache.hadoop.hive.serde2.avro.TypeInfoToSchema.createAvroField(TypeInfoToSchema.java:76) at org.apache.hadoop.hive.serde2.avro.TypeInfoToSchema.convert(TypeInfoToSchema.java:61) at org.apache.hadoop.hive.serde2.avro.AvroSerDe.getSchemaFromCols(AvroSerDe.java:179) at org.apache.hadoop.hive.serde2.avro.AvroSerDe.initialize(AvroSerDe.java:117) at com.facebook.presto.hive.HiveWriteUtils.initializeSerializer(HiveWriteUtils.java:227) at com.facebook.presto.hive.RecordFileWriter.(RecordFileWriter.java:102) at com.facebook.presto.hive.HiveWriterFactory.createWriter(HiveWriterFactory.java:395) at com.facebook.presto.hive.HivePageSink.getWriterIndexes(HivePageSink.java:491) at com.facebook.presto.hive.HivePageSink.writePage(HivePageSink.java:360) at com.facebook.presto.hive.HivePageSink.doAppend(HivePageSink.java:355) at com.facebook.presto.hive.HivePageSink.lambda$appendPage$4(HivePageSink.java:341) at com.facebook.presto.hive.authentication.HdfsAuthentication.lambda$doAs$0(HdfsAuthentication.java:24) at com.facebook.presto.hive.authentication.NoHdfsAuthentication.doAs(NoHdfsAuthentication.java:23) at com.facebook.presto.hive.authentication.HdfsAuthentication.doAs(HdfsAuthentication.java:23) at com.facebook.presto.hive.HdfsEnvironment.doAs(HdfsEnvironment.java:86) at com.facebook.presto.hive.HivePageSink.appendPage(HivePageSink.java:341) at com.facebook.presto.spi.connector.classloader.ClassLoaderSafeConnectorPageSink.appendPage(ClassLoaderSafeConnectorPageSink.java:66) at com.facebook.presto.operator.TableWriterOperator.addInput(TableWriterOperator.java:338) at com.facebook.presto.operator.Driver.processInternal(Driver.java:428) at com.facebook.presto.operator.Driver.lambda$processFor$9(Driver.java:301) at com.facebook.presto.operator.Driver.tryWithLock(Driver.java:722) at com.facebook.presto.operator.Driver.processFor(Driver.java:294) at com.facebook.presto.execution.SqlTaskExecution$DriverSplitRunner.processFor(SqlTaskExecution.java:1077) at com.facebook.presto.execution.executor.PrioritizedSplitRunner.process(PrioritizedSplitRunner.java:162) at com.facebook.presto.execution.executor.TaskExecutor$TaskRunner.run(TaskExecutor.java:599) at com.facebook.presto.$gen.Presto_0_264_SNAPSHOT_4a44853__testversion____20211001_173033_4.run(Unknown Source)

Looks like the line number is not alined with the code change in this PR. Any thoughts?
image

@ugurmeet
Copy link
Contributor

ugurmeet commented Oct 9, 2021

I think this is an issue with the avro version. The signature of the Field constructor in Avro 1.8.2 was

public Field(String name, Schema schema, String doc, JsonNode defaultValue) which the code in TypeInfoToSchema.java is looking for. But in avro 1.9 this signature has changed to

public Field(String name, Schema schema, String doc, Object defaultValue)

So, we need the change in TypeInfoToSchema.java as done in trino to cast the last argument as type Object.

cc @beinan , @shangxinli

@ugurmeet
Copy link
Contributor

ugurmeet commented Oct 9, 2021

Also, the TypeInfoToSchema.java here seems to be from the 3.1 hive. Maybe we should use the TypeInfoToSchema.java (and other files) from the 3.0 hive and patch them up to have this change and the fix that I mentioned in my previous comment.

@shangxinli
Copy link
Contributor

@beinan, @ugurmeet has been working on this internally. If you are OK, he is going to create a separate PR to fix this issue.

@beinan
Copy link
Member Author

beinan commented Oct 14, 2021

@beinan, @ugurmeet has been working on this internally. If you are OK, he is going to create a separate PR to fix this issue.

closing this PR, and looking forward to your new PR!

@beinan beinan closed this Oct 14, 2021
@ugurmeet ugurmeet mentioned this pull request Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants