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

[Subtask] support float and double type for spark-connector #2451

Closed
FANNG1 opened this issue Mar 7, 2024 · 3 comments · Fixed by #2484
Closed

[Subtask] support float and double type for spark-connector #2451

FANNG1 opened this issue Mar 7, 2024 · 3 comments · Fixed by #2484
Assignees
Labels
good first issue Good for newcomers subtask Subtasks of umbrella issue

Comments

@FANNG1
Copy link
Contributor

FANNG1 commented Mar 7, 2024

Describe the subtask

should add related logic in SparkTypeConverter and add test in TestSparkTypeConverter
please refer below document
Spark date type: https://spark.apache.org/docs/latest/sql-ref-datatypes.html
Gravitino data type: https://datastrato.ai/docs/0.4.0/manage-metadata-using-gravitino#gravitino-table-column-type

current implement:

  public static Type toGravitinoType(DataType sparkType) {
    if (sparkType instanceof StringType) {
      return Types.StringType.get();
    } else if (sparkType instanceof BooleanType) {
      return Types.BooleanType.get();
    } else if (sparkType instanceof IntegerType) {
      return Types.IntegerType.get();
    }
    throw new UnsupportedOperationException("Not support " + sparkType.toString());
  }

  public static DataType toSparkType(Type gravitinoType) {
    if (gravitinoType instanceof Types.StringType) {
      return StringType$.MODULE$;
    } else if (gravitinoType instanceof Types.BooleanType) {
      return BooleanType$.MODULE$;
    } else if (gravitinoType instanceof Types.IntegerType) {
      return IntegerType$.MODULE$;
    }
    throw new UnsupportedOperationException("Not support " + gravitinoType.toString());
  }

Parent issue

#1227

@FANNG1 FANNG1 added subtask Subtasks of umbrella issue good first issue Good for newcomers labels Mar 7, 2024
@ichuniq
Copy link
Contributor

ichuniq commented Mar 7, 2024

Hi can I work on this?

@FANNG1 FANNG1 added this to the Gravitino 0.5.0 milestone Mar 7, 2024
@FANNG1
Copy link
Contributor Author

FANNG1 commented Mar 7, 2024

@ichuniq thanks for taking this, could you propose a pr after #2452 is merged? Spark provides a helper class DataTypes could simple the code.

@FANNG1
Copy link
Contributor Author

FANNG1 commented Mar 7, 2024

@ichuniq , #2452 is merged, please use the lattest DataTypes way.

FANNG1 pushed a commit that referenced this issue Mar 11, 2024
…k-connector (#2484)

### What changes were proposed in this pull request?

Support Float and Double type for spark-connector

### Why are the changes needed?

Fix: #2451 

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
`./gradlew test -PskipITs`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers subtask Subtasks of umbrella issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants