HanpyBin opened a new issue, #36426:
URL: https://github.com/apache/arrow/issues/36426
### Describe the bug, including details regarding any error messages,
version, and platform.
I create a table with one column and its type is Time32[s]. Then I write it
a parquet file. After I read data from the parquet file, I find column type
changes to Time32[ms]. Why is that?
My test code is below
```cpp
int main(int argc, char** argv) {
// generate table
arrow::Time32Builder builder(arrow::time32(arrow::TimeUnit::SECOND),
arrow::default_memory_pool());
builder.Append(1625150000);
builder.Append(1625150100);
builder.Append(1625150200);
std::shared_ptr<arrow::Array> array;
builder.Finish(&array);
std::shared_ptr<arrow::Field> field = arrow::field("time",
arrow::time32(arrow::TimeUnit::SECOND));
std::shared_ptr<arrow::Schema> schema = arrow::schema({field});
std::vector<std::shared_ptr<arrow::Array>> columns = {array};
std::shared_ptr<arrow::Table> table = arrow::Table::Make(schema, columns);
// write to file
arrow::MemoryPool* pool = arrow::default_memory_pool();
std::shared_ptr<arrow::io::FileOutputStream> outfile;
PARQUET_ASSIGN_OR_THROW(outfile,
arrow::io::FileOutputStream::Open("time321.parquet"));
PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable(*table, pool, outfile, 3));
std::cout << table->schema()->ToString() << std::endl;
std::shared_ptr<arrow::io::ReadableFile> infile;
PARQUET_ASSIGN_OR_THROW(infile,
arrow::io::ReadableFile::Open("time321.parquet",
arrow::default_memory_pool()));
// read file
std::unique_ptr<parquet::arrow::FileReader> reader;
PARQUET_THROW_NOT_OK(
parquet::arrow::OpenFile(infile, arrow::default_memory_pool(),
&reader));
std::shared_ptr<arrow::Table> table1;
PARQUET_THROW_NOT_OK(reader->ReadTable(&table1));
std::cout << table1->schema()->ToString() << std::endl;
std::cout << "Loaded " << table1->num_rows() << " rows in " <<
table1->num_columns()
<< " columns." << std::endl;
return 0;
}
```
And output is
```shell
time: time32[s]
time: time32[ms]
Loaded 3 rows in 1 columns.
```
### Component(s)
C++
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]