Skip to content

Commit

Permalink
PARQUET-2386: More consistent code style in parquet-mr (#1209)
Browse files Browse the repository at this point in the history
Apply more consistent style using linter and editor configuration
  • Loading branch information
amousavigourabi authored Nov 30, 2023
1 parent 6978753 commit 945836c
Show file tree
Hide file tree
Showing 807 changed files with 33,596 additions and 29,210 deletions.
29 changes: 28 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,40 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
trim_trailing_whitespace = true

[*.scala]
indent_size = 2

[*.java]
indent_size = 2
max_line_length = 120
ij_java_space_within_empty_method_parentheses = false
ij_java_blank_lines_before_method_body = 0
ij_java_keep_blank_lines_before_right_brace = 0
ij_java_space_before_annotation_array_initializer_left_brace = false
ij_java_space_before_array_initializer_left_brace = true
ij_java_layout_static_imports_separately = true
ij_java_insert_inner_class_imports = false
ij_java_use_single_class_imports = true
ij_java_continuation_indent_size = 4
ij_java_use_relative_indents = false
ij_java_keep_indents_on_empty_lines = false
ij_java_indent_case_from_switch = true
ij_java_do_not_indent_top_level_class_members = false
ij_java_keep_builder_methods_indents = true
ij_java_line_comment_add_space = true
ij_java_space_after_type_cast = true
ij_java_align_types_in_multi_catch = true
ij_java_space_after_comma_in_type_arguments = true
ij_java_blank_lines_around_method_in_interface = 1
ij_java_method_parameters_wrap = normal
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_replace_sum_lambda_with_method_ref = true
ij_java_spaces_around_lambda_arrow = true
ij_java_method_brace_style = end_of_line
ij_java_align_group_field_declarations = false
ij_java_imports_layout = $*,|,*

[*.yaml]
indent_size = 2
Expand All @@ -39,4 +67,3 @@ indent_size = 2
# Tab indentation (no size specified)
[Makefile]
indent_style = tab

20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
;
; Licensed to the Apache Software Foundation (ASF) under one
; or more contributor license agreements. See the NOTICE file
; distributed with this work for additional information
; regarding copyright ownership. The ASF licenses this file
; to you under the Apache License, Version 2.0 (the
; "License"); you may not use this file except in compliance
; with the License. You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing,
; software distributed under the License is distributed on an
; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
; KIND, either express or implied. See the License for the
; specific language governing permissions and limitations
; under the License.
;
* text eol=lf
core.autocrlf=false
29 changes: 18 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,32 @@ Make sure you have checked _all_ steps below.

### Jira

- [ ] 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-XXX
- 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).
- [ ] 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-XXX
- 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

- [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:

### 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"
- [ ] 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"

### Style
- [ ] My contribution adheres to the code style guidelines and Spotless passes.
- To apply the necessary changes, run the spotless:apply goal in Maven

### Documentation

- [ ] 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
- All the public functions and the classes in the PR contain Javadoc that explain what it does
12 changes: 6 additions & 6 deletions .github/workflows/ci-hadoop3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '17' ]
java: [ { setup: '8', maven: '1.8' }, { setup: '11', maven: '11' }, { setup: '17', maven: '17' } ]
codes: [ 'uncompressed,brotli', 'gzip,snappy' ]
name: Build Parquet with JDK ${{ matrix.java }} and ${{ matrix.codes }}
name: Build Parquet with JDK ${{ matrix.java.setup }} and ${{ matrix.codes }}

steps:
- uses: actions/checkout@master
- name: Set up JDK ${{ matrix.java }}
- name: Set up JDK ${{ matrix.java.setup }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
java-version: ${{ matrix.java.setup }}
- name: before_install
env:
CI_TARGET_BRANCH: $GITHUB_HEAD_REF
Expand All @@ -46,11 +46,11 @@ jobs:
run: |
EXTRA_JAVA_TEST_ARGS=$(mvn help:evaluate -Dexpression=extraJavaTestArgs -q -DforceStdout)
export MAVEN_OPTS="$MAVEN_OPTS $EXTRA_JAVA_TEST_ARGS"
mvn install --batch-mode -DskipTests=true -Dmaven.javadoc.skip=true -Dsource.skip=true -Djava.version=${{ matrix.java }}
mvn install --batch-mode -DskipTests=true -Dmaven.javadoc.skip=true -Dsource.skip=true -Djava.version=${{ matrix.java.maven }}
- name: verify
env:
TEST_CODECS: ${{ matrix.codes }}
JAVA_VERSION: ${{ matrix.java }}
JAVA_VERSION: ${{ matrix.java.setup }}
run: |
EXTRA_JAVA_TEST_ARGS=$(mvn help:evaluate -Dexpression=extraJavaTestArgs -q -DforceStdout)
export MAVEN_OPTS="$MAVEN_OPTS $EXTRA_JAVA_TEST_ARGS"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ class List3Levels {

/**
* Will validate the structure of the list
*
* @param list the Parquet List
*/
public List3Levels(GroupType list) {
if (list.getLogicalTypeAnnotation() != LogicalTypeAnnotation.listType() || list.getFields().size() != 1) {
if (list.getLogicalTypeAnnotation() != LogicalTypeAnnotation.listType()
|| list.getFields().size() != 1) {
throw new IllegalArgumentException("invalid list type: " + list);
}
this.list = list;
Type repeatedField = list.getFields().get(0);
if (repeatedField.isPrimitive() || !repeatedField.isRepetition(REPEATED) || repeatedField.asGroupType().getFields().size() != 1) {
if (repeatedField.isPrimitive()
|| !repeatedField.isRepetition(REPEATED)
|| repeatedField.asGroupType().getFields().size() != 1) {
throw new IllegalArgumentException("invalid list type: " + list);
}
this.repeated = repeatedField.asGroupType();
Expand All @@ -73,5 +77,4 @@ public GroupType getRepeated() {
public Type getElement() {
return element;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
*/
package org.apache.parquet.arrow.schema;

import static org.apache.parquet.schema.Type.Repetition.REPEATED;

import org.apache.parquet.schema.GroupType;
import org.apache.parquet.schema.LogicalTypeAnnotation;
import org.apache.parquet.schema.OriginalType;
import org.apache.parquet.schema.Type;

import static org.apache.parquet.schema.Type.Repetition.REPEATED;

/**
* Represents a standard 3 levels Parquet map
* - optional map
Expand All @@ -39,15 +38,19 @@ class Map3Levels {

/**
* Will validate the structure of the map
*
* @param map the Parquet map
*/
public Map3Levels(GroupType map) {
if (map.getLogicalTypeAnnotation() != LogicalTypeAnnotation.mapType() || map.getFields().size() != 1) {
if (map.getLogicalTypeAnnotation() != LogicalTypeAnnotation.mapType()
|| map.getFields().size() != 1) {
throw new IllegalArgumentException("invalid map type: " + map);
}
this.map = map;
Type repeatedField = map.getFields().get(0);
if (repeatedField.isPrimitive() || !repeatedField.isRepetition(REPEATED) || repeatedField.asGroupType().getFields().size() != 2) {
if (repeatedField.isPrimitive()
|| !repeatedField.isRepetition(REPEATED)
|| repeatedField.asGroupType().getFields().size() != 2) {
throw new IllegalArgumentException("invalid map key: " + map);
}
this.repeated = repeatedField.asGroupType();
Expand Down Expand Up @@ -82,5 +85,4 @@ public Type getKey() {
public Type getValue() {
return value;
}

}
Loading

0 comments on commit 945836c

Please sign in to comment.