Skip to content

Commit

Permalink
Fix issue with inproper ndjson check in auto schema
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Jan 17, 2025
1 parent 9a30b3d commit 31f1c0d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Plugin/Insert/QueryParser/JSONParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ abstract class JSONParser extends BaseParser implements JSONParserInterface {
*/
public function parse($query): array {
$this->cols = $this->colTypes = [];
$struct = Struct::fromJson($query);
$row = $struct->toArray();
if (!$row || !is_array($row)) {
$isNdJson = !Struct::isValid($query);
if ($isNdJson) {
// checking if query has ndjson format
$queries = static::parseNdJSON($query);
foreach ($queries as $query) {
Expand All @@ -42,6 +41,8 @@ public function parse($query): array {
$this->parseJSONRow($row);
}
} else {
$struct = Struct::fromJson($query);
$row = $struct->toArray();
$this->parseJSONRow($row);
}

Expand Down

0 comments on commit 31f1c0d

Please sign in to comment.