Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BitSail][Improve]Add more debugging log for the NativeFlinkTypeInfoUtil. #417

Open
1 of 2 tasks
hk-lrzy opened this issue Feb 24, 2023 · 4 comments
Open
1 of 2 tasks
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@hk-lrzy
Copy link
Collaborator

hk-lrzy commented Feb 24, 2023

Description

public class NativeFlinkTypeInfoUtil {
...
  public static RowTypeInfo getRowTypeInformation(List<ColumnInfo> columnInfos,
                                                  TypeInfoConverter typeInfoConverter) {

    String[] fieldNames = new String[columnInfos.size()];
    TypeInformation<?>[] fieldTypes = new TypeInformation[columnInfos.size()];

    for (int index = 0; index < columnInfos.size(); index++) {
      String type = StringUtils.lowerCase(columnInfos.get(index).getType());
      String name = columnInfos.get(index).getName();

      TypeInfo<?> typeInfo = typeInfoConverter.fromTypeString(type);

      fieldNames[index] = name;
      fieldTypes[index] = toNativeFlinkTypeInformation(typeInfo);
    }

    return new RowTypeInfo(fieldTypes, fieldNames);
  }
...
}

TypeInfo<?> typeInfo = typeInfoConverter.fromTypeString(type);
and

public class ColumnFlinkTypeInfoUtil {
  public static RowTypeInfo getRowTypeInformation(TypeInfoConverter converter,
                                                  List<ColumnInfo> columnInfos) {

    String[] fieldNames = new String[columnInfos.size()];
    TypeInformation<?>[] fieldTypes = new TypeInformation[columnInfos.size()];
    for (int index = 0; index < columnInfos.size(); index++) {
      String type = StringUtils.lowerCase(columnInfos.get(index).getType());
      String name = columnInfos.get(index).getName();

      TypeInfo<?> typeInfo = converter.fromTypeString(type);
      fieldNames[index] = name;
      fieldTypes[index] = toColumnFlinkTypeInformation(typeInfo);
    }

    return new RowTypeInfo(fieldTypes, fieldNames);
  }
}

TypeInfo<?> typeInfo = converter.fromTypeString(type);

Both the classes have the same issue of lack the validation for the result of the converter.fromTypeString(type) and cause if there return null value the logic will throw NPE. IMO it is not clearly enough for all users to know what's hapened and how to solve it.

Your use scenarios

No response

Your alternatives

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@hk-lrzy hk-lrzy added bug Something isn't working good first issue Good for newcomers labels Feb 24, 2023
@beyond-up
Copy link
Contributor

please assign this issue to me, thanks!

@hk-lrzy
Copy link
Collaborator Author

hk-lrzy commented Feb 24, 2023

@beyond-up Assigned it to you, look foward to your PR later~

beyond-up added a commit to beyond-up/bitsail that referenced this issue Feb 28, 2023
@liuxiaocs7
Copy link
Contributor

@hk-lrzy @lichang-bd This issue seems can be closed.

@swikarpat
Copy link

swikarpat commented Nov 14, 2024

Is this issue resolved already? I can work on this issue if not done yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants