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

ASF GitHub Bot commented on PARQUET-1598:
-----------------------------------------

sekikn commented on pull request #652: PARQUET-1598: Make convert-csv work with 
the input filename which starts with a period or an numeric
URL: https://github.com/apache/parquet-mr/pull/652
 
 
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] My PR addresses the following [Parquet 
Jira](https://issues.apache.org/jira/browse/PARQUET/) issues and references 
them in the PR title. For example, "PARQUET-1234: My Parquet PR"
     - https://issues.apache.org/jira/browse/PARQUET-1598
     - In case you are adding a dependency, check if the license complies with 
the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   
   ### Tests
   
   - [x] My PR adds the following unit tests __OR__ does not need testing for 
this extremely good reason:
   
     - testConvertCSVCommandWithInputFileNameBeginningWithPeriod
     - testConvertCSVCommandWithInputFileNameBeginningWithNumeric
   
   ### Commits
   
   - [ ] My commits all reference Jira issues in their subject lines. In 
addition, my commits follow the guidelines from "[How to write a good git 
commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [x] In case of new functionality, my PR adds documentation that describes 
how to use it.
     - All the public functions and the classes in the PR contain Javadoc that 
explain what it does
   
 
----------------------------------------------------------------
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]


> Make convert-csv work with the input filename which starts with a period or 
> an numeric
> --------------------------------------------------------------------------------------
>
>                 Key: PARQUET-1598
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1598
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-cli
>            Reporter: Kengo Seki
>            Priority: Major
>              Labels: pull-request-available
>
> I ran parquet-cli's {{convert-csv}} with an input file which name starts with 
> a numeric character without {{--schema}} option and got the following error:
> {code}
> $ java -cp 'target/*:target/dependency/*' org.apache.parquet.cli.Main 
> convert-csv 0sample.csv -o sample.parquet
> Unknown error
> shaded.parquet.org.apache.avro.SchemaParseException: Illegal initial 
> character: 0sample
>       at shaded.parquet.org.apache.avro.Schema.validateName(Schema.java:1498)
>       at shaded.parquet.org.apache.avro.Schema.access$200(Schema.java:86)
>       at shaded.parquet.org.apache.avro.Schema$Name.<init>(Schema.java:645)
>       at shaded.parquet.org.apache.avro.Schema.createRecord(Schema.java:182)
>       at 
> shaded.parquet.org.apache.avro.SchemaBuilder$RecordBuilder.fields(SchemaBuilder.java:1805)
>       at 
> org.apache.parquet.cli.csv.AvroCSV.inferSchemaInternal(AvroCSV.java:158)
>       at 
> org.apache.parquet.cli.csv.AvroCSV.inferNullableSchema(AvroCSV.java:78)
>       at 
> org.apache.parquet.cli.commands.ConvertCSVCommand.run(ConvertCSVCommand.java:160)
>       at org.apache.parquet.cli.Main.run(Main.java:147)
>       at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
>       at org.apache.parquet.cli.Main.main(Main.java:177)
> {code}
> This is because that {{convert-csv}} uses the input file name as the name for 
> the output schema, while Avro requires its schema name to match the regex 
> pattern {{[A-Za-z_][A-Za-z0-9_]*}}.
> So users have to change the input file name or use the {{--schema}} option 
> explicitly, but it's not so obvious from the error message.
> It'd be nice if the message were improved, or the schema name were 
> automatically replaced with valid characters to avoid this problem.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to