File size: 152,523 Bytes
5a9e79d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
diff --git a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/ExecutionConfigOptions.java b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/ExecutionConfigOptions.java
--- a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/ExecutionConfigOptions.java
+++ b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/ExecutionConfigOptions.java
@@ -344,6 +344,49 @@ public class ExecutionConfigOptions {
                                     + "If set to ALLOW_UNORDERED, will attempt to use {@see AsyncDataStream.OutputMode.UNORDERED} when it does not "
                                     + "affect the correctness of the result, otherwise ORDERED will be still used.");
 
+    // ------------------------------------------------------------------------
+    //  Async Scalar Function
+    // ------------------------------------------------------------------------
+    @Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING)
+    public static final ConfigOption<Integer> TABLE_EXEC_ASYNC_SCALAR_BUFFER_CAPACITY =
+            key("table.exec.async-scalar.buffer-capacity")
+                    .intType()
+                    .defaultValue(10)
+                    .withDescription(
+                            "The max number of async i/o operation that the async lookup join can trigger.");
+
+    @Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING)
+    public static final ConfigOption<Duration> TABLE_EXEC_ASYNC_SCALAR_TIMEOUT =
+            key("table.exec.async-scalar.timeout")
+                    .durationType()
+                    .defaultValue(Duration.ofMinutes(3))
+                    .withDescription(
+                            "The async timeout for the asynchronous operation to complete.");
+
+    @Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING)
+    public static final ConfigOption<RetryStrategy> TABLE_EXEC_ASYNC_SCALAR_RETRY_STRATEGY =
+            key("table.exec.async-scalar.retry-strategy")
+                    .enumType(RetryStrategy.class)
+                    .defaultValue(RetryStrategy.FIXED_DELAY)
+                    .withDescription(
+                            "Restart strategy which will be used, FIXED_DELAY by default.");
+
+    @Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING)
+    public static final ConfigOption<Duration> TABLE_EXEC_ASYNC_SCALAR_RETRY_DELAY =
+            key("table.exec.async-scalar.retry-delay")
+                    .durationType()
+                    .defaultValue(Duration.ofMillis(100))
+                    .withDescription("The delay to wait before trying again.");
+
+    @Documentation.TableOption(execMode = Documentation.ExecMode.STREAMING)
+    public static final ConfigOption<Integer> TABLE_EXEC_ASYNC_SCALAR_MAX_ATTEMPTS =
+            key("table.exec.async-scalar.max-attempts")
+                    .intType()
+                    .defaultValue(3)
+                    .withDescription(
+                            "The max number of async retry attempts to make before task "
+                                    + "execution is failed.");
+
     // ------------------------------------------------------------------------
     //  MiniBatch Options
     // ------------------------------------------------------------------------
@@ -692,6 +735,16 @@ public enum AsyncOutputMode {
         ALLOW_UNORDERED
     }
 
