-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjusted time related columns to be compatibile with other parquet li…
…braries (#706)
- Loading branch information
1 parent
068275f
commit 43876c6
Showing
8 changed files
with
100 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/lib/parquet/src/Flow/Parquet/ParquetFile/Schema/LogicalType/Time.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Flow\Parquet\ParquetFile\Schema\LogicalType; | ||
|
||
use Flow\Parquet\Thrift\TimeType; | ||
|
||
/** | ||
* @psalm-suppress RedundantConditionGivenDocblockType | ||
*/ | ||
final class Time | ||
{ | ||
public function __construct( | ||
private readonly bool $isAdjustedToUTC, | ||
private readonly bool $millis, | ||
private readonly bool $micros, | ||
private readonly bool $nanos | ||
) { | ||
} | ||
|
||
public static function fromThrift(TimeType $timestamp) : self | ||
{ | ||
return new self( | ||
$timestamp->isAdjustedToUTC, | ||
$timestamp->unit->MILLIS !== null, | ||
$timestamp->unit->MICROS !== null, | ||
$timestamp->unit->NANOS !== null | ||
); | ||
} | ||
|
||
public function isAdjustedToUTC() : bool | ||
{ | ||
return $this->isAdjustedToUTC; | ||
} | ||
|
||
public function micros() : bool | ||
{ | ||
return $this->micros; | ||
} | ||
|
||
public function millis() : bool | ||
{ | ||
return $this->millis; | ||
} | ||
|
||
public function nanos() : bool | ||
{ | ||
return $this->nanos; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters