|
19 | 19 | import com.facebook.presto.common.type.RowType; |
20 | 20 | import com.facebook.presto.common.type.StandardTypes; |
21 | 21 | import com.facebook.presto.common.type.Type; |
22 | | -import com.facebook.presto.common.type.VarcharType; |
23 | 22 | import com.facebook.presto.operator.scalar.AbstractTestFunctions; |
24 | 23 | import com.facebook.presto.operator.scalar.FunctionAssertions; |
25 | 24 | import com.facebook.presto.spi.StandardErrorCode; |
@@ -409,35 +408,35 @@ public void testJsonToRow() |
409 | 408 | "\"array2\": [1, 2, null, 3], " + |
410 | 409 | "\"array1\": [], " + |
411 | 410 | "\"array3\": null, " + |
412 | | - "\"map3\": {\"a\": 1, \"b\": 2, \"none\": null, \"Three\": 3}, " + |
| 411 | + "\"map3\": {\"a\": 1, \"b\": 2, \"none\": null, \"three\": 3}, " + |
413 | 412 | "\"map1\": {}, " + |
414 | 413 | "\"map2\": null, " + |
415 | 414 | "\"rowAsJsonArray1\": [1, 2, null, 3], " + |
416 | 415 | "\"rowAsJsonArray2\": null, " + |
417 | | - "\"rowAsJsonObject2\": {\"a\": 1, \"b\": 2, \"none\": null, \"Three\": 3}, " + |
| 416 | + "\"rowAsJsonObject2\": {\"a\": 1, \"b\": 2, \"none\": null, \"three\": 3}, " + |
418 | 417 | "\"rowAsJsonObject1\": null}' " + |
419 | | - "AS ROW(array1 array<BIGINT>, array2 ARRAY<bigint>, array3 ARRAY<BIGINT>, " + |
420 | | - "map1 MAP<VARCHAR, BIGINT>, map2 map<varchar, BIGINT>, map3 MAP<VARCHAR, BIGINT>, " + |
421 | | - "\"rowAsJsonArray1\" row(BIGINT, bigint, BIGINT, BIGINT), \"rowAsJsonArray2\" ROW(BIGINT)," + |
422 | | - "\"rowAsJsonObject1\" ROW(nothing BIGINT), \"rowAsJsonObject2\" ROW(a BIGINT, b BIGINT, \"Three\" BIGINT, none BIGINT)))", |
| 418 | + "AS ROW(array1 ARRAY<BIGINT>, array2 ARRAY<BIGINT>, array3 ARRAY<BIGINT>, " + |
| 419 | + "map1 MAP<VARCHAR, BIGINT>, map2 MAP<VARCHAR, BIGINT>, map3 MAP<VARCHAR, BIGINT>, " + |
| 420 | + "rowAsJsonArray1 ROW(BIGINT, BIGINT, BIGINT, BIGINT), rowAsJsonArray2 ROW(BIGINT)," + |
| 421 | + "rowAsJsonObject1 ROW(nothing BIGINT), rowAsJsonObject2 ROW(a BIGINT, b BIGINT, three BIGINT, none BIGINT)))", |
423 | 422 | RowType.from(ImmutableList.of( |
424 | 423 | RowType.field("array1", new ArrayType(BIGINT)), |
425 | 424 | RowType.field("array2", new ArrayType(BIGINT)), |
426 | 425 | RowType.field("array3", new ArrayType(BIGINT)), |
427 | 426 | RowType.field("map1", mapType(VARCHAR, BIGINT)), |
428 | 427 | RowType.field("map2", mapType(VARCHAR, BIGINT)), |
429 | 428 | RowType.field("map3", mapType(VARCHAR, BIGINT)), |
430 | | - RowType.field("rowAsJsonArray1", RowType.anonymous(ImmutableList.of(BIGINT, BIGINT, BIGINT, BIGINT)), true), |
431 | | - RowType.field("rowAsJsonArray2", RowType.anonymous(ImmutableList.of(BIGINT)), true), |
432 | | - RowType.field("rowAsJsonObject1", RowType.from(ImmutableList.of(RowType.field("nothing", BIGINT))), true), |
433 | | - RowType.field("rowAsJsonObject2", RowType.from(ImmutableList.of( |
| 429 | + RowType.field("rowasjsonarray1", RowType.anonymous(ImmutableList.of(BIGINT, BIGINT, BIGINT, BIGINT))), |
| 430 | + RowType.field("rowasjsonarray2", RowType.anonymous(ImmutableList.of(BIGINT))), |
| 431 | + RowType.field("rowasjsonobject1", RowType.from(ImmutableList.of(RowType.field("nothing", BIGINT)))), |
| 432 | + RowType.field("rowasjsonobject2", RowType.from(ImmutableList.of( |
434 | 433 | RowType.field("a", BIGINT), |
435 | 434 | RowType.field("b", BIGINT), |
436 | | - RowType.field("Three", BIGINT, true), |
437 | | - RowType.field("none", BIGINT))), true))), |
| 435 | + RowType.field("three", BIGINT), |
| 436 | + RowType.field("none", BIGINT)))))), |
438 | 437 | asList( |
439 | 438 | emptyList(), asList(1L, 2L, null, 3L), null, |
440 | | - ImmutableMap.of(), null, asMap(ImmutableList.of("a", "b", "none", "Three"), asList(1L, 2L, null, 3L)), |
| 439 | + ImmutableMap.of(), null, asMap(ImmutableList.of("a", "b", "none", "three"), asList(1L, 2L, null, 3L)), |
441 | 440 | asList(1L, 2L, null, 3L), null, |
442 | 441 | null, asList(1L, 2L, 3L, null))); |
443 | 442 |
|
@@ -526,14 +525,6 @@ public void testRowCast() |
526 | 525 | RowType.field("d", VARCHAR), |
527 | 526 | RowType.field("e", new ArrayType(BIGINT)))), |
528 | 527 | asList(2L, 1.5, true, "abc", ImmutableList.of(1L, 2L))); |
529 | | - |
530 | | - assertFunction( |
531 | | - "MAP(ARRAY['myFirstRow', 'mySecondRow'], ARRAY[cast(row('row1FieldValue1', 'row1FieldValue2') as row(\"firstField\" varchar, \"secondField\" varchar)), cast(row('row2FieldValue1', 'row2FieldValue2') as row(\"firstField\" varchar, \"secondField\" varchar))])", |
532 | | - mapType(VarcharType.createVarcharType(11), RowType.from(ImmutableList.of( |
533 | | - RowType.field("firstField", VARCHAR, true), |
534 | | - RowType.field("secondField", VARCHAR, true)))), |
535 | | - ImmutableMap.of("myFirstRow", asList("row1FieldValue1", "row1FieldValue2"), |
536 | | - "mySecondRow", asList("row2FieldValue1", "row2FieldValue2"))); |
537 | 528 | } |
538 | 529 |
|
539 | 530 | @Test |
|
0 commit comments