GitHub user rahulforallp opened a pull request:
https://github.com/apache/carbondata/pull/2398 [CARBONDATA-2627] removed the dependency of tech.allegro.schema.json2avro Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [ ] Any interfaces changed? - [ ] Any backward compatibility impacted? - [ ] Document update required? - [ ] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required? - How it is tested? Please attach test report. - Is it a performance related change? Please attach the performance test report. - Any additional information to help reviewers in testing this change. - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. You can merge this pull request into a Git repository by running: $ git pull https://github.com/rahulforallp/incubator-carbondata jsonconverter Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/2398.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2398 ---- commit b44ba0474d715d35f73e2553d49c1d5220a7c8a5 Author: rahul <rahul.kumar@...> Date: 2018-06-22T06:35:32Z [CARBONDATA-2627] removed the dependency of tech.allegro.schema.json2avro ---- --- |
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2398 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6471/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2398 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5302/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2398 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6476/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2398 Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5307/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2398 SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5394/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2398 SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5398/ --- |
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197687131 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTable.scala --- @@ -1460,8 +1459,13 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll { } test("Read sdk writer Avro output Array Type with Default value") { - buildAvroTestDataSingleFileArrayDefaultType() - assert(new File(writerPath).exists()) + // avro1.8.x Parser donot handles default value , this willbe fixed in 1.9.x. So for now this + // will throw exception. After upgradation of Avro we can change this test case. --- End diff -- This test case is required. Along with this can you upgrade to Avro 1.9.X also ? We cannot have it as a separate activity. --- |
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197687383 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTable.scala --- @@ -2301,3 +2292,29 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll { checkAnswer(sql("select * from sdkOutputTable"), Seq(Row(Timestamp.valueOf("1970-01-02 16:00:00"), Row(Timestamp.valueOf("1970-01-02 16:00:00"))))) } } + + +object avroUtil{ + + def jsonToAvro(json: String, avroSchema: String): GenericRecord = { + var input: InputStream = null + var writer: DataFileWriter[GenericRecord] = null + var encoder: Encoder = null + var output: ByteArrayOutputStream = null + try { + val schema = new org.apache.avro.Schema.Parser().parse(avroSchema) + val reader = new GenericDatumReader[GenericRecord](schema) + input = new ByteArrayInputStream(json.getBytes()) --- End diff -- This is a duplicate code from SDKwriterTestCase.scala, can you move to one test util in core module call from both the places ? --- |
In reply to this post by qiuchenjian-2
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197687530 --- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/TestUtil.java --- @@ -17,20 +17,58 @@ package org.apache.carbondata.sdk.file; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.io.InputStream; import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.datastore.impl.FileFactory; import org.apache.carbondata.core.util.CarbonProperties; import org.apache.carbondata.core.util.path.CarbonTablePath; +import org.apache.avro.file.DataFileWriter; +import org.apache.avro.generic.GenericData; +import org.apache.avro.generic.GenericDatumReader; +import org.apache.avro.generic.GenericDatumWriter; +import org.apache.avro.io.DecoderFactory; +import org.apache.avro.io.Encoder; +import org.apache.avro.io.JsonDecoder; import org.junit.Assert; public class TestUtil { + public static GenericData.Record jsonToAvro(String json, String avroSchema) throws IOException { + InputStream input = null; + DataFileWriter writer = null; + Encoder encoder = null; + ByteArrayOutputStream output = null; + try { --- End diff -- This is the 3rd place same code. same comment as above. Move to core module test util file and try to reusue same. --- |
In reply to this post by qiuchenjian-2
Github user rahulforallp commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197826528 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTable.scala --- @@ -1460,8 +1459,13 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll { } test("Read sdk writer Avro output Array Type with Default value") { - buildAvroTestDataSingleFileArrayDefaultType() - assert(new File(writerPath).exists()) + // avro1.8.x Parser donot handles default value , this willbe fixed in 1.9.x. So for now this + // will throw exception. After upgradation of Avro we can change this test case. --- End diff -- community knows this issue , they said this will be fixed in 2.x version --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/2398 LGTM , Please handle @ajantha-bhat comments I will merge it. --- |
In reply to this post by qiuchenjian-2
Github user rahulforallp commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197852069 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTable.scala --- @@ -2301,3 +2292,29 @@ class TestNonTransactionalCarbonTable extends QueryTest with BeforeAndAfterAll { checkAnswer(sql("select * from sdkOutputTable"), Seq(Row(Timestamp.valueOf("1970-01-02 16:00:00"), Row(Timestamp.valueOf("1970-01-02 16:00:00"))))) } } + + +object avroUtil{ + + def jsonToAvro(json: String, avroSchema: String): GenericRecord = { + var input: InputStream = null + var writer: DataFileWriter[GenericRecord] = null + var encoder: Encoder = null + var output: ByteArrayOutputStream = null + try { + val schema = new org.apache.avro.Schema.Parser().parse(avroSchema) + val reader = new GenericDatumReader[GenericRecord](schema) + input = new ByteArrayInputStream(json.getBytes()) --- End diff -- test-cases are from two different packages , so we should write the util class separately. --- |
In reply to this post by qiuchenjian-2
Github user rahulforallp commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2398#discussion_r197852117 --- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/TestUtil.java --- @@ -17,20 +17,58 @@ package org.apache.carbondata.sdk.file; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; import java.io.File; import java.io.FileFilter; import java.io.IOException; +import java.io.InputStream; import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.datastore.impl.FileFactory; import org.apache.carbondata.core.util.CarbonProperties; import org.apache.carbondata.core.util.path.CarbonTablePath; +import org.apache.avro.file.DataFileWriter; +import org.apache.avro.generic.GenericData; +import org.apache.avro.generic.GenericDatumReader; +import org.apache.avro.generic.GenericDatumWriter; +import org.apache.avro.io.DecoderFactory; +import org.apache.avro.io.Encoder; +import org.apache.avro.io.JsonDecoder; import org.junit.Assert; public class TestUtil { + public static GenericData.Record jsonToAvro(String json, String avroSchema) throws IOException { + InputStream input = null; + DataFileWriter writer = null; + Encoder encoder = null; + ByteArrayOutputStream output = null; + try { --- End diff -- test-cases are from two different packages , so we should write the util class separately. --- |
In reply to this post by qiuchenjian-2
Github user rahulforallp commented on the issue:
https://github.com/apache/carbondata/pull/2398 done --- |
In reply to this post by qiuchenjian-2
|
Free forum by Nabble | Edit this page |