+    /** Retry strategy in the case of failure. */
+    @PublicEvolving
+    public enum RetryStrategy {
+        /** When a failure occurs, don't retry. */
+        NO_RETRY,
+
+        /** A fixed delay before retrying again. */
+        FIXED_DELAY
+    }
+
     /** Determine if CAST operates using the legacy behaviour or the new one. */
     @Deprecated
     public enum LegacyCastBehaviour implements DescribedEnum {
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/AsyncScalarFunction.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/AsyncScalarFunction.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/AsyncScalarFunction.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.functions;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.table.catalog.DataTypeFactory;
+import org.apache.flink.table.types.extraction.TypeInferenceExtractor;
+import org.apache.flink.table.types.inference.TypeInference;
+
+/**
+ * Base class for a user-defined scalar function which returns results asynchronously. A
+ * user-defined scalar function maps zero, one, or multiple scalar values to a new scalar value.
+ *
+ * <p>The behavior of a {@link AsyncScalarFunction} can be defined by implementing a custom
+ * evaluation method. An evaluation method must be declared publicly and named <code>eval</code>.
+ * Evaluation methods can also be overloaded by implementing multiple methods named <code>eval
+ * </code>. The first argument of the method must be a {@link
+ * java.util.concurrent.CompletableFuture} of the return type. The method body must complete the
+ * future either if there is a result or if it completes exceptionally.
+ *
+ * <p>By default, input and output data types are automatically extracted using reflection. If the
+ * reflective information is not sufficient, it can be supported and enriched with {@link
+ * org.apache.flink.table.annotation.DataTypeHint} and {@link
+ * org.apache.flink.table.annotation.FunctionHint} annotations.
+ *
+ * <p>The following examples show how to specify an async scalar function:
+ *
+ * <pre>{@code
+ * // a function that accepts two INT arguments and computes a sum
+ * class SumFunction extends AsyncScalarFunction {
+ *   public void eval(CompletableFuture<Integer> future, Integer a, Integer b) {
+ *     return future.complete(a + b);
+ *   }
+ * }
+ *
+ * // a function that accepts either INT NOT NULL or BOOLEAN NOT NULL and computes a STRING
+ * class StringifyFunction extends AsyncScalarFunction {
+ *   public void eval(CompletableFuture<String> future, int i) {
+ *     return future.complete(String.valueOf(i));
+ *   }
+ *   public void eval(CompletableFuture<String> future, boolean b) {
+ *     return future.complete(String.valueOf(b));
+ *   }
+ * }
+ *
+ * // a function that accepts either INT or BOOLEAN and computes a STRING using function hints
+ * @FunctionHint(input = [@DataTypeHint("INT")])
+ * @FunctionHint(input = [@DataTypeHint("BOOLEAN")])
+ * class StringifyFunction extends AsyncScalarFunction {
+ *   public void eval(CompletableFuture<String> future, Object o) {
+ *     return future.complete(o.toString());
+ *   }
+ * }
+ *
+ * // a function that accepts any data type as argument and computes a STRING
+ * class StringifyFunction extends AsyncScalarFunction {
+ *   public void eval(CompletableFuture<String> future,
+ *                    @DataTypeHint(inputGroup = InputGroup.ANY) Object o) {
+ *     return future.complete(o.toString());
+ *   }
+ * }
+ *
+ * // a function that accepts an arbitrary number of BIGINT values and computes a DECIMAL(10, 4)
+ * class SumFunction extends AsyncScalarFunction {
+ *   public void eval(@DataTypeHint("DECIMAL(10, 4)") CompletableFuture<BigDecimal> future,
+ *                    Long... values) {
+ *     // ...
+ *   }
+ * }
+ * }</pre>
+ *
+ * <p>For storing a user-defined function in a catalog, the class must have a default constructor
+ * and must be instantiable during runtime. Anonymous functions in Table API can only be persisted
+ * if the function is not stateful (i.e. containing only transient and static fields).
+ */
+@PublicEvolving
+public class AsyncScalarFunction extends UserDefinedFunction {
+    @Override
+    public final FunctionKind getKind() {
+        return FunctionKind.ASYNC_SCALAR;
+    }
+
+    @Override
+    public TypeInference getTypeInference(DataTypeFactory typeFactory) {
+        return TypeInferenceExtractor.forAsyncScalarFunction(typeFactory, getClass());
+    }
+}
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionKind.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionKind.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionKind.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/FunctionKind.java
@@ -25,6 +25,8 @@
 public enum FunctionKind {
     SCALAR,
 
+    ASYNC_SCALAR,
+
     TABLE,
 
     ASYNC_TABLE,
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunction.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunction.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunction.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunction.java
@@ -50,6 +50,7 @@
  * </ul>
  *
  * @see ScalarFunction
+ * @see AsyncScalarFunction
  * @see TableFunction
  * @see AsyncTableFunction
  * @see AggregateFunction
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunctionHelper.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunctionHelper.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunctionHelper.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/UserDefinedFunctionHelper.java
@@ -44,10 +44,13 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 import static org.apache.flink.api.java.typeutils.TypeExtractionUtils.getAllDeclaredMethods;
@@ -67,6 +70,8 @@ public final class UserDefinedFunctionHelper {
 
     public static final String SCALAR_EVAL = "eval";
 
+    public static final String ASYNC_SCALAR_EVAL = "eval";
+
     public static final String TABLE_EVAL = "eval";
 
     public static final String AGGREGATE_ACCUMULATE = "accumulate";
@@ -459,6 +464,9 @@ private static void validateImplementationMethods(
             Class<? extends UserDefinedFunction> functionClass) {
         if (ScalarFunction.class.isAssignableFrom(functionClass)) {
             validateImplementationMethod(functionClass, false, false, SCALAR_EVAL);
+        } else if (AsyncScalarFunction.class.isAssignableFrom(functionClass)) {
+            validateImplementationMethod(functionClass, false, false, ASYNC_SCALAR_EVAL);
+            validateAsyncImplementationMethod(functionClass, ASYNC_SCALAR_EVAL);
         } else if (TableFunction.class.isAssignableFrom(functionClass)) {
             validateImplementationMethod(functionClass, true, false, TABLE_EVAL);
         } else if (AsyncTableFunction.class.isAssignableFrom(functionClass)) {
@@ -521,6 +529,40 @@ private static void validateImplementationMethod(
         }
     }
 
+    private static void validateAsyncImplementationMethod(
+            Class<? extends UserDefinedFunction> clazz, String... methodNameOptions) {
+        final Set<String> nameSet = new HashSet<>(Arrays.asList(methodNameOptions));
+        final List<Method> methods = getAllDeclaredMethods(clazz);
+        for (Method method : methods) {
+            if (!nameSet.contains(method.getName())) {
+                continue;
+            }
+            if (!method.getReturnType().equals(Void.TYPE)) {
+                throw new ValidationException(
+                        String.format(
+                                "Method '%s' of function class '%s' must be void.",
+                                method.getName(), clazz.getName()));
+            }
+            boolean foundParam = false;
+            if (method.getParameterCount() >= 1) {
+                Type firstParam = method.getGenericParameterTypes()[0];
+                firstParam = ExtractionUtils.resolveVariableWithClassContext(clazz, firstParam);
+                if (CompletableFuture.class.equals(firstParam)
+                        || firstParam instanceof ParameterizedType
+                                && CompletableFuture.class.equals(
+                                        ((ParameterizedType) firstParam).getRawType())) {
+                    foundParam = true;
+                }
+            }
+            if (!foundParam) {
+                throw new ValidationException(
+                        String.format(
+                                "Method '%s' of function class '%s' must have a first argument of type java.util.concurrent.CompletableFuture.",
+                                method.getName(), clazz.getName()));
+            }
+        }
+    }
+
     /** Checks if a user-defined function can be easily instantiated. */
     private static void validateInstantiation(Class<?> clazz, boolean requiresDefaultConstructor) {
         if (!InstantiationUtil.isPublic(clazz)) {
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/DataTypeExtractor.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/DataTypeExtractor.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/DataTypeExtractor.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/DataTypeExtractor.java
@@ -68,6 +68,7 @@
 import static org.apache.flink.table.types.extraction.ExtractionUtils.hasInvokableConstructor;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.isStructuredFieldMutable;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.resolveVariable;
+import static org.apache.flink.table.types.extraction.ExtractionUtils.resolveVariableWithClassContext;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.toClass;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.validateStructuredClass;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.validateStructuredFieldReadability;
@@ -155,6 +156,46 @@ public static DataType extractFromMethodParameter(
                         paramPos, method.getName(), baseClass.getName()));
     }
 
+    /**
+     * Extracts a data type from a method parameter by considering surrounding classes and parameter
+     * annotation. This version assumes that the parameter is a generic type, and uses the generic
+     * position type as the extracted data type. For example, if the parameter is a
+     * CompletableFuture&lt;Long&gt; and genericPos is 0, it will extract Long.
+     */
+    public static DataType extractFromGenericMethodParameter(
+            DataTypeFactory typeFactory,
+            Class<?> baseClass,
+            Method method,
+            int paramPos,
+            int genericPos) {
+
+        Type parameterType = method.getGenericParameterTypes()[paramPos];
+        parameterType = resolveVariableWithClassContext(baseClass, parameterType);
+        if (!(parameterType instanceof ParameterizedType)) {
+            throw extractionError(
+                    "The method '%s' needs generic parameters for the %d arg.",
+                    method.getName(), paramPos);
+        }
+        final Type genericParameterType =
+                ((ParameterizedType) parameterType).getActualTypeArguments()[genericPos];
+        final Parameter parameter = method.getParameters()[paramPos];
+        final DataTypeHint hint = parameter.getAnnotation(DataTypeHint.class);
+        final DataTypeTemplate template;
+        if (hint != null) {
+            template = DataTypeTemplate.fromAnnotation(typeFactory, hint);
+        } else {
+            template = DataTypeTemplate.fromDefaults();
+        }
+        return extractDataTypeWithClassContext(
+                typeFactory,
+                template,
+                baseClass,
+                genericParameterType,
+                String.format(
+                        " in generic parameter %d of method '%s' in class '%s'",
+                        paramPos, method.getName(), baseClass.getName()));
+    }
+
     /**
      * Extracts a data type from a method return type by considering surrounding classes and method
      * annotation.
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
@@ -37,9 +37,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Parameter;
@@ -348,6 +350,53 @@ public static Optional<Class<?>> extractSimpleGeneric(
         }
     }
 
+    /** Resolves a variable type while accepting a context for resolution. */
+    public static Type resolveVariableWithClassContext(@Nullable Type contextType, Type type) {
+        final List<Type> typeHierarchy;
+        if (contextType != null) {
+            typeHierarchy = collectTypeHierarchy(contextType);
+        } else {
+            typeHierarchy = Collections.emptyList();
+        }
+        if (!containsTypeVariable(type)) {
+            return type;
+        }
+        if (type instanceof TypeVariable) {
+            return resolveVariable(typeHierarchy, (TypeVariable<?>) type);
+        } else if (type instanceof ParameterizedType) {
+            ParameterizedType parameterizedType = (ParameterizedType) type;
+            List<Type> paramTypes = new ArrayList<>();
+            for (Type paramType : parameterizedType.getActualTypeArguments()) {
+                paramType = resolveVariableWithClassContext(contextType, paramType);
+                paramTypes.add(paramType);
+            }
+            return new ParameterizedTypeImpl(
+                    paramTypes.toArray(paramTypes.toArray(new Type[0])),
+                    parameterizedType.getRawType(),
+                    parameterizedType.getOwnerType());
+        } else if (type instanceof GenericArrayType) {
+            Type componentType =
+                    resolveVariableWithClassContext(
+                            contextType, ((GenericArrayType) type).getGenericComponentType());
+            return new GenericArrayTypeImpl(componentType);
+        } else {
+            return type;
+        }
+    }
+
+    /** Gets the associated class type from a Type parameter. */
+    public static Class<?> getClassFromType(Type type) {
+        if (type instanceof ParameterizedType) {
+            return (Class<?>) ((ParameterizedType) type).getRawType();
+        } else if (type instanceof GenericArrayType) {
+            return Array.newInstance(
+                            (Class<?>) ((GenericArrayType) type).getGenericComponentType(), 0)
+                    .getClass();
+        }
+        // Otherwise assume it's a basic type that can be cast.
+        return (Class<?>) type;
+    }
+
     // --------------------------------------------------------------------------------------------
     // Methods intended for this package
     // --------------------------------------------------------------------------------------------
@@ -1002,6 +1051,85 @@ public static Class<?> classForName(String name, boolean initialize, ClassLoader
         return Class.forName(name, initialize, classLoader);
     }
 
+    /** Utility to know if the type contains a type variable that needs to be resolved. */
+    private static boolean containsTypeVariable(Type type) {
+        if (type instanceof TypeVariable) {
+            return true;
+        } else if (type instanceof ParameterizedType) {
+            return Arrays.stream(((ParameterizedType) type).getActualTypeArguments())
+                    .anyMatch(ExtractionUtils::containsTypeVariable);
+        } else if (type instanceof GenericArrayType) {
+            return containsTypeVariable(((GenericArrayType) type).getGenericComponentType());
+        }
+        // WildcardType does not contain a type variable, and we don't consider it resolvable.
+        return false;
+    }
+
+    /**
+     * {@link ParameterizedType} we use for resolving types, so that if you resolve the type
+     * CompletableFuture&lt;T&gt;, we can create resolve the parameter and return
+     * CompletableFuture&lt;Long&gt;.
+     */
+    private static class ParameterizedTypeImpl implements ParameterizedType {
+
+        private final Type[] actualTypeArguments;
+        private final Type rawType;
+        private final Type ownerType;
+
+        public ParameterizedTypeImpl(Type[] actualTypeArguments, Type rawType, Type ownerType) {
+            this.actualTypeArguments = actualTypeArguments;
+            this.rawType = rawType;
+            this.ownerType = ownerType;
+        }
+
+        @Override
+        public Type[] getActualTypeArguments() {
+            return actualTypeArguments;
+        }
+
+        @Override
+        public Type getRawType() {
+            return rawType;
+        }
+
+        @Override
+        public Type getOwnerType() {
+            return ownerType;
+        }
+
+        @Override
+        public String toString() {
+            List<String> actualTypes =
+                    Arrays.stream(getActualTypeArguments())
+                            .map(Type::getTypeName)
+                            .collect(Collectors.toList());
+            return getRawType().getTypeName() + "<" + String.join(", ", actualTypes) + ">";
+        }
+    }
+
+    /**
+     * {@link GenericArrayType} we use for resolving types, so that if you resolve the type
+     * List&lt;T[]&gt;, we can create resolve the parameter and return List&lt;Long[]&gt;.
+     */
+    private static class GenericArrayTypeImpl implements GenericArrayType {
+
+        private final Type genericComponentType;
+
+        public GenericArrayTypeImpl(Type genericComponentType) {
+            this.genericComponentType = genericComponentType;
+        }
+
+        @Override
+        public Type getGenericComponentType() {
+            return genericComponentType;
+        }
+
+        @Override
+        public String getTypeName() {
+            return getGenericComponentType().getTypeName() + "[]";
+        }
+    }
+
     // --------------------------------------------------------------------------------------------
 
     private ExtractionUtils() {
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionMappingExtractor.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionMappingExtractor.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionMappingExtractor.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionMappingExtractor.java
@@ -29,18 +29,23 @@
 import javax.annotation.Nullable;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static org.apache.flink.table.types.extraction.ExtractionUtils.collectAnnotationsOfClass;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.collectAnnotationsOfMethod;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.extractionError;
+import static org.apache.flink.table.types.extraction.ExtractionUtils.getClassFromType;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.isAssignable;
 import static org.apache.flink.table.types.extraction.ExtractionUtils.isInvokable;
+import static org.apache.flink.table.types.extraction.ExtractionUtils.resolveVariableWithClassContext;
 
 /**
  * Utility for extracting function mappings from signature to result, e.g. from (INT, STRING) to
@@ -143,21 +148,10 @@ static ResultExtraction createGenericResultExtraction(
             boolean allowDataTypeHint) {
         return (extractor, method) -> {
             if (allowDataTypeHint) {
-                final Set<DataTypeHint> dataTypeHints = new HashSet<>();
-                dataTypeHints.addAll(collectAnnotationsOfMethod(DataTypeHint.class, method));
-                dataTypeHints.addAll(
-                        collectAnnotationsOfClass(
-                                DataTypeHint.class, extractor.getFunctionClass()));
-                if (dataTypeHints.size() > 1) {
-                    throw extractionError(
-                            "More than one data type hint found for output of function. "
-                                    + "Please use a function hint instead.");
+                Optional<FunctionResultTemplate> hints = extractHints(extractor, method);
+                if (hints.isPresent()) {
+                    return hints.get();
                 }
-                if (dataTypeHints.size() == 1) {
-                    return FunctionTemplate.createResultTemplate(
-                            extractor.typeFactory, dataTypeHints.iterator().next());
-                }
-                // otherwise continue with regular extraction
             }
             final DataType dataType =
                     DataTypeExtractor.extractFromGeneric(
@@ -169,6 +163,53 @@ static ResultExtraction createGenericResultExtraction(
         };
     }
 
+    /**
+     * Extraction that uses a generic type variable of a method parameter for producing a {@link
+     * FunctionResultTemplate}.
+     *
+     * <p>If enabled, a {@link DataTypeHint} from method or class has higher priority.
+     */
+    static ResultExtraction createGenericResultExtractionFromMethod(
+            int paramPos, int genericPos, boolean allowDataTypeHint) {
+        return (extractor, method) -> {
+            if (allowDataTypeHint) {
+                Optional<FunctionResultTemplate> hints = extractHints(extractor, method);
+                if (hints.isPresent()) {
+                    return hints.get();
+                }
+            }
+            final DataType dataType =
+                    DataTypeExtractor.extractFromGenericMethodParameter(
+                            extractor.typeFactory,
+                            extractor.getFunctionClass(),
+                            method,
+                            paramPos,
+                            genericPos);
+            return FunctionResultTemplate.of(dataType);
+        };
+    }
+
+    /** Uses hints to extract functional template. */
+    private static Optional<FunctionResultTemplate> extractHints(
+            BaseMappingExtractor extractor, Method method) {
+        final Set<DataTypeHint> dataTypeHints = new HashSet<>();
+        dataTypeHints.addAll(collectAnnotationsOfMethod(DataTypeHint.class, method));
+        dataTypeHints.addAll(
+                collectAnnotationsOfClass(DataTypeHint.class, extractor.getFunctionClass()));
+        if (dataTypeHints.size() > 1) {
+            throw extractionError(
+                    "More than one data type hint found for output of function. "
+                            + "Please use a function hint instead.");
+        }
+        if (dataTypeHints.size() == 1) {
+            return Optional.ofNullable(
+                    FunctionTemplate.createResultTemplate(
+                            extractor.typeFactory, dataTypeHints.iterator().next()));
+        }
+        // otherwise continue with regular extraction
+        return Optional.empty();
+    }
+
     /** Verification that checks a method by parameters and return type. */
     static MethodVerification createParameterAndReturnTypeVerification() {
         return (method, signature, result) -> {
@@ -208,6 +249,30 @@ static MethodVerification createParameterWithArgumentVerification(
         };
     }
 
+    /** Verification that checks a method by parameters including an additional first parameter. */
+    static MethodVerification createGenericParameterWithArgumentAndReturnTypeVerification(
+            Class<?> baseClass, Class<?> argumentClass, int paramPos, int genericPos) {
+        return (method, signature, result) -> {
+            final Class<?>[] parameters =
+                    Stream.concat(Stream.of(argumentClass), signature.stream())
+                            .toArray(Class<?>[]::new);
+
+            Type genericType = method.getGenericParameterTypes()[paramPos];
+            genericType = resolveVariableWithClassContext(baseClass, genericType);
+            if (!(genericType instanceof ParameterizedType)) {
+                throw extractionError(
+                        "The method '%s' needs generic parameters for the %d arg.",
+                        method.getName(), paramPos);
+            }
+            Type returnType =
+                    ((ParameterizedType) genericType).getActualTypeArguments()[genericPos];
+            Class<?> returnClazz = getClassFromType(returnType);
+            if (!(isInvokable(method, parameters) && isAssignable(result, returnClazz, true))) {
+                throw createMethodNotFoundError(method.getName(), parameters, null);
+            }
+        };
+    }
+
     /** Verification that checks a method by parameters. */
     static MethodVerification createParameterVerification() {
         return (method, signature, result) -> {
diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java
--- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java
+++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/TypeInferenceExtractor.java
@@ -23,6 +23,7 @@
 import org.apache.flink.table.annotation.FunctionHint;
 import org.apache.flink.table.catalog.DataTypeFactory;
 import org.apache.flink.table.functions.AggregateFunction;
+import org.apache.flink.table.functions.AsyncScalarFunction;
 import org.apache.flink.table.functions.AsyncTableFunction;
 import org.apache.flink.table.functions.ScalarFunction;
 import org.apache.flink.table.functions.TableAggregateFunction;
@@ -49,7 +50,9 @@
 import java.util.stream.Collectors;
 
 import static org.apache.flink.table.types.extraction.ExtractionUtils.extractionError;
+import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createGenericParameterWithArgumentAndReturnTypeVerification;
 import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createGenericResultExtraction;
+import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createGenericResultExtractionFromMethod;
 import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createParameterAndReturnTypeVerification;
 import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createParameterSignatureExtraction;
 import static org.apache.flink.table.types.extraction.FunctionMappingExtractor.createParameterVerification;
@@ -85,6 +88,22 @@ public static TypeInference forScalarFunction(
         return extractTypeInference(mappingExtractor);
     }
 
+    /** Extracts a type inference from a {@link AsyncScalarFunction}. */
+    public static TypeInference forAsyncScalarFunction(
+            DataTypeFactory typeFactory, Class<? extends AsyncScalarFunction> function) {
+        final FunctionMappingExtractor mappingExtractor =
+                new FunctionMappingExtractor(
+                        typeFactory,
+                        function,
+                        UserDefinedFunctionHelper.ASYNC_SCALAR_EVAL,
+                        createParameterSignatureExtraction(1),
+                        null,
+                        createGenericResultExtractionFromMethod(0, 0, true),
+                        createGenericParameterWithArgumentAndReturnTypeVerification(
+                                function, CompletableFuture.class, 0, 0));
+        return extractTypeInference(mappingExtractor);
+    }
+
     /** Extracts a type inference from a {@link AggregateFunction}. */
     public static TypeInference forAggregateFunction(
             DataTypeFactory typeFactory, Class<? extends AggregateFunction<?, ?>> function) {
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/catalog/FunctionCatalogOperatorTable.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/catalog/FunctionCatalogOperatorTable.java
--- a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/catalog/FunctionCatalogOperatorTable.java
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/catalog/FunctionCatalogOperatorTable.java
@@ -193,6 +193,7 @@ private boolean verifyFunctionKind(
         if (kind == FunctionKind.TABLE) {
             return true;
         } else if (kind == FunctionKind.SCALAR
+                || kind == FunctionKind.ASYNC_SCALAR
                 || kind == FunctionKind.AGGREGATE
                 || kind == FunctionKind.TABLE_AGGREGATE) {
             if (category != null && category.isTableFunction()) {
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/codegen/AsyncCodeGenerator.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/codegen/AsyncCodeGenerator.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/codegen/AsyncCodeGenerator.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.codegen;
+
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.streaming.api.functions.async.AsyncFunction;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.functions.FunctionKind;
+import org.apache.flink.table.planner.functions.bridging.BridgingSqlFunction;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+import org.apache.flink.table.runtime.generated.GeneratedFunction;
+import org.apache.flink.table.runtime.operators.calc.async.DelegatingAsyncResultFuture;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.utils.LogicalTypeChecks;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexVisitorImpl;
+import org.apache.commons.text.StringSubstitutor;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * Generates an {@link AsyncFunction} which can be used to evaluate calc projections from an async
+ * scalar function.
+ */
+public class AsyncCodeGenerator {
+
+    public static final String DEFAULT_EXCEPTION_TERM = "e";
+    public static final String DEFAULT_DELEGATING_FUTURE_TERM = "f";
+
+    /**
+     * Creates a generated function which produces an {@link AsyncFunction} which executes the calc
+     * projections.
+     *
+     * @param name The name used to generate the underlying function name
+     * @param inputType The RowType of the input RowData
+     * @param returnType The RowType of the resulting RowData
+     * @param retainHeader If the header of the row should be retained
+     * @param calcProjection The list of projections to be executed by this function
+     * @param tableConfig The table configuration
+     * @param classLoader The classloader to use while resolving classes
+     * @return A {@link GeneratedFunction} returning an {@link AsyncFunction} executing the given
+     *     list of projections
+     */
+    public static GeneratedFunction<AsyncFunction<RowData, RowData>> generateFunction(
+            String name,
+            RowType inputType,
+            RowType returnType,
+            List<RexNode> calcProjection,
+            boolean retainHeader,
+            ReadableConfig tableConfig,
+            ClassLoader classLoader) {
+        CodeGeneratorContext ctx = new CodeGeneratorContext(tableConfig, classLoader);
+        String processCode =
+                generateProcessCode(
+                        ctx,
+                        inputType,
+                        returnType,
+                        calcProjection,
+                        retainHeader,
+                        CodeGenUtils.DEFAULT_INPUT1_TERM(),
+                        CodeGenUtils.DEFAULT_COLLECTOR_TERM(),
+                        DEFAULT_EXCEPTION_TERM,
+                        CodeGenUtils.DEFAULT_OUT_RECORD_TERM(),
+                        DEFAULT_DELEGATING_FUTURE_TERM);
+        return FunctionCodeGenerator.generateFunction(
+                ctx,
+                name,
+                getFunctionClass(),
+                processCode,
+                returnType,
+                inputType,
+                CodeGenUtils.DEFAULT_INPUT1_TERM(),
+                JavaScalaConversionUtil.toScala(Optional.empty()),
+                JavaScalaConversionUtil.toScala(Optional.empty()),
+                CodeGenUtils.DEFAULT_COLLECTOR_TERM(),
+                CodeGenUtils.DEFAULT_CONTEXT_TERM());
+    }
+
+    @SuppressWarnings("unchecked")
+    private static Class<AsyncFunction<RowData, RowData>> getFunctionClass() {
+        return (Class<AsyncFunction<RowData, RowData>>) (Object) AsyncFunction.class;
+    }
+
+    private static String generateProcessCode(
+            CodeGeneratorContext ctx,
+            RowType inputType,
+            RowType outRowType,
+            List<RexNode> projection,
+            boolean retainHeader,
+            String inputTerm,
+            String collectorTerm,
+            String errorTerm,
+            String recordTerm,
+            String delegatingFutureTerm) {
+
+        projection.forEach(n -> n.accept(new AsyncScalarFunctionsValidator()));
+
+        ExprCodeGenerator exprGenerator =
+                new ExprCodeGenerator(ctx, false)
+                        .bindInput(
+                                inputType,
+                                inputTerm,
+                                JavaScalaConversionUtil.toScala(Optional.empty()));
+
+        List<GeneratedExpression> projectionExprs =
+                projection.stream()
+                        .map(exprGenerator::generateExpression)
+                        .collect(Collectors.toList());
+        int syncIndex = 0;
+        int index = 0;
+        StringBuilder outputs = new StringBuilder();
+        StringBuilder syncInvocations = new StringBuilder();
+        StringBuilder asyncInvocation = new StringBuilder();
+        if (retainHeader) {
+            outputs.append(String.format("%s.setRowKind(rowKind);\n", recordTerm, inputTerm));
+        }
+        for (GeneratedExpression fieldExpr : projectionExprs) {
+            if (fieldExpr.resultTerm().isEmpty()) {
+                outputs.append(
+                        String.format("%s.setField(%d, resultObject);\n", recordTerm, index));
+                asyncInvocation.append(fieldExpr.code());
+            } else {
+                outputs.append(
+                        String.format(
+                                "%s.setField(%d, %s.getSynchronousResult(%d));\n",
+                                recordTerm, index, delegatingFutureTerm, syncIndex));
+                syncInvocations.append(fieldExpr.code());
+                syncInvocations.append(
+                        String.format(
+                                "%s.addSynchronousResult(%s);\n",
+                                delegatingFutureTerm, fieldExpr.resultTerm()));
+                syncIndex++;
+            }
+            index++;
+        }
+
+        Map<String, String> values = new HashMap<>();
+        values.put("delegatingFutureTerm", delegatingFutureTerm);
+        values.put("delegatingFutureType", DelegatingAsyncResultFuture.class.getCanonicalName());
+        values.put("collectorTerm", collectorTerm);
+        values.put("typeTerm", GenericRowData.class.getCanonicalName());
+        values.put("recordTerm", recordTerm);
+        values.put("inputTerm", inputTerm);
+        values.put("fieldCount", Integer.toString(LogicalTypeChecks.getFieldCount(outRowType)));
+        values.put("outputs", outputs.toString());
+        values.put("syncInvocations", syncInvocations.toString());
+        values.put("asyncInvocation", asyncInvocation.toString());
+        values.put("errorTerm", errorTerm);
+
+        return StringSubstitutor.replace(
+                String.join(
+                        "\n",
+                        new String[] {
+                            "final ${delegatingFutureType} ${delegatingFutureTerm} ",
+                            "    = new ${delegatingFutureType}(${collectorTerm});",
+                            "final org.apache.flink.types.RowKind rowKind = ${inputTerm}.getRowKind();\n",
+                            "try {",
+                            "  java.util.function.Function<Object, ${typeTerm}> outputFactory = ",
+                            "    new java.util.function.Function<Object, ${typeTerm}>() {",
+                            "    @Override",
+                            "    public ${typeTerm} apply(Object resultObject) {",
+                            "      final ${typeTerm} ${recordTerm} = new ${typeTerm}(${fieldCount});",
+                            "      ${outputs}",
+                            "      return ${recordTerm};",
+                            "    }",
+                            "  };",
+                            "",
+                            "  ${delegatingFutureTerm}.setOutputFactory(outputFactory);",
+                            // Ensure that sync invocations come first so that we know that they're
+                            // available when the async callback occurs.
+                            "  ${syncInvocations}",
+                            "  ${asyncInvocation}",
+                            "",
+                            "} catch (Throwable ${errorTerm}) {",
+                            "  ${collectorTerm}.completeExceptionally(${errorTerm});",
+                            "}"
+                        }),
+                values);
+    }
+
+    private static class AsyncScalarFunctionsValidator extends RexVisitorImpl<Void> {
+        public AsyncScalarFunctionsValidator() {
+            super(true);
+        }
+
+        @Override
+        public Void visitCall(RexCall call) {
+            super.visitCall(call);
+
+            if (call.getOperator() instanceof BridgingSqlFunction
+                    && ((BridgingSqlFunction) call.getOperator()).getDefinition().getKind()
+                            != FunctionKind.ASYNC_SCALAR) {
+                throw new CodeGenException(
+                        "Invalid use of function "
+                                + call.getOperator()
+                                + "."
+                                + "Code generation should only be done with async calls");
+            }
+            return null;
+        }
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/bridging/BridgingSqlFunction.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/bridging/BridgingSqlFunction.java
--- a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/bridging/BridgingSqlFunction.java
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/bridging/BridgingSqlFunction.java
@@ -116,7 +116,9 @@ public static BridgingSqlFunction of(
             TypeInference typeInference) {
         final FunctionKind functionKind = resolvedFunction.getDefinition().getKind();
         checkState(
-                functionKind == FunctionKind.SCALAR || functionKind == FunctionKind.TABLE,
+                functionKind == FunctionKind.SCALAR
+                        || functionKind == FunctionKind.ASYNC_SCALAR
+                        || functionKind == FunctionKind.TABLE,
                 "Scalar or table function kind expected.");
 
         if (functionKind == FunctionKind.TABLE) {
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecAsyncCalc.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecAsyncCalc.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecAsyncCalc.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.nodes.exec.common;
+
+import org.apache.flink.api.dag.Transformation;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.streaming.api.functions.async.AsyncFunction;
+import org.apache.flink.streaming.api.operators.OneInputStreamOperatorFactory;
+import org.apache.flink.streaming.api.operators.async.AsyncWaitOperatorFactory;
+import org.apache.flink.streaming.api.transformations.OneInputTransformation;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.calcite.FlinkTypeFactory;
+import org.apache.flink.table.planner.codegen.AsyncCodeGenerator;
+import org.apache.flink.table.planner.delegation.PlannerBase;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecEdge;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeConfig;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeContext;
+import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.SingleTransformationTranslator;
+import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil;
+import org.apache.flink.table.planner.plan.utils.AsyncUtil;
+import org.apache.flink.table.runtime.generated.GeneratedFunction;
+import org.apache.flink.table.runtime.operators.calc.async.AsyncFunctionRunner;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexNode;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/** Base class for exec Async Calc. */
+public abstract class CommonExecAsyncCalc extends ExecNodeBase<RowData>
+        implements SingleTransformationTranslator<RowData> {
+
+    public static final String ASYNC_CALC_TRANSFORMATION = "async-calc";
+
+    public static final String FIELD_NAME_PROJECTION = "projection";
+
+    @JsonProperty(FIELD_NAME_PROJECTION)
+    private final List<RexNode> projection;
+
+    public CommonExecAsyncCalc(
+            int id,
+            ExecNodeContext context,
+            ReadableConfig persistedConfig,
+            List<RexNode> projection,
+            List<InputProperty> inputProperties,
+            RowType outputType,
+            String description) {
+        super(id, context, persistedConfig, inputProperties, outputType, description);
+        checkArgument(inputProperties.size() == 1);
+        this.projection = checkNotNull(projection);
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected Transformation<RowData> translateToPlanInternal(
+            PlannerBase planner, ExecNodeConfig config) {
+        final ExecEdge inputEdge = getInputEdges().get(0);
+        final Transformation<RowData> inputTransform =
+                (Transformation<RowData>) inputEdge.translateToPlan(planner);
+        return createAsyncOneInputTransformation(
+                inputTransform, config, planner.getFlinkContext().getClassLoader());
+    }
+
+    private OneInputTransformation<RowData, RowData> createAsyncOneInputTransformation(
+            Transformation<RowData> inputTransform,
+            ExecNodeConfig config,
+            ClassLoader classLoader) {
+        List<RexCall> asyncRexCalls =
+                projection.stream()
+                        .filter(x -> x instanceof RexCall)
+                        .map(x -> (RexCall) x)
+                        .collect(Collectors.toList());
+
+        List<Integer> forwardedFields =
+                projection.stream()
+                        .filter(x -> x instanceof RexInputRef)
+                        .map(x -> ((RexInputRef) x).getIndex())
+                        .collect(Collectors.toList());
+        final ExecEdge inputEdge = getInputEdges().get(0);
+        RowType inputRowType =
+                RowType.of(inputEdge.getOutputType().getChildren().toArray(new LogicalType[0]));
+
+        List<LogicalType> forwardedFieldsLogicalTypes =
+                forwardedFields.stream()
+                        .map(inputRowType.getChildren()::get)
+                        .collect(Collectors.toList());
+        List<LogicalType> asyncCallLogicalTypes =
+                asyncRexCalls.stream()
+                        .map(node -> FlinkTypeFactory.toLogicalType(node.getType()))
+                        .collect(Collectors.toList());
+        List<LogicalType> fieldsLogicalTypes = new ArrayList<>();
+        fieldsLogicalTypes.addAll(forwardedFieldsLogicalTypes);
+        fieldsLogicalTypes.addAll(asyncCallLogicalTypes);
+        InternalTypeInfo<RowData> asyncOperatorResultTypeInfo =
+                InternalTypeInfo.ofFields(fieldsLogicalTypes.toArray(new LogicalType[0]));
+        OneInputStreamOperatorFactory<RowData, RowData> factory =
+                getAsyncFunctionOperator(config, classLoader, inputRowType);
+        return ExecNodeUtil.createOneInputTransformation(
+                inputTransform,
+                createTransformationMeta(ASYNC_CALC_TRANSFORMATION, config),
+                factory,
+                asyncOperatorResultTypeInfo,
+                inputTransform.getParallelism(),
+                false);
+    }
+
+    private OneInputStreamOperatorFactory<RowData, RowData> getAsyncFunctionOperator(
+            ExecNodeConfig config, ClassLoader classLoader, RowType inputRowType) {
+
+        RowType resultTypeInfo =
+                RowType.of(
+                        projection.stream()
+                                .map(node -> FlinkTypeFactory.toLogicalType(node.getType()))
+                                .toArray(LogicalType[]::new));
+
+        GeneratedFunction<AsyncFunction<RowData, RowData>> generatedFunction =
+                AsyncCodeGenerator.generateFunction(
+                        "AsyncScalarFunction",
+                        inputRowType,
+                        resultTypeInfo,
+                        projection,
+                        true,
+                        config,
+                        classLoader);
+        AsyncFunctionRunner func = new AsyncFunctionRunner(generatedFunction);
+        AsyncUtil.Options options = AsyncUtil.getAsyncOptions(config);
+        return new AsyncWaitOperatorFactory<>(
+                func,
+                options.asyncTimeout,
+                options.asyncBufferCapacity,
+                options.asyncOutputMode,
+                options.asyncRetryStrategy);
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecAsyncCalc.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecAsyncCalc.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecAsyncCalc.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.nodes.exec.stream;
+
+import org.apache.flink.FlinkVersion;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeContext;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeMetadata;
+import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecAsyncCalc;
+import org.apache.flink.table.types.logical.RowType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.apache.calcite.rex.RexNode;
+
+import java.util.Collections;
+import java.util.List;
+
+/** Stream {@link ExecNode} for {@link org.apache.flink.table.functions.AsyncScalarFunction}. */
+@ExecNodeMetadata(
+        name = "stream-exec-async-calc",
+        version = 1,
+        producedTransformations = CommonExecAsyncCalc.ASYNC_CALC_TRANSFORMATION,
+        minPlanVersion = FlinkVersion.v1_19,
+        minStateVersion = FlinkVersion.v1_19,
+        consumedOptions = {
+            "table.exec.async-scalar.buffer-capacity",
+            "table.exec.async-scalar.timeout",
+            "table.exec.async-scalar.retry-strategy",
+            "table.exec.async-scalar.retry-delay",
+            "table.exec.async-scalar.max-attempts",
+        })
+public class StreamExecAsyncCalc extends CommonExecAsyncCalc implements StreamExecNode<RowData> {
+
+    public StreamExecAsyncCalc(
+            ReadableConfig tableConfig,
+            List<RexNode> projection,
+            InputProperty inputProperty,
+            RowType outputType,
+            String description) {
+        this(
+                ExecNodeContext.newNodeId(),
+                ExecNodeContext.newContext(StreamExecAsyncCalc.class),
+                ExecNodeContext.newPersistedConfig(StreamExecAsyncCalc.class, tableConfig),
+                projection,
+                Collections.singletonList(inputProperty),
+                outputType,
+                description);
+    }
+
+    @JsonCreator
+    public StreamExecAsyncCalc(
+            @JsonProperty(FIELD_NAME_ID) int id,
+            @JsonProperty(FIELD_NAME_TYPE) ExecNodeContext context,
+            @JsonProperty(FIELD_NAME_CONFIGURATION) ReadableConfig persistedConfig,
+            @JsonProperty(FIELD_NAME_PROJECTION) List<RexNode> projection,
+            @JsonProperty(FIELD_NAME_INPUT_PROPERTIES) List<InputProperty> inputProperties,
+            @JsonProperty(FIELD_NAME_OUTPUT_TYPE) RowType outputType,
+            @JsonProperty(FIELD_NAME_DESCRIPTION) String description) {
+        super(id, context, persistedConfig, projection, inputProperties, outputType, description);
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalAsyncCalc.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalAsyncCalc.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalAsyncCalc.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.nodes.physical.stream;
+
+import org.apache.flink.table.planner.calcite.FlinkTypeFactory;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNode;
+import org.apache.flink.table.planner.plan.nodes.exec.InputProperty;
+import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecAsyncCalc;
+import org.apache.flink.table.planner.plan.utils.AsyncUtil;
+
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.Calc;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexProgram;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.apache.flink.table.planner.utils.ShortcutUtils.unwrapTableConfig;
+
+/** Stream physical RelNode for {@link org.apache.flink.table.functions.AsyncScalarFunction}. */
+public class StreamPhysicalAsyncCalc extends StreamPhysicalCalcBase {
+    private final RelOptCluster cluster;
+    private final RexProgram calcProgram;
+    private final RelDataType outputRowType;
+
+    public StreamPhysicalAsyncCalc(
+            RelOptCluster cluster,
+            RelTraitSet traitSet,
+            RelNode inputRel,
+            RexProgram calcProgram,
+            RelDataType outputRowType) {
+        super(cluster, traitSet, inputRel, calcProgram, outputRowType);
+        this.cluster = cluster;
+        this.calcProgram = calcProgram;
+        this.outputRowType = outputRowType;
+    }
+
+    @Override
+    public Calc copy(RelTraitSet traitSet, RelNode child, RexProgram program) {
+        return new StreamPhysicalAsyncCalc(cluster, traitSet, child, program, outputRowType);
+    }
+
+    @Override
+    public ExecNode<?> translateToExecNode() {
+        List<RexNode> projection =
+                calcProgram.getProjectList().stream()
+                        .map(calcProgram::expandLocalRef)
+                        .collect(Collectors.toList());
+        if (calcProgram.getCondition() != null) {
+            throw new IllegalStateException(
+                    "The condition of StreamPhysicalAsyncCalc should be null.");
+        }
+        if (projection.stream().filter(AsyncUtil::containsAsyncCall).count() > 1) {
+            throw new IllegalStateException(
+                    "Only a single async projection is allowed in StreamPhysicalAsyncCalc.");
+        }
+
+        return new StreamExecAsyncCalc(
+                unwrapTableConfig(this),
+                projection,
+                InputProperty.DEFAULT,
+                FlinkTypeFactory.toLogicalRowType(getRowType()),
+                getRelDetailedDescription());
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/AsyncCalcSplitRule.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/AsyncCalcSplitRule.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/AsyncCalcSplitRule.java
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.logical;
+
+import org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalCalc;
+import org.apache.flink.table.planner.plan.utils.AsyncUtil;
+import org.apache.flink.table.planner.utils.JavaScalaConversionUtil;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexProgram;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import scala.Option;
+
+/**
+ * Defines split rules for async calc nodes. These largely exist to isolate and simplify the calls
+ * to the async function from other calc operations, so that the operator can handle just that
+ * functionality.
+ */
+public class AsyncCalcSplitRule {
+
+    private static final RemoteCalcCallFinder ASYNC_CALL_FINDER = new AsyncRemoteCalcCallFinder();
+    public static final RelOptRule SPLIT_CONDITION =
+            new RemoteCalcSplitConditionRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule SPLIT_PROJECT =
+            new RemoteCalcSplitProjectionRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule SPLIT_PROJECTION_REX_FIELD =
+            new RemoteCalcSplitProjectionRexFieldRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule SPLIT_CONDITION_REX_FIELD =
+            new RemoteCalcSplitConditionRexFieldRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule EXPAND_PROJECT =
+            new RemoteCalcExpandProjectRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule PUSH_CONDITION =
+            new RemoteCalcPushConditionRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule REWRITE_PROJECT =
+            new RemoteCalcRewriteProjectionRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule NESTED_SPLIT = new AsyncCalcSplitNestedRule(ASYNC_CALL_FINDER);
+    public static final RelOptRule ONE_PER_CALC_SPLIT =
+            new AsyncCalcSplitOnePerCalcRule(ASYNC_CALL_FINDER);
+
+    /**
+     * An Async implementation of {@link RemoteCalcCallFinder} which finds uses of {@link
+     * org.apache.flink.table.functions.AsyncScalarFunction}.
+     */
+    public static class AsyncRemoteCalcCallFinder implements RemoteCalcCallFinder {
+        @Override
+        public boolean containsRemoteCall(RexNode node) {
+            return AsyncUtil.containsAsyncCall(node);
+        }
+
+        @Override
+        public boolean containsNonRemoteCall(RexNode node) {
+            return AsyncUtil.containsNonAsyncCall(node);
+        }
+
+        @Override
+        public boolean isRemoteCall(RexNode node) {
+            return AsyncUtil.isAsyncCall(node);
+        }
+
+        @Override
+        public boolean isNonRemoteCall(RexNode node) {
+            return AsyncUtil.isNonAsyncCall(node);
+        }
+    }
+
+    private static boolean hasNestedCalls(List<RexNode> projects) {
+        return projects.stream()
+                .filter(AsyncUtil::containsAsyncCall)
+                .filter(expr -> expr instanceof RexCall)
+                .map(expr -> (RexCall) expr)
+                .anyMatch(
+                        rexCall ->
+                                rexCall.getOperands().stream()
+                                        .anyMatch(AsyncUtil::containsAsyncCall));
+    }
+
+    /**
+     * Splits nested call <- asyncCall chains so that nothing is immediately waiting on an async
+     * call in a single calc.
+     *
+     * <p>For Example: Calc(select=[syncCall(asyncCall()]) -> Source
+     *
+     * <p>becomes
+     *
+     * <p>Calc(select=[syncCall(f0)]) -> AsyncCalc(select=[asyncCall() as f0]) -> Source
+     */
+    public static class AsyncCalcSplitNestedRule extends RemoteCalcSplitRuleBase<Void> {
+
+        public AsyncCalcSplitNestedRule(RemoteCalcCallFinder callFinder) {
+            super("AsyncCalcSplitNestedRule", callFinder);
+        }
+
+        @Override
+        public boolean matches(RelOptRuleCall call) {
+            FlinkLogicalCalc calc = call.rel(0);
+
+            // Matches if we have nested remote calls
+            List<RexNode> projects =
+                    calc.getProgram().getProjectList().stream()
+                            .map(calc.getProgram()::expandLocalRef)
+                            .collect(Collectors.toList());
+            return hasNestedCalls(projects);
+        }
+
+        // We convert not on the outermost call, but anything within it
+        @Override
+        public boolean needConvert(RexProgram program, RexNode node, Option<Void> matchState) {
+            return node instanceof RexCall
+                    && !((RexCall) node)
+                            .getOperands().stream().anyMatch(callFinder()::containsRemoteCall);
+        }
+
+        @Override
+        public SplitComponents split(RexProgram program, ScalarFunctionSplitter splitter) {
+            return new SplitComponents(
+                    JavaScalaConversionUtil.toScala(Optional.<RexNode>empty()),
+                    JavaScalaConversionUtil.toScala(
+                            Optional.ofNullable(program.getCondition())
+                                    .map(program::expandLocalRef)),
+                    JavaScalaConversionUtil.toScala(
+                            program.getProjectList().stream()
+                                    .map(program::expandLocalRef)
+                                    .map(n -> n.accept(splitter))
+                                    .collect(Collectors.toList())));
+        }
+    }
+
+    /**
+     * Splits async calls if there are multiple across projections, so that there's one per calc.
+     * This assumes that the nested rule has been run first, so there is just one per projection.
+     *
+     * <p>For Example: Calc(select=[asyncCall(), asyncCall()]) -> Source
+     *
+     * <p>becomes
+     *
+     * <p>AsyncCalc(select=[asyncCall(), f0]) -> AsyncCalc(select=[asyncCall() as f0]) -> Source
+     */
+    public static class AsyncCalcSplitOnePerCalcRule
+            extends RemoteCalcSplitProjectionRuleBase<AsyncCalcSplitOnePerCalcRule.State> {
+
+        public AsyncCalcSplitOnePerCalcRule(RemoteCalcCallFinder callFinder) {
+            super("AsyncCalcSplitOnePerCalcRule", callFinder);
+        }
+
+        @Override
+        public boolean matches(RelOptRuleCall call) {
+            FlinkLogicalCalc calc = call.rel(0);
+            List<RexNode> projects =
+                    calc.getProgram().getProjectList().stream()
+                            .map(calc.getProgram()::expandLocalRef)
+                            .collect(Collectors.toList());
+
+            // If this has no nested calls, then this can be called to split up separate projections
+            // into two different calcs. We don't want the splitter to be called to with nested
+            // calls since it won't behave correctly, so this must be used in conjunction with the
+            // nested rule.
+            return !hasNestedCalls(projects)
+                    && projects.stream().filter(callFinder()::containsRemoteCall).count() >= 2;
+        }
+
+        @Override
+        public boolean needConvert(RexProgram program, RexNode node, Option<State> matchState) {
+            if (AsyncUtil.containsAsyncCall(node) && !matchState.get().foundMatch) {
+                matchState.get().foundMatch = true;
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public Option<State> getMatchState() {
+            return Option.apply(new State());
+        }
+
+        /** State object used to keep track of whether a match has been found yet. */
+        public static class State {
+            boolean foundMatch = false;
+        }
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PythonCorrelateSplitRule.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PythonCorrelateSplitRule.java
--- a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PythonCorrelateSplitRule.java
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/PythonCorrelateSplitRule.java
@@ -245,7 +245,8 @@ private ScalarFunctionSplitter createScalarFunctionSplitter(
                         // separate node
                         return node instanceof RexFieldAccess;
                     }
-                });
+                },
+                new PythonRemoteCalcCallFinder());
     }
 
     @Override
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalAsyncCalcRule.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalAsyncCalcRule.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalAsyncCalcRule.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.physical.stream;
+
+import org.apache.flink.table.planner.plan.nodes.FlinkConventions;
+import org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalCalc;
+import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalAsyncCalc;
+import org.apache.flink.table.planner.plan.utils.AsyncUtil;
+
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.convert.ConverterRule;
+import org.apache.calcite.rex.RexProgram;
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+/** A physical rule for identifying logical async Calcs and converting it to a physical RelNode. */
+public class StreamPhysicalAsyncCalcRule extends ConverterRule {
+    public static final RelOptRule INSTANCE =
+            new StreamPhysicalAsyncCalcRule(
+                    Config.INSTANCE.withConversion(
+                            FlinkLogicalCalc.class,
+                            FlinkConventions.LOGICAL(),
+                            FlinkConventions.STREAM_PHYSICAL(),
+                            "StreamPhysicalAsyncCalcRule"));
+
+    protected StreamPhysicalAsyncCalcRule(Config config) {
+        super(config);
+    }
+
+    @Override
+    public boolean matches(RelOptRuleCall call) {
+        FlinkLogicalCalc calc = call.rel(0);
+        RexProgram program = calc.getProgram();
+        return program.getExprList().stream().anyMatch(AsyncUtil::containsAsyncCall);
+    }
+
+    @Override
+    public @Nullable RelNode convert(RelNode rel) {
+        FlinkLogicalCalc calc = (FlinkLogicalCalc) rel;
+        RelTraitSet traitSet = rel.getTraitSet().replace(FlinkConventions.STREAM_PHYSICAL());
+        RelNode newInput = RelOptRule.convert(calc.getInput(), FlinkConventions.STREAM_PHYSICAL());
+
+        return new StreamPhysicalAsyncCalc(
+                rel.getCluster(), traitSet, newInput, calc.getProgram(), rel.getRowType());
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/AsyncUtil.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/AsyncUtil.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/AsyncUtil.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.utils;
+
+import org.apache.flink.streaming.api.datastream.AsyncDataStream;
+import org.apache.flink.streaming.api.functions.async.AsyncRetryStrategy;
+import org.apache.flink.streaming.util.retryable.AsyncRetryStrategies;
+import org.apache.flink.table.api.config.ExecutionConfigOptions;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.functions.FunctionDefinition;
+import org.apache.flink.table.functions.FunctionKind;
+import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeConfig;
+import org.apache.flink.table.planner.utils.ShortcutUtils;
+
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexNode;
+
+import java.time.Duration;
+import java.util.Objects;
+
+import static org.apache.flink.table.runtime.operators.calc.async.RetryPredicates.ANY_EXCEPTION;
+import static org.apache.flink.table.runtime.operators.calc.async.RetryPredicates.EMPTY_RESPONSE;
+
+/** Contains utilities for {@link org.apache.flink.table.functions.AsyncScalarFunction}. */
+public class AsyncUtil {
+
+    /**
+     * Checks whether it contains the specified kind of async function call in the specified node.
+     *
+     * @param node the RexNode to check
+     * @return true if it contains an async function call in the specified node.
+     */
+    public static boolean containsAsyncCall(RexNode node) {
+        return node.accept(new FunctionFinder(true, true));
+    }
+
+    /**
+     * Checks whether it contains non-async function call in the specified node.
+     *
+     * @param node the RexNode to check
+     * @return true if it contains a non-async function call in the specified node.
+     */
+    public static boolean containsNonAsyncCall(RexNode node) {
+        return node.accept(new FunctionFinder(false, true));
+    }
+
+    /**
+     * Checks whether the specified node is the specified kind of async function call.
+     *
+     * @param node the RexNode to check
+     * @return true if the specified node is an async function call.
+     */
+    public static boolean isAsyncCall(RexNode node) {
+        return node.accept(new FunctionFinder(true, false));
+    }
+
+    /**
+     * Checks whether the specified node is a non-async function call.
+     *
+     * @param node the RexNode to check
+     * @return true if the specified node is a non-async function call.
+     */
+    public static boolean isNonAsyncCall(RexNode node) {
+        return node.accept(new FunctionFinder(false, false));
+    }
+
+    /**
+     * Gets the options required to run the operator.
+     *
+     * @param config The config from which to fetch the options
+     * @return Extracted options
+     */
+    public static AsyncUtil.Options getAsyncOptions(ExecNodeConfig config) {
+        return new AsyncUtil.Options(
+                config.get(ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_BUFFER_CAPACITY),
+                config.get(ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_TIMEOUT).toMillis(),
+                AsyncDataStream.OutputMode.ORDERED,
+                getResultRetryStrategy(
+                        config.get(ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_RETRY_STRATEGY),
+                        config.get(ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_RETRY_DELAY),
+                        config.get(ExecutionConfigOptions.TABLE_EXEC_ASYNC_SCALAR_MAX_ATTEMPTS)));
+    }
+
+    /** Options for configuring async behavior. */
+    public static class Options {
+
+        public final int asyncBufferCapacity;
+        public final long asyncTimeout;
+        public final AsyncDataStream.OutputMode asyncOutputMode;
+        public final AsyncRetryStrategy<RowData> asyncRetryStrategy;
+
+        public Options(
+                int asyncBufferCapacity,
+                long asyncTimeout,
+                AsyncDataStream.OutputMode asyncOutputMode,
+                AsyncRetryStrategy<RowData> asyncRetryStrategy) {
+            this.asyncBufferCapacity = asyncBufferCapacity;
+            this.asyncTimeout = asyncTimeout;
+            this.asyncOutputMode = asyncOutputMode;
+            this.asyncRetryStrategy = asyncRetryStrategy;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+            Options that = (Options) o;
+            return asyncBufferCapacity == that.asyncBufferCapacity
+                    && asyncTimeout == that.asyncTimeout
+                    && asyncOutputMode == that.asyncOutputMode;
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(asyncBufferCapacity, asyncTimeout, asyncOutputMode);
+        }
+
+        @Override
+        public String toString() {
+            return asyncOutputMode + ", " + asyncTimeout + "ms, " + asyncBufferCapacity;
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    private static AsyncRetryStrategy<RowData> getResultRetryStrategy(
+            ExecutionConfigOptions.RetryStrategy retryStrategy,
+            Duration retryDelay,
+            int retryMaxAttempts) {
+        // Only fixed delay is allowed at the moment, so just ignore the config.
+        if (retryStrategy == ExecutionConfigOptions.RetryStrategy.FIXED_DELAY) {
+            return new AsyncRetryStrategies.FixedDelayRetryStrategyBuilder<RowData>(
+                            retryMaxAttempts, retryDelay.toMillis())
+                    .ifResult(EMPTY_RESPONSE)
+                    .ifException(ANY_EXCEPTION)
+                    .build();
+        }
+        return AsyncRetryStrategies.NO_RETRY_STRATEGY;
+    }
+
+    private static class FunctionFinder extends RexDefaultVisitor<Boolean> {
+
+        private final boolean findAsyncCall;
+        private final boolean recursive;
+
+        public FunctionFinder(boolean findAsyncCall, boolean recursive) {
+            this.findAsyncCall = findAsyncCall;
+            this.recursive = recursive;
+        }
+
+        @Override
+        public Boolean visitNode(RexNode rexNode) {
+            return false;
+        }
+
+        private boolean isImmediateAsyncCall(RexCall call) {
+            FunctionDefinition definition = ShortcutUtils.unwrapFunctionDefinition(call);
+            return definition != null && definition.getKind() == FunctionKind.ASYNC_SCALAR;
+        }
+
+        @Override
+        public Boolean visitCall(RexCall call) {
+            boolean isImmediateAsyncCall = isImmediateAsyncCall(call);
+            return findAsyncCall == isImmediateAsyncCall
+                    || (recursive
+                            && call.getOperands().stream().anyMatch(node -> node.accept(this)));
+        }
+    }
+}
diff --git a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/ExecNodeMetadataUtil.java b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/ExecNodeMetadataUtil.java
--- a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/ExecNodeMetadataUtil.java
+++ b/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/utils/ExecNodeMetadataUtil.java
@@ -29,6 +29,7 @@
 import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeMetadata;
 import org.apache.flink.table.planner.plan.nodes.exec.MultipleExecNodeMetadata;
 import org.apache.flink.table.planner.plan.nodes.exec.serde.JsonSerdeUtil;
+import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecAsyncCalc;
 import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecCalc;
 import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecChangelogNormalize;
 import org.apache.flink.table.planner.plan.nodes.exec.stream.StreamExecCorrelate;
@@ -139,6 +140,7 @@ private ExecNodeMetadataUtil() {
                     add(StreamExecWindowRank.class);
                     add(StreamExecWindowTableFunction.class);
                     add(StreamExecPythonCalc.class);
+                    add(StreamExecAsyncCalc.class);
                     add(StreamExecPythonCorrelate.class);
                     add(StreamExecPythonGroupAggregate.class);
                     add(StreamExecPythonGroupWindowAggregate.class);
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExpressionReducer.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExpressionReducer.scala
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExpressionReducer.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExpressionReducer.scala
@@ -26,6 +26,7 @@ import org.apache.flink.table.functions.{FunctionContext, UserDefinedFunction}
 import org.apache.flink.table.planner.calcite.FlinkTypeFactory
 import org.apache.flink.table.planner.codegen.FunctionCodeGenerator.generateFunction
 import org.apache.flink.table.planner.functions.sql.FlinkSqlOperatorTable.{JSON_ARRAY, JSON_OBJECT}
+import org.apache.flink.table.planner.plan.utils.AsyncUtil
 import org.apache.flink.table.planner.plan.utils.PythonUtil.containsPythonCall
 import org.apache.flink.table.planner.utils.JavaScalaConversionUtil.toScala
 import org.apache.flink.table.planner.utils.Logging
@@ -65,9 +66,9 @@ class ExpressionReducer(
       constExprs: java.util.List[RexNode],
       reducedValues: java.util.List[RexNode]): Unit = {
 
-    val pythonUDFExprs = new ListBuffer[RexNode]()
+    val remoteUDFExprs = new ListBuffer[RexNode]()
 
-    val literals = skipAndValidateExprs(rexBuilder, constExprs, pythonUDFExprs)
+    val literals = skipAndValidateExprs(rexBuilder, constExprs, remoteUDFExprs)
 
     val literalTypes = literals.map(e => FlinkTypeFactory.toLogicalType(e.getType))
     val resultType = RowType.of(literalTypes: _*)
@@ -131,8 +132,8 @@ class ExpressionReducer(
     while (i < constExprs.size()) {
       val unreduced = constExprs.get(i)
       // use eq to compare reference
-      if (pythonUDFExprs.exists(_ eq unreduced)) {
-        // if contains python function then just insert the original expression.
+      if (remoteUDFExprs.exists(_ eq unreduced)) {
+        // if contains async function then just insert the original expression.
         reducedValues.add(unreduced)
       } else
         unreduced match {
@@ -253,15 +254,15 @@ class ExpressionReducer(
   private def skipAndValidateExprs(
       rexBuilder: RexBuilder,
       constExprs: java.util.List[RexNode],
-      pythonUDFExprs: ListBuffer[RexNode]): List[RexNode] = {
+      remoteUDFExprs: ListBuffer[RexNode]): List[RexNode] = {
     constExprs.asScala
       .map(e => (e.getType.getSqlTypeName, e))
       .flatMap {
 
-        // Skip expressions that contain python functions because it's quite expensive to
-        // call Python UDFs during optimization phase. They will be optimized during the runtime.
-        case (_, e) if containsPythonCall(e) =>
-          pythonUDFExprs += e
+        // Skip expressions that contain python or async functions because it's quite expensive to
+        // call async UDFs during optimization phase. They will be optimized during the runtime.
+        case (_, e) if containsPythonCall(e) || AsyncUtil.containsAsyncCall(e) =>
+          remoteUDFExprs += e
           None
 
         // we don't support object literals yet, we skip those constant expressions
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/BridgingFunctionGenUtil.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/BridgingFunctionGenUtil.scala
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/BridgingFunctionGenUtil.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/BridgingFunctionGenUtil.scala
@@ -27,7 +27,7 @@ import org.apache.flink.table.expressions.ApiExpressionUtils.{typeLiteral, unres
 import org.apache.flink.table.expressions.Expression
 import org.apache.flink.table.functions._
 import org.apache.flink.table.functions.SpecializedFunction.{ExpressionEvaluator, ExpressionEvaluatorFactory}
-import org.apache.flink.table.functions.UserDefinedFunctionHelper.{validateClassForRuntime, ASYNC_TABLE_EVAL, SCALAR_EVAL, TABLE_EVAL}
+import org.apache.flink.table.functions.UserDefinedFunctionHelper.{validateClassForRuntime, ASYNC_SCALAR_EVAL, ASYNC_TABLE_EVAL, SCALAR_EVAL, TABLE_EVAL}
 import org.apache.flink.table.planner.calcite.{FlinkTypeFactory, RexFactory}
 import org.apache.flink.table.planner.codegen._
 import org.apache.flink.table.planner.codegen.CodeGenUtils._
@@ -47,6 +47,8 @@ import org.apache.flink.table.types.logical.utils.LogicalTypeChecks.isCompositeT
 import org.apache.flink.table.types.utils.DataTypeUtils.{isInternal, validateInputDataType, validateOutputDataType}
 import org.apache.flink.util.Preconditions
 
+import AsyncCodeGenerator.DEFAULT_DELEGATING_FUTURE_TERM
+
 import java.util.concurrent.CompletableFuture
 
 import scala.collection.JavaConverters._
@@ -147,6 +149,13 @@ object BridgingFunctionGenUtil {
         skipIfArgsNull)
     } else if (udf.getKind == FunctionKind.ASYNC_TABLE) {
       generateAsyncTableFunctionCall(functionTerm, externalOperands, returnType)
+    } else if (udf.getKind == FunctionKind.ASYNC_SCALAR) {
+      generateAsyncScalarFunctionCall(
+        ctx,
+        functionTerm,
+        externalOperands,
+        returnType,
+        outputDataType)
     } else {
       generateScalarFunctionCall(ctx, functionTerm, externalOperands, outputDataType)
     }
@@ -210,6 +219,28 @@ object BridgingFunctionGenUtil {
     GeneratedExpression(NO_CODE, NEVER_NULL, functionCallCode, outputType)
   }
 
+  private def generateAsyncScalarFunctionCall(
+      ctx: CodeGeneratorContext,
+      functionTerm: String,
+      externalOperands: Seq[GeneratedExpression],
+      outputType: LogicalType,
+      outputDataType: DataType): GeneratedExpression = {
+    val converterTerm = ctx.addReusableConverter(outputDataType)
+    val functionCallCode =
+      s"""
+         |${externalOperands.map(_.code).mkString("\n")}
+         |if (${externalOperands.map(_.nullTerm).mkString(" || ")}) {
+         |  $DEFAULT_DELEGATING_FUTURE_TERM.createAsyncFuture($converterTerm).complete(null);
+         |} else {
+         |  $functionTerm.eval(
+         |    $DEFAULT_DELEGATING_FUTURE_TERM.createAsyncFuture($converterTerm),
+         |    ${externalOperands.map(_.resultTerm).mkString(", ")});
+         |}
+         |""".stripMargin
+
+    GeneratedExpression(NO_CODE, NEVER_NULL, functionCallCode, outputType)
+  }
+
   /**
    * Generates a collector that converts the output of a table function (possibly as an atomic type)
    * into an internal row type. Returns a collector term for referencing the collector.
@@ -389,6 +420,13 @@ object BridgingFunctionGenUtil {
         functionName)
     } else if (udf.getKind == FunctionKind.SCALAR) {
       verifyImplementation(SCALAR_EVAL, argumentDataTypes, Some(outputDataType), udf, functionName)
+    } else if (udf.getKind == FunctionKind.ASYNC_SCALAR) {
+      verifyImplementation(
+        ASYNC_SCALAR_EVAL,
+        DataTypes.NULL.bridgedTo(classOf[CompletableFuture[_]]) +: argumentDataTypes,
+        None,
+        udf,
+        functionName)
     } else {
       throw new CodeGenException(
         s"Unsupported function kind '${udf.getKind}' for function '$functionName'.")
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkStreamRuleSets.scala
@@ -372,17 +372,48 @@ object FlinkStreamRuleSets {
     PushFilterInCalcIntoTableSourceScanRule.INSTANCE,
     // Rule that rewrites temporal join with extracted primary key
     TemporalJoinRewriteWithUniqueKeyRule.INSTANCE,
-    // Rule that splits python ScalarFunctions from java/scala ScalarFunctions.
+    // Avoids accessing a field from the result (condition).
     PythonCalcSplitRule.SPLIT_CONDITION_REX_FIELD,
+    // Avoids accessing a field from the result (projection).
     PythonCalcSplitRule.SPLIT_PROJECTION_REX_FIELD,
+    // Avoids dealing with a python call in the condition.
     PythonCalcSplitRule.SPLIT_CONDITION,
+    // Avoids dealing with Java calls in the same Calc as python calls.
     PythonCalcSplitRule.SPLIT_PROJECT,
+    // Splits calcs which contain both general Python functions and pandas Python functions
     PythonCalcSplitRule.SPLIT_PANDAS_IN_PROJECT,
+    // Avoid accessing a field as input to an async call with a single calc.
     PythonCalcSplitRule.EXPAND_PROJECT,
+    // Avoid having any condition in a python calc by pushing it first.
     PythonCalcSplitRule.PUSH_CONDITION,
+    // Orders the projections so that input references are first, followed by python calls.
     PythonCalcSplitRule.REWRITE_PROJECT,
+    // Renames the field names of the Flatten calc which is right after a calc representing a
+    // Python Map operation to the output names of the map function
     PythonMapRenameRule.INSTANCE,
-    PythonMapMergeRule.INSTANCE
+    // Merges Python calc used in Map operation, Flatten calcs and Python calcs used in Map
+    // xoperation together
+    PythonMapMergeRule.INSTANCE,
+    // Similar to the python rules above, the goal is to limit complexity of calcs which
+    // have async calls so that the implementation can be simplified to handle a single async call.
+    // Avoids accessing a field from an asynchronous result (condition).
+    AsyncCalcSplitRule.SPLIT_CONDITION_REX_FIELD,
+    // Avoids accessing a field from an asynchronous result (projection).
+    AsyncCalcSplitRule.SPLIT_PROJECTION_REX_FIELD,
+    // Avoids dealing with an async call in the condition.
+    AsyncCalcSplitRule.SPLIT_CONDITION,
+    // Avoids dealing with Java calls in the same Calc as Async calls.
+    AsyncCalcSplitRule.SPLIT_PROJECT,
+    // Avoid accessing a field as input to an async call with a single calc.
+    AsyncCalcSplitRule.EXPAND_PROJECT,
+    // Avoid having any condition in an async calc by pushing it first.
+    AsyncCalcSplitRule.PUSH_CONDITION,
+    // Orders the projections so that input references are first, followed by async calls.
+    AsyncCalcSplitRule.REWRITE_PROJECT,
+    // Avoid async calls which call async calls.
+    AsyncCalcSplitRule.NESTED_SPLIT,
+    // Avoid having async calls in multiple projections in a single calc.
+    AsyncCalcSplitRule.ONE_PER_CALC_SPLIT
   )
 
   /** RuleSet to do physical optimize for stream */
@@ -400,6 +431,7 @@ object FlinkStreamRuleSets {
     // calc
     StreamPhysicalCalcRule.INSTANCE,
     StreamPhysicalPythonCalcRule.INSTANCE,
+    StreamPhysicalAsyncCalcRule.INSTANCE,
     // union
     StreamPhysicalUnionRule.INSTANCE,
     // sort
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PythonCalcSplitRule.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PythonCalcSplitRule.scala
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PythonCalcSplitRule.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/PythonCalcSplitRule.scala
@@ -20,7 +20,7 @@ package org.apache.flink.table.planner.plan.rules.logical
 import org.apache.flink.table.functions.ScalarFunction
 import org.apache.flink.table.functions.python.PythonFunctionKind
 import org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalCalc
-import org.apache.flink.table.planner.plan.utils.{InputRefVisitor, RexDefaultVisitor}
+import org.apache.flink.table.planner.plan.utils.{InputRefVisitor, PythonUtil, RexDefaultVisitor}
 import org.apache.flink.table.planner.plan.utils.PythonUtil.{containsNonPythonCall, containsPythonCall, isNonPythonCall, isPythonCall}
 
 import org.apache.calcite.plan.{RelOptRule, RelOptRuleCall}
@@ -34,245 +34,14 @@ import scala.collection.JavaConversions._
 import scala.collection.JavaConverters._
 import scala.collection.mutable
 
-/**
- * Base rule that splits [[FlinkLogicalCalc]] into multiple [[FlinkLogicalCalc]]s. It is mainly to
- * ensure that each [[FlinkLogicalCalc]] only contains Java/Scala [[ScalarFunction]]s or Python
- * [[ScalarFunction]]s.
- */
-abstract class PythonCalcSplitRuleBase(description: String)
-  extends RelOptRule(operand(classOf[FlinkLogicalCalc], any), description) {
-
-  override def onMatch(call: RelOptRuleCall): Unit = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-    val input = calc.getInput
-    val rexBuilder = call.builder().getRexBuilder
-    val program = calc.getProgram
-    val extractedRexNodes = new mutable.ArrayBuffer[RexNode]()
-
-    val extractedFunctionOffset = input.getRowType.getFieldCount
-    val splitter = new ScalarFunctionSplitter(
-      program,
-      rexBuilder,
-      extractedFunctionOffset,
-      extractedRexNodes,
-      new Function[RexNode, Boolean] {
-        override def apply(node: RexNode): Boolean = needConvert(program, node)
-      })
-
-    val (bottomCalcCondition, topCalcCondition, topCalcProjects) = split(program, splitter)
-    val accessedFields =
-      extractRefInputFields(topCalcProjects, topCalcCondition, extractedFunctionOffset)
-
-    val bottomCalcProjects =
-      accessedFields.map(RexInputRef.of(_, input.getRowType)) ++ extractedRexNodes
-    val bottomCalcFieldNames = SqlValidatorUtil.uniquify(
-      accessedFields.map(i => input.getRowType.getFieldNames.get(i)).toSeq ++
-        extractedRexNodes.indices.map("f" + _),
-      rexBuilder.getTypeFactory.getTypeSystem.isSchemaCaseSensitive
-    )
-
-    val bottomCalc = new FlinkLogicalCalc(
-      calc.getCluster,
-      calc.getTraitSet,
-      input,
-      RexProgram.create(
-        input.getRowType,
-        bottomCalcProjects.toList,
-        bottomCalcCondition.orNull,
-        bottomCalcFieldNames,
-        rexBuilder))
-
-    val inputRewriter = new ExtractedFunctionInputRewriter(
-      calc.getCluster.getRexBuilder,
-      extractedFunctionOffset,
-      accessedFields)
-    val topCalc = new FlinkLogicalCalc(
-      calc.getCluster,
-      calc.getTraitSet,
-      bottomCalc,
-      RexProgram.create(
-        bottomCalc.getRowType,
-        topCalcProjects.map(_.accept(inputRewriter)),
-        topCalcCondition.map(_.accept(inputRewriter)).orNull,
-        calc.getRowType,
-        rexBuilder))
-
-    call.transformTo(topCalc)
-  }
-
-  /** Extracts the indices of the input fields referred by the specified projects and condition. */
-  private def extractRefInputFields(
-      projects: Seq[RexNode],
-      condition: Option[RexNode],
-      inputFieldsCount: Int): Array[Int] = {
-    val visitor = new InputRefVisitor
-
-    // extract referenced input fields from projections
-    projects.foreach(exp => exp.accept(visitor))
-
-    // extract referenced input fields from condition
-    condition.foreach(_.accept(visitor))
-
-    // fields of indexes greater than inputFieldsCount is the extracted functions and
-    // should be filtered as they are not from the original input
-    visitor.getFields.filter(_ < inputFieldsCount)
-  }
-
-  /** Returns true if need to convert the specified node. */
-  def needConvert(program: RexProgram, node: RexNode): Boolean
-
-  /**
-   * Splits the specified [[RexProgram]] using the specified [[ScalarFunctionSplitter]]. It returns
-   * a triple of (bottom calc condition, top calc condition, top calc projects) as the split result.
-   */
-  def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode])
-}
-
-/**
- * Rule that splits [[FlinkLogicalCalc]]s which contain Python functions in the condition into
- * multiple [[FlinkLogicalCalc]]s. After this rule is applied, there will be no Python functions in
- * the condition of the [[FlinkLogicalCalc]]s.
- */
-object PythonCalcSplitConditionRule
-  extends PythonCalcSplitRuleBase("PythonCalcSplitConditionRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-
-    // matches if it contains Python functions in condition
-    Option(calc.getProgram.getCondition)
-      .map(calc.getProgram.expandLocalRef)
-      .exists(containsPythonCall(_))
-  }
-
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = isPythonCall(node)
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      None,
-      Option(program.getCondition).map(program.expandLocalRef(_).accept(splitter)),
-      program.getProjectList.map(program.expandLocalRef))
-  }
-}
-
-abstract class PythonCalcSplitProjectionRuleBase(description: String)
-  extends PythonCalcSplitRuleBase(description) {
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      Option(program.getCondition).map(program.expandLocalRef),
-      None,
-      program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
-  }
-}
-
-abstract class PythonCalcSplitRexFieldRuleBase(description: String)
-  extends PythonCalcSplitRuleBase(description) {
-
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = {
-    node match {
-      case x: RexFieldAccess =>
-        x.getReferenceExpr match {
-          case y: RexLocalRef if containsPythonCall(program.expandLocalRef(y)) => true
-          case _ => false
-        }
-      case _ => false
-    }
-  }
-
-  protected def containsFieldAccessAfterPythonCall(node: RexNode): Boolean = {
-    node match {
-      case call: RexCall => call.getOperands.exists(containsFieldAccessAfterPythonCall)
-      case x: RexFieldAccess => containsPythonCall(x.getReferenceExpr)
-      case _ => false
-    }
-  }
-}
-
-/**
- * Rule that splits the RexField with the input of Python function contained in the projection of
- * [[FlinkLogicalCalc]]s.
- */
-object PythonCalcSplitProjectionRexFieldRule
-  extends PythonCalcSplitRexFieldRuleBase("PythonCalcSplitProjectionRexFieldRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-
-    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
-    projects.exists(containsFieldAccessAfterPythonCall)
-  }
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      Option(program.getCondition).map(program.expandLocalRef),
-      None,
-      program.getProjectList.map(_.accept(splitter)))
-  }
-}
-
-/**
- * Rule that splits the RexField with the input of Python function contained in the condition of
- * [[FlinkLogicalCalc]]s.
- */
-object PythonCalcSplitConditionRexFieldRule
-  extends PythonCalcSplitRexFieldRuleBase("PythonCalcSplitConditionRexFieldRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-
-    Option(calc.getProgram.getCondition)
-      .map(calc.getProgram.expandLocalRef)
-      .exists(containsFieldAccessAfterPythonCall)
-  }
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      None,
-      Option(program.getCondition).map(_.accept(splitter)),
-      program.getProjectList.map(_.accept(splitter)))
-  }
-}
-
-/**
- * Rule that splits [[FlinkLogicalCalc]]s which contain both Java functions and Python functions in
- * the projection into multiple [[FlinkLogicalCalc]]s. After this rule is applied, it will only
- * contain Python functions or Java functions in the projection of each [[FlinkLogicalCalc]].
- */
-object PythonCalcSplitProjectionRule
-  extends PythonCalcSplitProjectionRuleBase("PythonCalcSplitProjectionRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
-
-    // matches if it contains both Python functions and Java functions in the projection
-    projects.exists(containsPythonCall(_)) && projects.exists(containsNonPythonCall)
-  }
-
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = {
-    program.getProjectList.map(program.expandLocalRef).exists(isNonPythonCall) == isPythonCall(node)
-  }
-}
-
 /**
  * Rule that splits [[FlinkLogicalCalc]]s which contain both general Python functions and pandas
  * Python functions in the projection into multiple [[FlinkLogicalCalc]]s. After this rule is
  * applied, it will only contain general Python functions or pandas Python functions in the
  * projection of each [[FlinkLogicalCalc]].
  */
-object PythonCalcSplitPandasInProjectionRule
-  extends PythonCalcSplitProjectionRuleBase("PythonCalcSplitPandasInProjectionRule") {
+class PythonCalcSplitPandasInProjectionRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitProjectionRuleBase("PythonCalcSplitPandasInProjectionRule", callFinder) {
 
   override def matches(call: RelOptRuleCall): Boolean = {
     val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
@@ -284,7 +53,10 @@ object PythonCalcSplitPandasInProjectionRule
     projects.exists(containsPythonCall(_, PythonFunctionKind.PANDAS))
   }
 
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = {
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean = {
     program.getProjectList
       .map(program.expandLocalRef)
       .exists(isPythonCall(_, PythonFunctionKind.GENERAL)) == isPythonCall(
@@ -293,222 +65,37 @@ object PythonCalcSplitPandasInProjectionRule
   }
 }
 
-/**
- * Rule that expands the RexFieldAccess inputs of Python functions contained in the projection of
- * [[FlinkLogicalCalc]]s.
- */
-object PythonCalcExpandProjectRule extends PythonCalcSplitRuleBase("PythonCalcExpandProjectRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
-
-    projects.exists(containsPythonCall(_)) && projects.exists(containsFieldAccessInputs)
+class PythonRemoteCalcCallFinder extends RemoteCalcCallFinder {
+  override def containsRemoteCall(node: RexNode): Boolean = {
+    PythonUtil.containsPythonCall(node)
   }
 
-  override def needConvert(program: RexProgram, node: RexNode): Boolean =
-    node.isInstanceOf[RexFieldAccess]
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      Option(program.getCondition).map(program.expandLocalRef),
-      None,
-      program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
-  }
-
-  private def containsFieldAccessInputs(node: RexNode): Boolean = {
-    node match {
-      case call: RexCall => call.getOperands.exists(containsFieldAccessInputs)
-      case _: RexFieldAccess => true
-      case _ => false
-    }
+  override def containsNonRemoteCall(node: RexNode): Boolean = {
+    PythonUtil.containsNonPythonCall(node)
   }
-}
-
-/**
- * Rule that pushes the condition of [[FlinkLogicalCalc]]s before it for the [[FlinkLogicalCalc]]s
- * which contain Python functions in the projection.
- */
-object PythonCalcPushConditionRule extends PythonCalcSplitRuleBase("PythonCalcPushConditionRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
 
-    // matches if all the following conditions hold true:
-    // 1) the condition is not null
-    // 2) it contains Python functions in the projection
-    calc.getProgram.getCondition != null && projects.exists(containsPythonCall(_))
+  override def isRemoteCall(node: RexNode): Boolean = {
+    PythonUtil.isPythonCall(node)
   }
 
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = isNonPythonCall(node)
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (
-      Option(program.getCondition).map(program.expandLocalRef),
-      None,
-      program.getProjectList.map(program.expandLocalRef))
+  override def isNonRemoteCall(node: RexNode): Boolean = {
+    PythonUtil.isNonPythonCall(node)
   }
 }
 
-/**
- * Rule that ensures that it only contains [[RexInputRef]]s at the beginning of the project list and
- * [[RexCall]]s at the end of the project list for [[FlinkLogicalCalc]]s which contain Python
- * functions in the projection. This rule exists to keep DataStreamPythonCalc as simple as possible
- * and ensures that it only needs to handle the Python function execution.
- */
-object PythonCalcRewriteProjectionRule
-  extends PythonCalcSplitRuleBase("PythonCalcRewriteProjectionRule") {
-
-  override def matches(call: RelOptRuleCall): Boolean = {
-    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
-    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
-
-    // matches if all the following conditions hold true:
-    // 1) it contains Python functions in the projection
-    // 2) it contains RexNodes besides RexInputRef and RexCall or
-    //    not all the RexCalls lying at the end of the project list
-    projects.exists(containsPythonCall(_)) &&
-    (projects.exists(expr => !expr.isInstanceOf[RexCall] && !expr.isInstanceOf[RexInputRef]) ||
-      projects.indexWhere(_.isInstanceOf[RexCall]) <
-      projects.lastIndexWhere(_.isInstanceOf[RexInputRef]))
-  }
-
-  override def needConvert(program: RexProgram, node: RexNode): Boolean = isPythonCall(node)
-
-  override def split(
-      program: RexProgram,
-      splitter: ScalarFunctionSplitter): (Option[RexNode], Option[RexNode], Seq[RexNode]) = {
-    (None, None, program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
-  }
-}
-
-private class ScalarFunctionSplitter(
-    program: RexProgram,
-    rexBuilder: RexBuilder,
-    extractedFunctionOffset: Int,
-    extractedRexNodes: mutable.ArrayBuffer[RexNode],
-    needConvert: Function[RexNode, Boolean])
-  extends RexDefaultVisitor[RexNode] {
-
-  private var fieldsRexCall: Map[Int, Int] = Map[Int, Int]()
-
-  override def visitCall(call: RexCall): RexNode = {
-    if (needConvert(call)) {
-      getExtractedRexNode(call)
-    } else {
-      call.clone(call.getType, call.getOperands.asScala.map(_.accept(this)))
-    }
-  }
-
-  override def visitFieldAccess(fieldAccess: RexFieldAccess): RexNode = {
-    if (needConvert(fieldAccess)) {
-      val expr = fieldAccess.getReferenceExpr
-      expr match {
-        case localRef: RexLocalRef if containsPythonCall(program.expandLocalRef(localRef)) =>
-          getExtractedRexFieldAccess(fieldAccess, localRef.getIndex)
-        case _: RexCorrelVariable =>
-          val field = fieldAccess.getField
-          new RexInputRef(field.getIndex, field.getType)
-        case _ =>
-          val newFieldAccess =
-            rexBuilder.makeFieldAccess(expr.accept(this), fieldAccess.getField.getIndex)
-          getExtractedRexNode(newFieldAccess)
-      }
-    } else {
-      fieldAccess
-    }
-  }
-
-  override def visitLocalRef(localRef: RexLocalRef): RexNode = {
-    program.getExprList.get(localRef.getIndex).accept(this)
-  }
-
-  override def visitNode(rexNode: RexNode): RexNode = rexNode
-
-  private def getExtractedRexNode(node: RexNode): RexNode = {
-    val newNode = new RexInputRef(extractedFunctionOffset + extractedRexNodes.length, node.getType)
-    extractedRexNodes.append(node)
-    newNode
-  }
-
-  private def getExtractedRexFieldAccess(node: RexFieldAccess, rexCallIndex: Int): RexNode = {
-    val pythonCall: RexCall =
-      program.expandLocalRef(node.getReferenceExpr.asInstanceOf[RexLocalRef]).asInstanceOf[RexCall]
-    if (!fieldsRexCall.contains(rexCallIndex)) {
-      extractedRexNodes.append(pythonCall)
-      fieldsRexCall += rexCallIndex -> (extractedFunctionOffset + extractedRexNodes.length - 1)
-    }
-    rexBuilder.makeFieldAccess(
-      new RexInputRef(fieldsRexCall(rexCallIndex), pythonCall.getType),
-      node.getField.getIndex)
-  }
-}
-
-/**
- * Rewrite field accesses of a RexNode as not all the fields from the original input are forwarded:
- * 1) Fields of index greater than or equal to extractedFunctionOffset refer to the extracted
- * function. 2) Fields of index less than extractedFunctionOffset refer to the original input field.
- *
- * @param rexBuilder
- *   the RexBuilder
- * @param extractedFunctionOffset
- *   the original start offset of the extracted functions
- * @param accessedFields
- *   the accessed fields which will be forwarded
- */
-private class ExtractedFunctionInputRewriter(
-    rexBuilder: RexBuilder,
-    extractedFunctionOffset: Int,
-    accessedFields: Array[Int])
-  extends RexDefaultVisitor[RexNode] {
-
-  /** old input fields ref index -> new input fields ref index mappings */
-  private val fieldMap: Map[Int, Int] = accessedFields.zipWithIndex.toMap
-
-  override def visitInputRef(inputRef: RexInputRef): RexNode = {
-    if (inputRef.getIndex >= extractedFunctionOffset) {
-      new RexInputRef(
-        inputRef.getIndex - extractedFunctionOffset + accessedFields.length,
-        inputRef.getType)
-    } else {
-      new RexInputRef(
-        fieldMap.getOrElse(
-          inputRef.getIndex,
-          throw new IllegalArgumentException("input field contains invalid index")),
-        inputRef.getType)
-    }
-  }
-
-  override def visitCall(call: RexCall): RexNode = {
-    call.clone(call.getType, call.getOperands.asScala.map(_.accept(this)))
-  }
-
-  override def visitFieldAccess(fieldAccess: RexFieldAccess): RexNode = {
-    rexBuilder.makeFieldAccess(
-      fieldAccess.getReferenceExpr.accept(this),
-      fieldAccess.getField.getIndex)
-  }
-
-  override def visitNode(rexNode: RexNode): RexNode = rexNode
-}
-
 object PythonCalcSplitRule {
 
   /**
    * These rules should be applied sequentially in the order of SPLIT_CONDITION, SPLIT_PROJECT,
    * SPLIT_PANDAS_IN_PROJECT, EXPAND_PROJECT, PUSH_CONDITION and REWRITE_PROJECT.
    */
-  val SPLIT_CONDITION: RelOptRule = PythonCalcSplitConditionRule
-  val SPLIT_PROJECT: RelOptRule = PythonCalcSplitProjectionRule
-  val SPLIT_PANDAS_IN_PROJECT: RelOptRule = PythonCalcSplitPandasInProjectionRule
-  val SPLIT_PROJECTION_REX_FIELD: RelOptRule = PythonCalcSplitProjectionRexFieldRule
-  val SPLIT_CONDITION_REX_FIELD: RelOptRule = PythonCalcSplitConditionRexFieldRule
-  val EXPAND_PROJECT: RelOptRule = PythonCalcExpandProjectRule
-  val PUSH_CONDITION: RelOptRule = PythonCalcPushConditionRule
-  val REWRITE_PROJECT: RelOptRule = PythonCalcRewriteProjectionRule
+  private val callFinder = new PythonRemoteCalcCallFinder()
+  val SPLIT_CONDITION: RelOptRule = new RemoteCalcSplitConditionRule(callFinder)
+  val SPLIT_PROJECT: RelOptRule = new RemoteCalcSplitProjectionRule(callFinder)
+  val SPLIT_PANDAS_IN_PROJECT: RelOptRule = new PythonCalcSplitPandasInProjectionRule(callFinder)
+  val SPLIT_PROJECTION_REX_FIELD: RelOptRule = new RemoteCalcSplitProjectionRexFieldRule(callFinder)
+  val SPLIT_CONDITION_REX_FIELD: RelOptRule = new RemoteCalcSplitConditionRexFieldRule(callFinder)
+  val EXPAND_PROJECT: RelOptRule = new RemoteCalcExpandProjectRule(callFinder)
+  val PUSH_CONDITION: RelOptRule = new RemoteCalcPushConditionRule(callFinder)
+  val REWRITE_PROJECT: RelOptRule = new RemoteCalcRewriteProjectionRule(callFinder)
 }
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcCallFinder.java b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcCallFinder.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcCallFinder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.planner.plan.rules.logical;
+
+import org.apache.calcite.rex.RexNode;
+
+/**
+ * Finds whether a {@link RexNode} contains remote calls or not.
+ */
+public interface RemoteCalcCallFinder {
+
+    // If the node contains directly or indirectly a remote call.
+    boolean containsRemoteCall(RexNode node);
+    // If the node contains directly or indirectly a non-remote call.
+    boolean containsNonRemoteCall(RexNode node);
+    // If the node contains directly a remote call.
+    boolean isRemoteCall(RexNode node);
+
+    // If the node contains directly a non-remote call.
+    boolean isNonRemoteCall(RexNode node);
+}
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcSplitRule.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcSplitRule.scala
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/RemoteCalcSplitRule.scala
@@ -0,0 +1,525 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flink.table.planner.plan.rules.logical
+
+import org.apache.flink.table.functions.ScalarFunction
+import org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalCalc
+import org.apache.flink.table.planner.plan.utils.{InputRefVisitor, RexDefaultVisitor}
+
+import org.apache.calcite.plan.{RelOptRule, RelOptRuleCall}
+import org.apache.calcite.plan.RelOptRule.{any, operand}
+import org.apache.calcite.rex.{RexBuilder, RexCall, RexCorrelVariable, RexFieldAccess, RexInputRef, RexLocalRef, RexNode, RexProgram}
+import org.apache.calcite.sql.validate.SqlValidatorUtil
+
+import java.util.function.Function
+
+import scala.collection.JavaConversions._
+import scala.collection.JavaConverters._
+import scala.collection.mutable
+
+/**
+ * Base rule that splits [[FlinkLogicalCalc]] into multiple [[FlinkLogicalCalc]]s. It is mainly to
+ * ensure that each [[FlinkLogicalCalc]] only contains Java/Scala [[ScalarFunction]]s or Remote
+ * [[ScalarFunction]]s.
+ */
+abstract class RemoteCalcSplitRuleBase[T](
+    description: String,
+    protected val callFinder: RemoteCalcCallFinder)
+  extends RelOptRule(operand(classOf[FlinkLogicalCalc], any), description) {
+
+  // Consider the rules to be equal if they are the same class and their call finders are the same
+  // class.
+  override def equals(obj: Any): Boolean = {
+    obj match {
+      case base: RemoteCalcSplitRuleBase[_] =>
+        super.equals(base) && callFinder.getClass.equals(base.callFinder.getClass)
+      case _ => false
+    }
+  }
+
+  override def onMatch(call: RelOptRuleCall): Unit = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+    val input = calc.getInput
+    val rexBuilder = call.builder().getRexBuilder
+    val program = calc.getProgram
+    val extractedRexNodes = new mutable.ArrayBuffer[RexNode]()
+
+    val extractedFunctionOffset = input.getRowType.getFieldCount
+    val matchState = getMatchState;
+    val splitter = new ScalarFunctionSplitter(
+      program,
+      rexBuilder,
+      extractedFunctionOffset,
+      extractedRexNodes,
+      new Function[RexNode, Boolean] {
+        override def apply(node: RexNode): Boolean = needConvert(program, node, matchState)
+      },
+      callFinder)
+
+    val splitComponents = split(program, splitter)
+    val accessedFields =
+      extractRefInputFields(
+        splitComponents.topCalcProjects,
+        splitComponents.topCalcCondition,
+        extractedFunctionOffset)
+
+    val bottomCalcProjects =
+      accessedFields.map(RexInputRef.of(_, input.getRowType)) ++ extractedRexNodes
+    val bottomCalcFieldNames = SqlValidatorUtil.uniquify(
+      accessedFields.map(i => input.getRowType.getFieldNames.get(i)).toSeq ++
+        extractedRexNodes.indices.map("f" + _),
+      rexBuilder.getTypeFactory.getTypeSystem.isSchemaCaseSensitive
+    )
+
+    val bottomCalc = new FlinkLogicalCalc(
+      calc.getCluster,
+      calc.getTraitSet,
+      input,
+      RexProgram.create(
+        input.getRowType,
+        bottomCalcProjects.toList,
+        splitComponents.bottomCalcCondition.orNull,
+        bottomCalcFieldNames,
+        rexBuilder))
+
+    val inputRewriter = new ExtractedFunctionInputRewriter(
+      calc.getCluster.getRexBuilder,
+      extractedFunctionOffset,
+      accessedFields)
+    val topCalc = new FlinkLogicalCalc(
+      calc.getCluster,
+      calc.getTraitSet,
+      bottomCalc,
+      RexProgram.create(
+        bottomCalc.getRowType,
+        splitComponents.topCalcProjects.map(_.accept(inputRewriter)),
+        splitComponents.topCalcCondition.map(_.accept(inputRewriter)).orNull,
+        calc.getRowType,
+        rexBuilder
+      ))
+
+    call.transformTo(topCalc)
+  }
+
+  /** Extracts the indices of the input fields referred by the specified projects and condition. */
+  private def extractRefInputFields(
+      projects: Seq[RexNode],
+      condition: Option[RexNode],
+      inputFieldsCount: Int): Array[Int] = {
+    val visitor = new InputRefVisitor
+
+    // extract referenced input fields from projections
+    projects.foreach(exp => exp.accept(visitor))
+
+    // extract referenced input fields from condition
+    condition.foreach(_.accept(visitor))
+
+    // fields of indexes greater than inputFieldsCount is the extracted functions and
+    // should be filtered as they are not from the original input
+    visitor.getFields.filter(_ < inputFieldsCount)
+  }
+
+  /** Returns true if need to convert the specified node. */
+  def getMatchState: Option[T] = {
+    Option.empty
+  }
+
+  /** Returns true if need to convert the specified node. */
+  def needConvert(program: RexProgram, node: RexNode, matchState: Option[T]): Boolean
+
+  /**
+   * Splits the specified [[RexProgram]] using the specified [[ScalarFunctionSplitter]]. It returns
+   * a triple of (bottom calc condition, top calc condition, top calc projects) as the split result.
+   */
+  def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents
+}
+
+/**
+ * The components for splitting a single calc into two calcs.
+ *
+ * @param bottomCalcCondition
+ *   Which RexNode should be a condition in the bottom calc
+ * @param topCalcCondition
+ *   Which RexNode should be a condition in the top calc
+ * @param topCalcProjects
+ *   Which RexNodes should be projections in the top calc
+ */
+class SplitComponents(
+    var bottomCalcCondition: Option[RexNode],
+    var topCalcCondition: Option[RexNode],
+    var topCalcProjects: Seq[RexNode]) {}
+
+/**
+ * Rule that splits [[FlinkLogicalCalc]]s which contain Remote functions in the condition into
+ * multiple [[FlinkLogicalCalc]]s. After this rule is applied, there will be no Remote functions in
+ * the condition of the [[FlinkLogicalCalc]]s.
+ */
+class RemoteCalcSplitConditionRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase("RemoteCalcSplitConditionRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+
+    // matches if it contains Remote functions in condition
+    Option(calc.getProgram.getCondition)
+      .map(calc.getProgram.expandLocalRef)
+      .exists(callFinder.containsRemoteCall)
+  }
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean =
+    callFinder.isRemoteCall(node)
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      None,
+      Option(program.getCondition).map(program.expandLocalRef(_).accept(splitter)),
+      program.getProjectList.map(program.expandLocalRef))
+  }
+}
+
+abstract class RemoteCalcSplitProjectionRuleBase[T](
+    description: String,
+    callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase[T](description, callFinder) {
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      Option(program.getCondition).map(program.expandLocalRef),
+      None,
+      program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
+  }
+}
+
+abstract class RemoteCalcSplitRexFieldRuleBase(
+    description: String,
+    callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase(description, callFinder) {
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean = {
+    node match {
+      case x: RexFieldAccess =>
+        x.getReferenceExpr match {
+          case y: RexLocalRef if callFinder.containsRemoteCall(program.expandLocalRef(y)) => true
+          case _ => false
+        }
+      case _ => false
+    }
+  }
+
+  protected def containsFieldAccessAfterRemoteCall(node: RexNode): Boolean = {
+    node match {
+      case call: RexCall => call.getOperands.exists(containsFieldAccessAfterRemoteCall)
+      case x: RexFieldAccess => callFinder.containsRemoteCall(x.getReferenceExpr)
+      case _ => false
+    }
+  }
+}
+
+/**
+ * Rule that splits the RexField with the input of Remote function contained in the projection of
+ * [[FlinkLogicalCalc]]s.
+ */
+class RemoteCalcSplitProjectionRexFieldRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRexFieldRuleBase("RemoteCalcSplitProjectionRexFieldRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+
+    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
+    projects.exists(containsFieldAccessAfterRemoteCall)
+  }
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      Option(program.getCondition).map(program.expandLocalRef),
+      None,
+      program.getProjectList.map(_.accept(splitter)))
+  }
+}
+
+/**
+ * Rule that splits the RexField with the input of Remote function contained in the condition of
+ * [[FlinkLogicalCalc]]s.
+ */
+class RemoteCalcSplitConditionRexFieldRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRexFieldRuleBase("RemoteCalcSplitConditionRexFieldRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+
+    Option(calc.getProgram.getCondition)
+      .map(calc.getProgram.expandLocalRef)
+      .exists(containsFieldAccessAfterRemoteCall)
+  }
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      None,
+      Option(program.getCondition).map(_.accept(splitter)),
+      program.getProjectList.map(_.accept(splitter)))
+  }
+}
+
+/**
+ * Rule that splits [[FlinkLogicalCalc]]s which contain both Java functions and Remote functions in
+ * the projection into multiple [[FlinkLogicalCalc]]s. After this rule is applied, it will only
+ * contain Remote functions or Java functions in the projection of each [[FlinkLogicalCalc]].
+ */
+class RemoteCalcSplitProjectionRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitProjectionRuleBase("RemoteCalcSplitProjectionRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
+
+    // matches if it contains both Remote functions and Java functions in the projection
+    projects.exists(callFinder.containsRemoteCall) && projects.exists(
+      callFinder.containsNonRemoteCall)
+  }
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean = {
+    program.getProjectList
+      .map(program.expandLocalRef)
+      .exists(callFinder.isNonRemoteCall) == callFinder.isRemoteCall(node)
+  }
+}
+
+/**
+ * Rule that expands the RexFieldAccess inputs of Remote functions contained in the projection of
+ * [[FlinkLogicalCalc]]s.
+ */
+class RemoteCalcExpandProjectRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase("RemoteCalcExpandProjectRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
+
+    projects.exists(callFinder.containsRemoteCall) && projects.exists(containsFieldAccessInputs)
+  }
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean =
+    node.isInstanceOf[RexFieldAccess]
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      Option(program.getCondition).map(program.expandLocalRef),
+      None,
+      program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
+  }
+
+  private def containsFieldAccessInputs(node: RexNode): Boolean = {
+    node match {
+      case call: RexCall => call.getOperands.exists(containsFieldAccessInputs)
+      case _: RexFieldAccess => true
+      case _ => false
+    }
+  }
+}
+
+/**
+ * Rule that pushes the condition of [[FlinkLogicalCalc]]s before it for the [[FlinkLogicalCalc]]s
+ * which contain Remote functions in the projection.
+ */
+class RemoteCalcPushConditionRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase("RemoteCalcPushConditionRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
+
+    // matches if all the following conditions hold true:
+    // 1) the condition is not null
+    // 2) it contains Remote functions in the projection
+    calc.getProgram.getCondition != null && projects.exists(callFinder.containsRemoteCall)
+  }
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean =
+    callFinder.isNonRemoteCall(node)
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      Option(program.getCondition).map(program.expandLocalRef),
+      None,
+      program.getProjectList.map(program.expandLocalRef))
+  }
+}
+
+/**
+ * Rule that ensures that it only contains [[RexInputRef]]s at the beginning of the project list and
+ * [[RexCall]]s at the end of the project list for [[FlinkLogicalCalc]]s which contain Remote
+ * functions in the projection. This rule exists to keep implementations as simple as possible and
+ * ensures that it only needs to handle the Remote function execution.
+ */
+class RemoteCalcRewriteProjectionRule(callFinder: RemoteCalcCallFinder)
+  extends RemoteCalcSplitRuleBase("RemoteCalcRewriteProjectionRule", callFinder) {
+
+  override def matches(call: RelOptRuleCall): Boolean = {
+    val calc: FlinkLogicalCalc = call.rel(0).asInstanceOf[FlinkLogicalCalc]
+    val projects = calc.getProgram.getProjectList.map(calc.getProgram.expandLocalRef)
+
+    // matches if all the following conditions hold true:
+    // 1) it contains Remote functions in the projection
+    // 2) it contains RexNodes besides RexInputRef and RexCall or
+    //    not all the RexCalls lying at the end of the project list
+    projects.exists(callFinder.containsRemoteCall) &&
+    (projects.exists(expr => !expr.isInstanceOf[RexCall] && !expr.isInstanceOf[RexInputRef]) ||
+      projects.indexWhere(_.isInstanceOf[RexCall]) <
+      projects.lastIndexWhere(_.isInstanceOf[RexInputRef]))
+  }
+
+  override def needConvert(
+      program: RexProgram,
+      node: RexNode,
+      matchState: Option[Nothing]): Boolean =
+    callFinder.isRemoteCall(node)
+
+  override def split(program: RexProgram, splitter: ScalarFunctionSplitter): SplitComponents = {
+    new SplitComponents(
+      None,
+      None,
+      program.getProjectList.map(program.expandLocalRef(_).accept(splitter)))
+  }
+}
+
+class ScalarFunctionSplitter(
+    program: RexProgram,
+    rexBuilder: RexBuilder,
+    extractedFunctionOffset: Int,
+    extractedRexNodes: mutable.ArrayBuffer[RexNode],
+    needConvert: Function[RexNode, Boolean],
+    callFinder: RemoteCalcCallFinder)
+  extends RexDefaultVisitor[RexNode] {
+
+  private var fieldsRexCall: Map[Int, Int] = Map[Int, Int]()
+
+  override def visitCall(call: RexCall): RexNode = {
+    if (needConvert(call)) {
+      getExtractedRexNode(call)
+    } else {
+      call.clone(call.getType, call.getOperands.asScala.map(_.accept(this)))
+    }
+  }
+
+  override def visitFieldAccess(fieldAccess: RexFieldAccess): RexNode = {
+    if (needConvert(fieldAccess)) {
+      val expr = fieldAccess.getReferenceExpr
+      expr match {
+        case localRef: RexLocalRef
+            if callFinder.containsRemoteCall(program.expandLocalRef(localRef)) =>
+          getExtractedRexFieldAccess(fieldAccess, localRef.getIndex)
+        case _: RexCorrelVariable =>
+          val field = fieldAccess.getField
+          new RexInputRef(field.getIndex, field.getType)
+        case _ =>
+          val newFieldAccess =
+            rexBuilder.makeFieldAccess(expr.accept(this), fieldAccess.getField.getIndex)
+          getExtractedRexNode(newFieldAccess)
+      }
+    } else {
+      fieldAccess
+    }
+  }
+
+  override def visitLocalRef(localRef: RexLocalRef): RexNode = {
+    program.getExprList.get(localRef.getIndex).accept(this)
+  }
+
+  override def visitNode(rexNode: RexNode): RexNode = rexNode
+
+  private def getExtractedRexNode(node: RexNode): RexNode = {
+    val newNode = new RexInputRef(extractedFunctionOffset + extractedRexNodes.length, node.getType)
+    extractedRexNodes.append(node)
+    newNode
+  }
+
+  private def getExtractedRexFieldAccess(node: RexFieldAccess, rexCallIndex: Int): RexNode = {
+    val remoteCall: RexCall =
+      program.expandLocalRef(node.getReferenceExpr.asInstanceOf[RexLocalRef]).asInstanceOf[RexCall]
+    if (!fieldsRexCall.contains(rexCallIndex)) {
+      extractedRexNodes.append(remoteCall)
+      fieldsRexCall += rexCallIndex -> (extractedFunctionOffset + extractedRexNodes.length - 1)
+    }
+    rexBuilder.makeFieldAccess(
+      new RexInputRef(fieldsRexCall(rexCallIndex), remoteCall.getType),
+      node.getField.getIndex)
+  }
+}
+
+/**
+ * Rewrite field accesses of a RexNode as not all the fields from the original input are forwarded:
+ * 1) Fields of index greater than or equal to extractedFunctionOffset refer to the extracted
+ * function. 2) Fields of index less than extractedFunctionOffset refer to the original input field.
+ *
+ * @param rexBuilder
+ *   the RexBuilder
+ * @param extractedFunctionOffset
+ *   the original start offset of the extracted functions
+ * @param accessedFields
+ *   the accessed fields which will be forwarded
+ */
+private class ExtractedFunctionInputRewriter(
+    rexBuilder: RexBuilder,
+    extractedFunctionOffset: Int,
+    accessedFields: Array[Int])
+  extends RexDefaultVisitor[RexNode] {
+
+  /** old input fields ref index -> new input fields ref index mappings */
+  private val fieldMap: Map[Int, Int] = accessedFields.zipWithIndex.toMap
+
+  override def visitInputRef(inputRef: RexInputRef): RexNode = {
+    if (inputRef.getIndex >= extractedFunctionOffset) {
+      new RexInputRef(
+        inputRef.getIndex - extractedFunctionOffset + accessedFields.length,
+        inputRef.getType)
+    } else {
+      new RexInputRef(
+        fieldMap.getOrElse(
+          inputRef.getIndex,
+          throw new IllegalArgumentException("input field contains invalid index")),
+        inputRef.getType)
+    }
+  }
+
+  override def visitCall(call: RexCall): RexNode = {
+    call.clone(call.getType, call.getOperands.asScala.map(_.accept(this)))
+  }
+
+  override def visitFieldAccess(fieldAccess: RexFieldAccess): RexNode = {
+    rexBuilder.makeFieldAccess(
+      fieldAccess.getReferenceExpr.accept(this),
+      fieldAccess.getField.getIndex)
+  }
+
+  override def visitNode(rexNode: RexNode): RexNode = rexNode
+}
diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalCalcRule.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalCalcRule.scala
--- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalCalcRule.scala
+++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/stream/StreamPhysicalCalcRule.scala
@@ -20,6 +20,8 @@ package org.apache.flink.table.planner.plan.rules.physical.stream
 import org.apache.flink.table.planner.plan.nodes.FlinkConventions
 import org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalCalc
 import org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalCalc
+import org.apache.flink.table.planner.plan.utils.AsyncUtil
+import org.apache.flink.table.planner.plan.utils.AsyncUtil.containsAsyncCall
 import org.apache.flink.table.planner.plan.utils.PythonUtil.containsPythonCall
 
 import org.apache.calcite.plan.{RelOptRule, RelOptRuleCall, RelTraitSet}
@@ -35,7 +37,8 @@ class StreamPhysicalCalcRule(config: Config) extends ConverterRule(config) {
   override def matches(call: RelOptRuleCall): Boolean = {
     val calc: FlinkLogicalCalc = call.rel(0)
     val program = calc.getProgram
-    !program.getExprList.asScala.exists(containsPythonCall(_))
+    !program.getExprList.asScala.exists(containsPythonCall(_)) &&
+    !program.getExprList.asScala.exists(containsAsyncCall)
   }
 
   def convert(rel: RelNode): RelNode = {
diff --git a/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/AsyncFunctionRunner.java b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/AsyncFunctionRunner.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/AsyncFunctionRunner.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.operators.calc.async;
+
+import org.apache.flink.api.common.functions.OpenContext;
+import org.apache.flink.api.common.functions.util.FunctionUtils;
+import org.apache.flink.streaming.api.functions.async.AsyncFunction;
+import org.apache.flink.streaming.api.functions.async.ResultFuture;
+import org.apache.flink.streaming.api.functions.async.RichAsyncFunction;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.generated.GeneratedFunction;
+
+/**
+ * Async function runner for {@link org.apache.flink.table.functions.AsyncScalarFunction}, which
+ * takes the generated function, instantiates it, and then calls its lifecycle methods.
+ */
+public class AsyncFunctionRunner extends RichAsyncFunction<RowData, RowData> {
+
+    private static final long serialVersionUID = -6664660022391632123L;
+
+    private final GeneratedFunction<AsyncFunction<RowData, RowData>> generatedFetcher;
+
+    private transient AsyncFunction<RowData, RowData> fetcher;
+
+    public AsyncFunctionRunner(
+            GeneratedFunction<AsyncFunction<RowData, RowData>> generatedFetcher) {
+        this.generatedFetcher = generatedFetcher;
+    }
+
+    @Override
+    public void open(OpenContext openContext) throws Exception {
+        super.open(openContext);
+        fetcher = generatedFetcher.newInstance(getRuntimeContext().getUserCodeClassLoader());
+        FunctionUtils.setFunctionRuntimeContext(fetcher, getRuntimeContext());
+        FunctionUtils.openFunction(fetcher, openContext);
+    }
+
+    @Override
+    public void asyncInvoke(RowData input, ResultFuture<RowData> resultFuture) {
+        try {
+            fetcher.asyncInvoke(input, resultFuture);
+        } catch (Throwable t) {
+            resultFuture.completeExceptionally(t);
+        }
+    }
+
+    @Override
+    public void close() throws Exception {
+        super.close();
+        FunctionUtils.closeFunction(fetcher);
+    }
+}
diff --git a/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/DelegatingAsyncResultFuture.java b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/DelegatingAsyncResultFuture.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/DelegatingAsyncResultFuture.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.operators.calc.async;
+
+import org.apache.flink.streaming.api.functions.async.ResultFuture;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.conversion.DataStructureConverter;
+import org.apache.flink.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+
+/**
+ * Inspired by {@link org.apache.flink.table.runtime.operators.join.lookup.DelegatingResultFuture}
+ * for {@link org.apache.flink.table.functions.AsyncScalarFunction}.
+ */
+public class DelegatingAsyncResultFuture implements BiConsumer<Object, Throwable> {
+
+    private final ResultFuture<Object> delegatedResultFuture;
+    private final List<Object> synchronousResults = new ArrayList<>();
+    private Function<Object, RowData> outputFactory;
+    private CompletableFuture<Object> future;
+    private CompletableFuture<Object> convertedFuture;
+
+    public DelegatingAsyncResultFuture(ResultFuture<Object> delegatedResultFuture) {
+        this.delegatedResultFuture = delegatedResultFuture;
+    }
+
+    public synchronized void addSynchronousResult(Object object) {
+        synchronousResults.add(object);
+    }
+
+    public synchronized Object getSynchronousResult(int index) {
+        return synchronousResults.get(index);
+    }
+
+    public void setOutputFactory(Function<Object, RowData> outputFactory) {
+        this.outputFactory = outputFactory;
+    }
+
+    public CompletableFuture<?> createAsyncFuture(
+            DataStructureConverter<Object, Object> converter) {
+        Preconditions.checkState(future == null);
+        Preconditions.checkState(convertedFuture == null);
+        Preconditions.checkNotNull(outputFactory);
+        future = new CompletableFuture<>();
+        convertedFuture = future.thenApply(converter::toInternal);
+        this.convertedFuture.whenComplete(this);
+        return future;
+    }
+
+    @Override
+    public void accept(Object o, Throwable throwable) {
+        if (throwable != null) {
+            delegatedResultFuture.completeExceptionally(throwable);
+        } else {
+            try {
+                RowData rowData = outputFactory.apply(o);
+                delegatedResultFuture.complete(java.util.Collections.singleton(rowData));
+            } catch (Throwable t) {
+                delegatedResultFuture.completeExceptionally(t);
+            }
+        }
+    }
+}
diff --git a/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/RetryPredicates.java b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/RetryPredicates.java
new file mode 100644
--- /dev/null
+++ b/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/calc/async/RetryPredicates.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.table.runtime.operators.calc.async;
+
+import org.apache.flink.table.data.RowData;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.function.Predicate;
+
+/** Contains retry predicates used to determine if a result or error should result in a retry. */
+public class RetryPredicates {
+
+    public static final EmptyResponseResultStrategy EMPTY_RESPONSE =
+            new EmptyResponseResultStrategy();
+    public static final Predicate<Throwable> ANY_EXCEPTION = new AnyExceptionStrategy();
+
+    /** Returns true if the response is null or empty. */
+    public static class EmptyResponseResultStrategy
+            implements Predicate<Collection<RowData>>, Serializable {
+        private static final long serialVersionUID = 5065281655787318565L;
+
+        @Override
+        public boolean test(Collection<RowData> c) {
+            return null == c || c.isEmpty();
+        }
+    }
+
+    /** Returns true for any exception. */
+    public static class AnyExceptionStrategy implements Predicate<Throwable>, Serializable {
+
+        private static final long serialVersionUID = -46468466280154192L;
+
+        @Override
+        public boolean test(Throwable throwable) {
+            return true;
+        }
+    }
+}