You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "smileyboy2019 (via GitHub)" <gi...@apache.org> on 2023/12/19 08:52:22 UTC
[I] Java calls API error [iceberg]
smileyboy2019 opened a new issue, #9339:
URL: https://github.com/apache/iceberg/issues/9339
### Apache Iceberg version
None
### Query engine
None
### Please describe the bug 🐞
// 1. 构建记录
GenericRecord record = GenericRecord.create(schema);
ImmutableList.Builder<GenericRecord> builder = ImmutableList.builder();
builder.add(ImmutableMap.of("id", 1, "name", "chen", "birth", "2020-03-08"));
builder.add(ImmutableMap.of("id", 2, "name", "yuan", "birth", "2021-03-09"));
builder.add(ImmutableMap.of("id", 3, "name", "jie", "birth", "2023-03-10"));
builder.add(ImmutableMap.of("id", 4, "name", "ma", "birth", "2023-03-11"));
ImmutableList<GenericRecord> records = builder.build();
// 2. 将记录写入parquet文件
String filepath = table.location() + "/" + UUID.randomUUID().toString();
OutputFile file = table.io().newOutputFile(filepath);
DataWriter<GenericRecord> dataWriter =
Parquet.writeData(file)
.schema(schema)
.createWriterFunc(GenericParquetWriter::buildWriter)
.overwrite()
.withSpec(PartitionSpec.unpartitioned())
.build();
try {
for (GenericRecord record : builder.build()) {
dataWriter.write(record);
}
} finally {
dataWriter.close();
}
// 3. 将文件写入table中
DataFile dataFile = dataWriter.toDataFile();
table.newAppend().appendFile(dataFile).commit();
Parquet class not found
GenericParquetWriter class not found
Is it a version issue
If the version is correct, how can I insert data in Java
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Java calls API error [iceberg]
Posted by "smileyboy2019 (via GitHub)" <gi...@apache.org>.
smileyboy2019 commented on issue #9339:
URL: https://github.com/apache/iceberg/issues/9339#issuecomment-1863977161

Version 1.4.2, using Java API developed by iceberg+minio
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Java calls API error [iceberg]
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra closed issue #9339: Java calls API error
URL: https://github.com/apache/iceberg/issues/9339
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Java calls API error [iceberg]
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #9339:
URL: https://github.com/apache/iceberg/issues/9339#issuecomment-1863991199
`GenericParquetWriter` is in `iceberg-data`, so you would have to add that dependency.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [I] Java calls API error [iceberg]
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on issue #9339:
URL: https://github.com/apache/iceberg/issues/9339#issuecomment-1862465081
@smileyboy2019 could you please provide the full stack trace and the exact Iceberg library versions you're using?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org