Skip to content

Commit cce2113

Browse files
committed
Merge branch 'feature/php85'
2 parents a26db21 + 657c769 commit cce2113

File tree

9 files changed

+61
-8
lines changed

9 files changed

+61
-8
lines changed

.github/workflows/unittest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
operating-system:
18-
- 'ubuntu-20.04'
18+
- 'ubuntu-22.04'
1919
php-versions:
2020
- 7.3
2121
- 7.4
@@ -24,6 +24,7 @@ jobs:
2424
- 8.2
2525
- 8.3
2626
- 8.4
27+
- 8.5
2728
phpunit-versions: ['latest']
2829
env:
2930
extensions: mbstring, intl, xml, gmp, bcmath, snappy-kjdev/php-ext-snappy@0.2.2

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.7.3 - 2026-02-21]
4+
### Added
5+
- PHP 8.5 support, CI adapted
6+
### Fixed
7+
- Reading and writing data columns with field name "0"
8+
- Deprecation warnings on PHP 8.5
9+
310
## [0.7.2 - 2025-03-29]
411
### Added
512
- PHP 8.4 support, CI adapted

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php" : ">=7.3 <=8.4.99",
13+
"php" : ">=7.3 <=8.5.99",
1414
"ext-gmp" : "*",
1515
"ext-bcmath" : "*",
1616
"ext-zlib": "*",

src/file/ThriftFooter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ protected function _CreateModelSchema(?array $path, array &$container, int $chil
211211
array_merge(
212212
$path ?? [], // Fallback to empty array as path
213213
$se->path ?? [ $se->name ] // NOTE: fallback to array-ified $se->name
214-
)
214+
),
215+
function ($v) {
216+
return $v !== null;
217+
}
215218
)
216219
));
217220

src/helper/ArrayToDataColumnsConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected static function processDataRecursively(array $array, array $path, arra
167167
//
168168
// Maximum recursion level
169169
//
170-
if($key) {
170+
if($key !== null) {
171171
//
172172
// Explicit key
173173
//

src/helper/DataColumnsToArrayConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ protected function buildData(DataField $df, array &$result, array $path, array $
279279
// for performance reasons, we directly set the field's value per row
280280
//
281281
$key = $path[0] ?? null;
282-
if($key) {
282+
if($key !== null) {
283283
foreach($data as $index => $value) {
284284
$result[$index][$key] = $value;
285285
}

src/values/primitives/NanoTime.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function DateTimeImmutableFromNanoTimeBytes($data, int $offset) :
9292
// $ms = $timeOfDayNanos / (double)1000000;
9393
// $microseconds = (int)($ms / 1000);
9494

95-
$microseconds = (int) ($timeOfDayNanos / (double)1000);
95+
$microseconds = (int) ($timeOfDayNanos / (float)1000);
9696

9797
$result = new \DateTime();
9898
$result
@@ -121,7 +121,7 @@ public static function getDateTimeObject(NanoTime $nanoTime)
121121
// $ms = $nanoTime->_timeOfDayNanos / (double)1000000;
122122
// $microseconds = (int)($ms / 1000);
123123

124-
$microseconds = (int) ($nanoTime->_timeOfDayNanos / (double)1000);
124+
$microseconds = (int) ($nanoTime->_timeOfDayNanos / (float)1000);
125125

126126
$result = new \DateTime();
127127
$result

tests/EndToEndTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function endToEndTestDataProvider(): array {
4343
],
4444
"double" => [
4545
'field' => DataField::createFromType("double", 'double'),
46-
'expectedValue' => (double)10.44
46+
'expectedValue' => (float)10.44
4747
],
4848
"simple DateTime" => [
4949
'field' => DataField::createFromType('datetime', \DateTimeImmutable::class),

tests/SchemaTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
use Exception;
66

77
use codename\parquet\ParquetReader;
8+
use codename\parquet\ParquetOptions;
9+
10+
use codename\parquet\helper\ParquetDataWriter;
11+
use codename\parquet\helper\ParquetDataIterator;
812

913
use codename\parquet\data\Schema;
1014
use codename\parquet\data\DataType;
@@ -386,4 +390,42 @@ public function testBackwardCompatListWithOneArray(): void {
386390
$rg = $reader->OpenRowGroupReader(0);
387391
$values4 = $rg->ReadColumn($schema->fields[4]);
388392
}
393+
394+
public function testIndexedColumnNames(): void
395+
{
396+
$schema = new Schema([
397+
DataField::createFromType('0', 'integer'),
398+
DataField::createFromType('1', 'string')
399+
]);
400+
401+
$handle = fopen('php://memory', 'r+');
402+
$instance = new ParquetDataWriter($handle, $schema);
403+
404+
for ($i=0; $i < 4; $i++) {
405+
$instance->put([
406+
'0' => $i,
407+
'1' => 'id#'.$i,
408+
]);
409+
}
410+
$instance->finish();
411+
412+
fseek($handle, 0, SEEK_SET);
413+
414+
$reader = new ParquetReader($handle);
415+
$this->assertEquals(1, $reader->getRowGroupCount());
416+
417+
fseek($handle, 0, SEEK_SET);
418+
419+
// Re-read data
420+
$iterator = ParquetDataIterator::fromHandle($handle);
421+
422+
$cnt = 0;
423+
foreach($iterator as $i => $data) {
424+
$this->assertEquals($i, $data['0']);
425+
$this->assertEquals('id#'.$i, $data['1']);
426+
$cnt++;
427+
}
428+
$this->assertEquals(4, $cnt);
429+
430+
}
389431
}

0 commit comments

Comments
 (0)