@@ -607,6 +607,99 @@ Xiangpeng Xiangpeng Xiangpeng NULL
607
607
Raphael Raphael Raphael NULL
608
608
NULL NULL NULL NULL
609
609
610
+ ## Ensure no casts for LTRIM
611
+ # Test LTRIM with Utf8View input
612
+ query TT
613
+ EXPLAIN SELECT
614
+ LTRIM(column1_utf8view) AS l
615
+ FROM test;
616
+ ----
617
+ logical_plan
618
+ 01)Projection: ltrim(test.column1_utf8view) AS l
619
+ 02)--TableScan: test projection=[column1_utf8view]
620
+
621
+ # Test LTRIM with Utf8View input and Utf8View pattern
622
+ query TT
623
+ EXPLAIN SELECT
624
+ LTRIM(column1_utf8view, 'foo') AS l
625
+ FROM test;
626
+ ----
627
+ logical_plan
628
+ 01)Projection: ltrim(test.column1_utf8view, Utf8View("foo")) AS l
629
+ 02)--TableScan: test projection=[column1_utf8view]
630
+
631
+ # Test LTRIM with Utf8View bytes longer than 12
632
+ query TT
633
+ EXPLAIN SELECT
634
+ LTRIM(column1_utf8view, 'this is longer than 12') AS l
635
+ FROM test;
636
+ ----
637
+ logical_plan
638
+ 01)Projection: ltrim(test.column1_utf8view, Utf8View("this is longer than 12")) AS l
639
+ 02)--TableScan: test projection=[column1_utf8view]
640
+
641
+ # Test LTRIM outputs
642
+ query TTTTT
643
+ SELECT
644
+ LTRIM(column1_utf8view, 'foo') AS l1,
645
+ LTRIM(column1_utf8view, column2_utf8view) AS l2,
646
+ LTRIM(column1_utf8view) AS l3,
647
+ LTRIM(column1_utf8view, NULL) AS l4,
648
+ LTRIM(column1_utf8view, 'Xiang') AS l5
649
+ FROM test;
650
+ ----
651
+ Andrew Andrew Andrew NULL Andrew
652
+ Xiangpeng (empty) Xiangpeng NULL peng
653
+ Raphael aphael Raphael NULL Raphael
654
+ NULL NULL NULL NULL NULL
655
+
656
+ ## ensure no casts for RTRIM
657
+ # Test RTRIM with Utf8View input
658
+ query TT
659
+ EXPLAIN SELECT
660
+ RTRIM(column1_utf8view) AS l
661
+ FROM test;
662
+ ----
663
+ logical_plan
664
+ 01)Projection: rtrim(test.column1_utf8view) AS l
665
+ 02)--TableScan: test projection=[column1_utf8view]
666
+
667
+ # Test RTRIM with Utf8View input and Utf8View pattern
668
+ query TT
669
+ EXPLAIN SELECT
670
+ RTRIM(column1_utf8view, 'foo') AS l
671
+ FROM test;
672
+ ----
673
+ logical_plan
674
+ 01)Projection: rtrim(test.column1_utf8view, Utf8View("foo")) AS l
675
+ 02)--TableScan: test projection=[column1_utf8view]
676
+
677
+ # Test RTRIM with Utf8View bytes longer than 12
678
+ query TT
679
+ EXPLAIN SELECT
680
+ RTRIM(column1_utf8view, 'this is longer than 12') AS l
681
+ FROM test;
682
+ ----
683
+ logical_plan
684
+ 01)Projection: rtrim(test.column1_utf8view, Utf8View("this is longer than 12")) AS l
685
+ 02)--TableScan: test projection=[column1_utf8view]
686
+
687
+ # Test RTRIM outputs
688
+ query TTTTT
689
+ SELECT
690
+ RTRIM(column1_utf8view, 'foo') AS l1,
691
+ RTRIM(column1_utf8view, column2_utf8view) AS l2,
692
+ RTRIM(column1_utf8view) AS l3,
693
+ RTRIM(column1_utf8view, NULL) AS l4,
694
+ RTRIM(column1_utf8view, 'peng') As l5
695
+ FROM test;
696
+ ----
697
+ Andrew Andrew Andrew NULL Andrew
698
+ Xiangpeng (empty) Xiangpeng NULL Xia
699
+ Raphael Raphael Raphael NULL Raphael
700
+ NULL NULL NULL NULL NULL
701
+
702
+
610
703
## Ensure no casts for CHARACTER_LENGTH
611
704
query TT
612
705
EXPLAIN SELECT
@@ -685,16 +778,6 @@ logical_plan
685
778
01)Projection: lower(CAST(test.column1_utf8view AS Utf8)) AS c1
686
779
02)--TableScan: test projection=[column1_utf8view]
687
780
688
- ## Ensure no casts for LTRIM
689
- ## TODO https://github.com/apache/datafusion/issues/11856
690
- query TT
691
- EXPLAIN SELECT
692
- LTRIM(column1_utf8view) as c1
693
- FROM test;
694
- ----
695
- logical_plan
696
- 01)Projection: ltrim(CAST(test.column1_utf8view AS Utf8)) AS c1
697
- 02)--TableScan: test projection=[column1_utf8view]
698
781
699
782
## Ensure no casts for LPAD
700
783
query TT
@@ -811,18 +894,6 @@ logical_plan
811
894
01)Projection: reverse(CAST(test.column1_utf8view AS Utf8)) AS c1
812
895
02)--TableScan: test projection=[column1_utf8view]
813
896
814
- ## Ensure no casts for RTRIM
815
- ## TODO file ticket
816
- query TT
817
- EXPLAIN SELECT
818
- RTRIM(column1_utf8view) as c1,
819
- RTRIM(column1_utf8view, 'foo') as c2
820
- FROM test;
821
- ----
822
- logical_plan
823
- 01)Projection: rtrim(__common_expr_1) AS c1, rtrim(__common_expr_1, Utf8("foo")) AS c2
824
- 02)--Projection: CAST(test.column1_utf8view AS Utf8) AS __common_expr_1
825
- 03)----TableScan: test projection=[column1_utf8view]
826
897
827
898
## Ensure no casts for RIGHT
828
899
## TODO file ticket
@@ -849,19 +920,6 @@ logical_plan
849
920
03)----TableScan: test projection=[column1_utf8view, column2_utf8view]
850
921
851
922
852
- ## Ensure no casts for RTRIM
853
- ## TODO file ticket
854
- query TT
855
- EXPLAIN SELECT
856
- RTRIM(column1_utf8view) as c,
857
- RTRIM(column1_utf8view, column2_utf8view) as c1
858
- FROM test;
859
- ----
860
- logical_plan
861
- 01)Projection: rtrim(__common_expr_1) AS c, rtrim(__common_expr_1, CAST(test.column2_utf8view AS Utf8)) AS c1
862
- 02)--Projection: CAST(test.column1_utf8view AS Utf8) AS __common_expr_1, test.column2_utf8view
863
- 03)----TableScan: test projection=[column1_utf8view, column2_utf8view]
864
-
865
923
## Ensure no casts for SPLIT_PART
866
924
## TODO file ticket
867
925
query TT
0 commit comments