[Git][java-team/eigenbase-farrago][upstream] New upstream version 0.9.0+dfsg
Andreas Tille (@tille)
gitlab at salsa.debian.org
Fri Aug 22 22:38:55 BST 2025
Andreas Tille pushed to branch upstream at Debian Java Maintainers / eigenbase-farrago
Commits:
3d7f079b by Andreas Tille at 2025-08-22T23:37:16+02:00
New upstream version 0.9.0+dfsg
- - - - -
14 changed files:
- + examples/miniplan/unitsql/miniplan.ref
- + examples/miniplan/unitsql/miniplan.sql
- + examples/rng/unitsql/createPreUpgrade.ref
- + examples/rng/unitsql/createPreUpgrade.sql
- + examples/rng/unitsql/installPlugin.ref
- + examples/rng/unitsql/installPlugin.sql
- + examples/rng/unitsql/testPlugin.ref
- + examples/rng/unitsql/testPlugin.sql
- + examples/rng/unitsql/verifyReplaceCatalog.ref
- + examples/rng/unitsql/verifyReplaceCatalog.sql
- + ext/mql/unitsql/connected.ref
- + ext/mql/unitsql/connected.sql
- + ext/mql/unitsql/disconnected.ref
- + ext/mql/unitsql/disconnected.sql
Changes:
=====================================
examples/miniplan/unitsql/miniplan.ref
=====================================
@@ -0,0 +1,126 @@
+> -- $Id: //open/dev/farrago/examples/miniplan/unitsql/miniplan.ref#1 $
+> -- Test the miniplan tutorial
+> -- If you get difs in this test, please update
+> -- http://pub.eigenbase.org/wiki/HowToWriteAnOptimizer
+> -- as part of updating the .ref file. Thanks!
+>
+> create schema miniplan;
+> set schema 'miniplan';
+> set path 'miniplan';
+>
+> -- register UDX we'll use to populate test data
+> create function ramp(n int)
+> returns table(i int)
+> language java
+> parameter style system defined java
+> no sql
+> external name 'class net.sf.farrago.test.FarragoTestUDR.ramp';
+>
+> -- define two physical partitions with identical table definition
+> -- column pk: primary key
+> -- column hicard: will contain mostly distinct values
+> -- column locard: will contain mostly duplicate values
+> create table t1(pk int not null primary key, hicard int, locard int);
+> create table t2(pk int not null primary key, hicard int, locard int);
+>
+> -- define a logical view combining the physical partitions
+> create view v as select * from t1 union all select * from t2;
+>
+> -- populate the first partition, manipulating the UDX output to produce the
+> -- desired data patterns
+> insert into t1(pk,hicard,locard)
+> select i,i*0.9,i*0.04 from table(ramp(1000));
+>
+> -- populate the second partition (with a similar but not identical data
+> -- distribution)
+> insert into t2(pk,hicard,locard)
+> select i+1000,i*0.8,i*0.05 from table(ramp(1000));
+>
+> -- make some stats on the data distribution available to the optimizer
+> analyze table t1 compute statistics for all columns;
+> analyze table t2 compute statistics for all columns;
+>
+> create jar miniplan_plugin
+> library 'file:${FARRAGO_HOME}/examples/miniplan/plugin/FarragoMiniplan.jar'
+> options(0);
+>
+> alter session implementation set jar miniplan.miniplan_plugin;
+>
+> !set outputformat csv
+>
+> explain plan for
+> select * from sales.depts union all select * from sales.depts;
+'column0'
+'FennelToIteratorConverter'
+' FennelMergeRel'
+' FtrsIndexScanRel(table=[[LOCALDB, SALES, DEPTS]], projection=[*], index=[SYS$CONSTRAINT_INDEX$SYS$PRIMARY_KEY$DEPTS], preserveOrder=[false])'
+' FtrsIndexScanRel(table=[[LOCALDB, SALES, DEPTS]], projection=[*], index=[SYS$CONSTRAINT_INDEX$SYS$PRIMARY_KEY$DEPTS], preserveOrder=[false])'
+>
+> explain plan excluding attributes for select sum(hicard) from miniplan.v;
+'column0'
+'FennelToIteratorConverter'
+' FennelAggRel'
+' FennelMergeRel'
+' FennelAggRel'
+' FtrsIndexScanRel'
+' FennelAggRel'
+' FtrsIndexScanRel'
+>
+> explain plan excluding attributes for select sum(hicard) from miniplan.v;
+'column0'
+'FennelToIteratorConverter'
+' FennelAggRel'
+' FennelMergeRel'
+' FennelAggRel'
+' FtrsIndexScanRel'
+' FennelAggRel'
+' FtrsIndexScanRel'
+>
+> explain plan excluding attributes for
+> select locard,sum(hicard) from miniplan.v group by locard;
+'column0'
+'FennelToIteratorConverter'
+' LhxAggRel'
+' FennelMergeRel'
+' LhxAggRel'
+' FtrsIndexScanRel'
+' LhxAggRel'
+' FtrsIndexScanRel'
+>
+> explain plan excluding attributes for
+> select hicard,sum(locard) from miniplan.v group by hicard;
+'column0'
+'FennelToIteratorConverter'
+' LhxAggRel'
+' FennelMergeRel'
+' LhxAggRel'
+' FtrsIndexScanRel'
+' LhxAggRel'
+' FtrsIndexScanRel'
+>
+> alter session set "volcano" = true;
+>
+> explain plan excluding attributes for
+> select locard,sum(hicard) from miniplan.v group by locard;
+'column0'
+'FennelToIteratorConverter'
+' LhxAggRel'
+' FennelMergeRel'
+' LhxAggRel'
+' FennelReshapeRel'
+' FtrsIndexScanRel'
+' LhxAggRel'
+' FennelReshapeRel'
+' FtrsIndexScanRel'
+>
+> explain plan excluding attributes for
+> select hicard,sum(locard) from miniplan.v group by hicard;
+'column0'
+'FennelToIteratorConverter'
+' LhxAggRel'
+' FennelMergeRel'
+' FtrsIndexScanRel'
+' FtrsIndexScanRel'
+>
+>
+> !quit
=====================================
examples/miniplan/unitsql/miniplan.sql
=====================================
@@ -0,0 +1,71 @@
+-- $Id: //open/dev/farrago/examples/miniplan/unitsql/miniplan.sql#1 $
+-- Test the miniplan tutorial
+-- If you get difs in this test, please update
+-- http://pub.eigenbase.org/wiki/HowToWriteAnOptimizer
+-- as part of updating the .ref file. Thanks!
+
+create schema miniplan;
+set schema 'miniplan';
+set path 'miniplan';
+
+-- register UDX we'll use to populate test data
+create function ramp(n int)
+returns table(i int)
+language java
+parameter style system defined java
+no sql
+external name 'class net.sf.farrago.test.FarragoTestUDR.ramp';
+
+-- define two physical partitions with identical table definition
+-- column pk: primary key
+-- column hicard: will contain mostly distinct values
+-- column locard: will contain mostly duplicate values
+create table t1(pk int not null primary key, hicard int, locard int);
+create table t2(pk int not null primary key, hicard int, locard int);
+
+-- define a logical view combining the physical partitions
+create view v as select * from t1 union all select * from t2;
+
+-- populate the first partition, manipulating the UDX output to produce the
+-- desired data patterns
+insert into t1(pk,hicard,locard)
+select i,i*0.9,i*0.04 from table(ramp(1000));
+
+-- populate the second partition (with a similar but not identical data
+-- distribution)
+insert into t2(pk,hicard,locard)
+select i+1000,i*0.8,i*0.05 from table(ramp(1000));
+
+-- make some stats on the data distribution available to the optimizer
+analyze table t1 compute statistics for all columns;
+analyze table t2 compute statistics for all columns;
+
+create jar miniplan_plugin
+library 'file:${FARRAGO_HOME}/examples/miniplan/plugin/FarragoMiniplan.jar'
+options(0);
+
+alter session implementation set jar miniplan.miniplan_plugin;
+
+!set outputformat csv
+
+explain plan for
+select * from sales.depts union all select * from sales.depts;
+
+explain plan excluding attributes for select sum(hicard) from miniplan.v;
+
+explain plan excluding attributes for select sum(hicard) from miniplan.v;
+
+explain plan excluding attributes for
+select locard,sum(hicard) from miniplan.v group by locard;
+
+explain plan excluding attributes for
+select hicard,sum(locard) from miniplan.v group by hicard;
+
+alter session set "volcano" = true;
+
+explain plan excluding attributes for
+select locard,sum(hicard) from miniplan.v group by locard;
+
+explain plan excluding attributes for
+select hicard,sum(locard) from miniplan.v group by hicard;
+
=====================================
examples/rng/unitsql/createPreUpgrade.ref
=====================================
@@ -0,0 +1,12 @@
+> -- $Id: //open/dev/farrago/examples/rng/unitsql/createPreUpgrade.ref#3 $
+> -- Test creation of objects which are to survive plugin installation
+>
+> -- before catalog upgrade, save a copy of the catalog with some objects in it
+> -- so that we can verify that catalog can be restored after upgrade;
+> -- we put stuff in sys_boot so that it won't be dropped by test cleanup
+> create schema sys_boot.old_stuff;
+> create table sys_boot.old_stuff.t(i int not null primary key);
+> call sys_boot.mgmt.export_catalog_xmi(
+> '${FARRAGO_HOME}/testgen/upgrade/FarragoCatalogDump.xmi');
+>
+> !quit
=====================================
examples/rng/unitsql/createPreUpgrade.sql
=====================================
@@ -0,0 +1,10 @@
+-- $Id: //open/dev/farrago/examples/rng/unitsql/createPreUpgrade.sql#1 $
+-- Test creation of objects which are to survive plugin installation
+
+-- before catalog upgrade, save a copy of the catalog with some objects in it
+-- so that we can verify that catalog can be restored after upgrade;
+-- we put stuff in sys_boot so that it won't be dropped by test cleanup
+create schema sys_boot.old_stuff;
+create table sys_boot.old_stuff.t(i int not null primary key);
+call sys_boot.mgmt.export_catalog_xmi(
+ '${FARRAGO_HOME}/testgen/upgrade/FarragoCatalogDump.xmi');
=====================================
examples/rng/unitsql/installPlugin.ref
=====================================
@@ -0,0 +1,14 @@
+> -- $Id: //open/dev/farrago/examples/rng/unitsql/installPlugin.ref#5 $
+> -- Test installation of RNG plugin
+>
+> set schema 'sys_boot.sys_boot';
+>
+> create jar rngplugin
+> library 'file:${FARRAGO_HOME}/examples/rng/plugin/FarragoRng.jar'
+> options(0);
+>
+> -- NOTE: this will shut down the system, so don't add any commands
+> -- after it
+> alter system add catalog jar rngplugin;
+>
+> !quit
=====================================
examples/rng/unitsql/installPlugin.sql
=====================================
@@ -0,0 +1,12 @@
+-- $Id: //open/dev/farrago/examples/rng/unitsql/installPlugin.sql#2 $
+-- Test installation of RNG plugin
+
+set schema 'sys_boot.sys_boot';
+
+create jar rngplugin
+library 'file:${FARRAGO_HOME}/examples/rng/plugin/FarragoRng.jar'
+options(0);
+
+-- NOTE: this will shut down the system, so don't add any commands
+-- after it
+alter system add catalog jar rngplugin;
=====================================
examples/rng/unitsql/testPlugin.ref
=====================================
@@ -0,0 +1,451 @@
+> -- $Id: //open/dev/farrago/examples/rng/unitsql/testPlugin.ref#26 $
+> -- Test usage of RNG plugin
+>
+> -- verify that without plugin enabled, custom syntax is unrecognized
+>
+> create schema rngtest;
+> set schema 'rngtest';
+> set path 'rngtest';
+>
+> -- should fail
+> create rng rng1 external '${FARRAGO_HOME}/testgen/rng1.dat' seed 999;
+Error: org.eigenbase.sql.parser.SqlParseException: Encountered "rng" at line 1, column 8.
+Was expecting one of:
+ "CLUSTERED" ...
+ "INDEX" ...
+ "LABEL" ...
+ "OR" ...
+ "ROLE" ...
+ "SCHEMA" ...
+ "SERVER" ...
+ "USER" ...
+ "LOCAL" ...
+ "FOREIGN" ...
+ "TABLE" ...
+ "GLOBAL" ...
+ "VIEW" ...
+ "FUNCTION" ...
+ "PROCEDURE" ...
+ "SPECIFIC" ...
+ "JAR" ...
+ "TYPE" ...
+ "ORDERING" ... (state=,code=0)
+>
+>
+> -- now, enable plugin personality for this session
+> alter session implementation set jar sys_boot.sys_boot.rngplugin;
+>
+>
+> -- create some random number generators; use seeds to guarantee determinism
+>
+> create rng rng1 external '${FARRAGO_HOME}/testgen/rng1.dat' seed 999;
+>
+> create rng rng2 external '${FARRAGO_HOME}/testgen/rng2.dat' seed 999;
+>
+> create rng rng3 external '${FARRAGO_HOME}/testgen/rng3.dat' seed 777;
+>
+> create function rng_next_int(
+> rng_name varchar(512),
+> n int)
+> returns int
+> language java
+> reads sql data
+> external name
+> 'sys_boot.sys_boot.rngplugin:net.sf.farrago.rng.FarragoRngUDR.rng_next_int';
+>
+> -- test various ways of naming the rng
+>
+> values rng_next_int('rng1',10);
++---------+
+| EXPR$0 |
++---------+
+| 9 |
++---------+
+>
+> values rng_next_int('RNG1',10);
++---------+
+| EXPR$0 |
++---------+
+| 1 |
++---------+
+>
+> values rng_next_int('localdb.rngtest."RNG1"',10);
++---------+
+| EXPR$0 |
++---------+
+| 1 |
++---------+
+>
+> values rng_next_int('localdb.rngtest.rng1',10);
++---------+
+| EXPR$0 |
++---------+
+| 7 |
++---------+
+>
+> values rng_next_int('rng1',10);
++---------+
+| EXPR$0 |
++---------+
+| 2 |
++---------+
+>
+> values rng_next_int('rng1',10);
++---------+
+| EXPR$0 |
++---------+
+| 5 |
++---------+
+>
+> -- should fail: bad schema
+> values rng_next_int('sales.rng1',10);
+Error: DDL validation error: Reference to unknown random number generator "RNG1" (state=,code=0)
+>
+> -- should fail: no such RNG
+> values rng_next_int('rng_nonexistent',10);
+Error: DDL validation error: Reference to unknown random number generator "RNG_NONEXISTENT" (state=,code=0)
+>
+>
+> -- verify that rng with same initial seed yields same sequence
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 9 |
++---------+
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 1 |
++---------+
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 1 |
++---------+
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 7 |
++---------+
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 2 |
++---------+
+>
+> values rng_next_int('rng2',10);
++---------+
+| EXPR$0 |
++---------+
+| 5 |
++---------+
+>
+>
+> -- verify that rng with different initial seed yields different sequence
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 0 |
++---------+
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 6 |
++---------+
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 2 |
++---------+
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 2 |
++---------+
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 5 |
++---------+
+>
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 9 |
++---------+
+>
+>
+> -- test fancy syntax
+> values next_random_int(ceiling 10 from rng2);
++---------+
+| EXPR$0 |
++---------+
+| 8 |
++---------+
+>
+> values next_random_int(unbounded from rng2);
++------------+
+| EXPR$0 |
++------------+
+| 512689831 |
++------------+
+>
+>
+> -- test view over rng
+>
+> create view random_personality_view as
+> values next_random_int(ceiling 10 from rng2);
+>
+> create view random_udf_view as
+> values rng_next_int('rng2',10);
+>
+> select * from random_personality_view;
++---------+
+| EXPR$0 |
++---------+
+| 1 |
++---------+
+>
+> select * from random_udf_view;
++---------+
+| EXPR$0 |
++---------+
+| 4 |
++---------+
+>
+> -- should fail: dependency
+> drop rng rng2 restrict;
+Error: Dropping random number generator "RNGTEST"."RNG2" requires CASCADE because other objects still reference it (state=,code=0)
+>
+> -- should fail: SELECT DISTINCT feature is disabled in this personality
+> select distinct empno from sales.emps order by empno;
+Error: SELECT DISTINCT not supported (state=,code=0)
+>
+> -- now, disable plugin personality for this session
+> alter session implementation set default;
+>
+> -- flush query cache
+> call sys_boot.mgmt.flush_code_cache();
+>
+> -- verify that DDL personality is wiped out
+> -- should fail
+> create rng rng4 external '${FARRAGO_HOME}/testgen/rng4.dat' seed 777;
+Error: org.eigenbase.sql.parser.SqlParseException: Encountered "rng" at line 1, column 8.
+Was expecting one of:
+ "CLUSTERED" ...
+ "INDEX" ...
+ "LABEL" ...
+ "OR" ...
+ "ROLE" ...
+ "SCHEMA" ...
+ "SERVER" ...
+ "USER" ...
+ "LOCAL" ...
+ "FOREIGN" ...
+ "TABLE" ...
+ "GLOBAL" ...
+ "VIEW" ...
+ "FUNCTION" ...
+ "PROCEDURE" ...
+ "SPECIFIC" ...
+ "JAR" ...
+ "TYPE" ...
+ "ORDERING" ... (state=,code=0)
+>
+> -- verify that we can still access plugin functionality via UDF
+> values rng_next_int('rng3',10);
++---------+
+| EXPR$0 |
++---------+
+| 0 |
++---------+
+>
+> -- sorry, view based on personality will no longer work :(
+> select * from random_personality_view;
+Error: org.eigenbase.sql.parser.SqlParseException: Encountered "CEILING 10" at line 2, column 34.
+Was expecting one of:
+ "ALL" ...
+ "CURSOR" ...
+ "DISTINCT" ...
+ "EXISTS" ...
+ "NOT" ...
+ "ROW" ...
+ "(" ...
+ "+" ...
+ "-" ...
+ <UNSIGNED_INTEGER_LITERAL> ...
+ <DECIMAL_NUMERIC_LITERAL> ...
+ <APPROX_NUMERIC_LITERAL> ...
+ <BINARY_STRING_LITERAL> ...
+ <PREFIXED_STRING_LITERAL> ...
+ <QUOTED_STRING> ...
+ <UNICODE_STRING_LITERAL> ...
+ "TRUE" ...
+ "FALSE" ...
+ "UNKNOWN" ...
+ "NULL" ...
+ <LBRACE_D> ...
+ <LBRACE_T> ...
+ <LBRACE_TS> ...
+ "DATE" ...
+ "TIME" ...
+ "TIMESTAMP" ...
+ "INTERVAL" ...
+ "?" ...
+ "CAST" ...
+ "EXTRACT" ...
+ "POSITION" ...
+ "CONVERT" ...
+ "TRANSLATE" ...
+ "OVERLAY" ...
+ "FLOOR" ...
+ "CEIL" ...
+ "CEILING" ...
+ "CEILING" "(" ...
+ "SUBSTRING" ...
+ "TRIM" ...
+ <LBRACE_FN> ...
+ "MULTISET" ...
+ "SPECIFIC" ...
+ <IDENTIFIER> ...
+ <QUOTED_IDENTIFIER> ...
+ <UNICODE_QUOTED_IDENTIFIER> ...
+ "ABS" ...
+ "AVG" ...
+ "CARDINALITY" ...
+ "CHAR_LENGTH" ...
+ "CHARACTER_LENGTH" ...
+ "COALESCE" ...
+ "COLLECT" ...
+ "CUME_DIST" ...
+ "COUNT" ...
+ "CURRENT_DATE" ...
+ "CURRENT_TIME" ...
+ "CURRENT_TIMESTAMP" ...
+ "DENSE_RANK" ...
+ "ELEMENT" ...
+ "EXP" ...
+ "FIRST_VALUE" ...
+ "FUSION" ...
+ "LAST_VALUE" ...
+ "LN" ...
+ "LOCALTIME" ...
+ "LOCALTIMESTAMP" ...
+ "LOWER" ...
+ "MAX" ...
+ "MIN" ...
+ "MOD" ...
+ "NULLIF" ...
+ "OCTET_LENGTH" ...
+ "PERCENT_RANK" ...
+ "POWER" ...
+ "RANK" ...
+ "ROW_NUMBER" ...
+ "SQRT" ...
+ "SUM" ...
+ "UPPER" ...
+ "CURRENT_CATALOG" ...
+ "CURRENT_DEFAULT_TRANSFORM_GROUP" ...
+ "CURRENT_PATH" ...
+ "CURRENT_ROLE" ...
+ "CURRENT_SCHEMA" ...
+ "CURRENT_USER" ...
+ "SESSION_USER" ...
+ "SYSTEM_USER" ...
+ "USER" ...
+ "NEW" ...
+ "CASE" ...
+ "*" ...
+ ")" ... (state=,code=0)
+>
+> -- but view based on UDF will
+> select * from random_udf_view;
++---------+
+| EXPR$0 |
++---------+
+| 5 |
++---------+
+>
+> -- verify that DROP CASCADE works correctly even without DDL personality
+> -- TODO: use Java filesystem access to verify creation/deletion of .dat file
+> drop schema rngtest cascade;
+> drop schema sys_boot.old_stuff cascade;
+>
+> -- verify that SELECT DISTINCT is working again
+> select distinct empno from sales.emps order by empno;
++--------+
+| EMPNO |
++--------+
+| 100 |
+| 110 |
+| 120 |
++--------+
+>
+> -- NOTE jvs 4-Mar-2009: This doesn't really belong here, but this
+> -- test is currently the only place where we restore a clean catalog,
+> -- so it's convenient for testing out the procedure for switching to Unicode
+>
+> create schema typecheck;
+>
+> create view typecheck.v as
+> select "characterSetName","collationName","ordinal"
+> from sys_fem."SQL2003"."AbstractColumn"
+> where "name" like 'ASC%DESC';
+>
+> select * from typecheck.v;
++-------------------+---------------------------+----------+
+| characterSetName | collationName | ordinal |
++-------------------+---------------------------+----------+
+| ISO-8859-1 | ISO-8859-1$en_US$primary | 9 |
++-------------------+---------------------------+----------+
+>
+> -- should fail because tables still exist
+> call sys_boot.mgmt.change_default_character_set_to_unicode();
+Error: Cannot change default character set to Unicode because local tables
+have already been defined (state=,code=0)
+>
+> drop schema sales cascade;
+>
+> -- should succeed now since we dropped all the tables
+> call sys_boot.mgmt.change_default_character_set_to_unicode();
+>
+> create view typecheck.v2 as select 'blah' as asc_or_desc from (values(0));
+>
+> -- existing column should have switched from ISO-8859-1 to UNICODE,
+> -- and new column should also be UNICODE; note that collation
+> -- is currently incorrect for new column
+> select * from typecheck.v;
++-------------------+---------------------------+----------+
+| characterSetName | collationName | ordinal |
++-------------------+---------------------------+----------+
+| UTF-16LE | UTF-16LE$en_US | 9 |
+| UTF-16LE | ISO-8859-1$en_US$primary | 0 |
++-------------------+---------------------------+----------+
+>
+> -- last thing we do is to prepare for a restore of pre-upgrade catalog contents
+> -- NOTE: this will shut down the system, so don't add any commands
+> -- after it
+> alter system replace catalog;
+>
+> !quit
=====================================
examples/rng/unitsql/testPlugin.sql
=====================================
@@ -0,0 +1,168 @@
+-- $Id: //open/dev/farrago/examples/rng/unitsql/testPlugin.sql#8 $
+-- Test usage of RNG plugin
+
+-- verify that without plugin enabled, custom syntax is unrecognized
+
+create schema rngtest;
+set schema 'rngtest';
+set path 'rngtest';
+
+-- should fail
+create rng rng1 external '${FARRAGO_HOME}/testgen/rng1.dat' seed 999;
+
+
+-- now, enable plugin personality for this session
+alter session implementation set jar sys_boot.sys_boot.rngplugin;
+
+
+-- create some random number generators; use seeds to guarantee determinism
+
+create rng rng1 external '${FARRAGO_HOME}/testgen/rng1.dat' seed 999;
+
+create rng rng2 external '${FARRAGO_HOME}/testgen/rng2.dat' seed 999;
+
+create rng rng3 external '${FARRAGO_HOME}/testgen/rng3.dat' seed 777;
+
+create function rng_next_int(
+ rng_name varchar(512),
+ n int)
+returns int
+language java
+reads sql data
+external name
+'sys_boot.sys_boot.rngplugin:net.sf.farrago.rng.FarragoRngUDR.rng_next_int';
+
+-- test various ways of naming the rng
+
+values rng_next_int('rng1',10);
+
+values rng_next_int('RNG1',10);
+
+values rng_next_int('localdb.rngtest."RNG1"',10);
+
+values rng_next_int('localdb.rngtest.rng1',10);
+
+values rng_next_int('rng1',10);
+
+values rng_next_int('rng1',10);
+
+-- should fail: bad schema
+values rng_next_int('sales.rng1',10);
+
+-- should fail: no such RNG
+values rng_next_int('rng_nonexistent',10);
+
+
+-- verify that rng with same initial seed yields same sequence
+
+values rng_next_int('rng2',10);
+
+values rng_next_int('rng2',10);
+
+values rng_next_int('rng2',10);
+
+values rng_next_int('rng2',10);
+
+values rng_next_int('rng2',10);
+
+values rng_next_int('rng2',10);
+
+
+-- verify that rng with different initial seed yields different sequence
+
+values rng_next_int('rng3',10);
+
+values rng_next_int('rng3',10);
+
+values rng_next_int('rng3',10);
+
+values rng_next_int('rng3',10);
+
+values rng_next_int('rng3',10);
+
+values rng_next_int('rng3',10);
+
+
+-- test fancy syntax
+values next_random_int(ceiling 10 from rng2);
+
+values next_random_int(unbounded from rng2);
+
+
+-- test view over rng
+
+create view random_personality_view as
+values next_random_int(ceiling 10 from rng2);
+
+create view random_udf_view as
+values rng_next_int('rng2',10);
+
+select * from random_personality_view;
+
+select * from random_udf_view;
+
+-- should fail: dependency
+drop rng rng2 restrict;
+
+-- should fail: SELECT DISTINCT feature is disabled in this personality
+select distinct empno from sales.emps order by empno;
+
+-- now, disable plugin personality for this session
+alter session implementation set default;
+
+-- flush query cache
+call sys_boot.mgmt.flush_code_cache();
+
+-- verify that DDL personality is wiped out
+-- should fail
+create rng rng4 external '${FARRAGO_HOME}/testgen/rng4.dat' seed 777;
+
+-- verify that we can still access plugin functionality via UDF
+values rng_next_int('rng3',10);
+
+-- sorry, view based on personality will no longer work :(
+select * from random_personality_view;
+
+-- but view based on UDF will
+select * from random_udf_view;
+
+-- verify that DROP CASCADE works correctly even without DDL personality
+-- TODO: use Java filesystem access to verify creation/deletion of .dat file
+drop schema rngtest cascade;
+drop schema sys_boot.old_stuff cascade;
+
+-- verify that SELECT DISTINCT is working again
+select distinct empno from sales.emps order by empno;
+
+-- NOTE jvs 4-Mar-2009: This doesn't really belong here, but this
+-- test is currently the only place where we restore a clean catalog,
+-- so it's convenient for testing out the procedure for switching to Unicode
+
+create schema typecheck;
+
+create view typecheck.v as
+select "characterSetName","collationName","ordinal"
+from sys_fem."SQL2003"."AbstractColumn"
+where "name" like 'ASC%DESC';
+
+select * from typecheck.v;
+
+-- should fail because tables still exist
+call sys_boot.mgmt.change_default_character_set_to_unicode();
+
+drop schema sales cascade;
+
+-- should succeed now since we dropped all the tables
+call sys_boot.mgmt.change_default_character_set_to_unicode();
+
+create view typecheck.v2 as select 'blah' as asc_or_desc from (values(0));
+
+-- existing column should have switched from ISO-8859-1 to UNICODE,
+-- and new column should also be UNICODE; note that collation
+-- is currently incorrect for new column
+select * from typecheck.v;
+
+-- last thing we do is to prepare for a restore of pre-upgrade catalog contents
+-- NOTE: this will shut down the system, so don't add any commands
+-- after it
+alter system replace catalog;
=====================================
examples/rng/unitsql/verifyReplaceCatalog.ref
=====================================
@@ -0,0 +1,41 @@
+> -- $Id: //open/dev/farrago/examples/rng/unitsql/verifyReplaceCatalog.ref#3 $
+> -- Test that catalog contents can be restored via
+> -- ALTER SYSTEM REPLACE CATALOG, while preserving upgraded plugin metamodel
+>
+> -- make sure old catalog contents were restored
+> select * from sys_boot.old_stuff.t;
++----+
+| I |
++----+
++----+
+>
+> -- make sure plugin metamodel still works
+> create schema rngtest;
+> set schema 'rngtest';
+> set path 'rngtest';
+>
+> -- have to re-register jar since ALTER SYSTEM REPLACE CATALOG nuked it
+> create jar sys_boot.sys_boot.rngplugin
+> library 'file:${FARRAGO_HOME}/examples/rng/plugin/FarragoRng.jar'
+> options(0);
+>
+> alter session implementation set jar sys_boot.sys_boot.rngplugin;
+>
+> -- NOTE jvs 12-Aug-2006: we can parse CREATE RNG now, but don't
+> -- actually try to use new RNG, because CREATE JAR above didn't
+> -- mark the model extension
+> create rng rng5 external '${FARRAGO_HOME}/testgen/rng5.dat' seed 999;
+>
+> -- drop our old stuff since test cleanup won't do it for us
+> drop schema sys_boot.old_stuff cascade;
+>
+> -- drop plugin too
+> drop rng rng5 cascade;
+> alter session implementation set default;
+> drop jar sys_boot.sys_boot.rngplugin options(0) cascade;
+>
+> -- this one WILL get dropped by the test framework, but that will
+> -- cause a "negative catalog leak", so delete it explicitly here instead
+> drop schema rngtest cascade;
+>
+> !quit
=====================================
examples/rng/unitsql/verifyReplaceCatalog.sql
=====================================
@@ -0,0 +1,35 @@
+-- $Id: //open/dev/farrago/examples/rng/unitsql/verifyReplaceCatalog.sql#1 $
+-- Test that catalog contents can be restored via
+-- ALTER SYSTEM REPLACE CATALOG, while preserving upgraded plugin metamodel
+
+-- make sure old catalog contents were restored
+select * from sys_boot.old_stuff.t;
+
+-- make sure plugin metamodel still works
+create schema rngtest;
+set schema 'rngtest';
+set path 'rngtest';
+
+-- have to re-register jar since ALTER SYSTEM REPLACE CATALOG nuked it
+create jar sys_boot.sys_boot.rngplugin
+library 'file:${FARRAGO_HOME}/examples/rng/plugin/FarragoRng.jar'
+options(0);
+
+alter session implementation set jar sys_boot.sys_boot.rngplugin;
+
+-- NOTE jvs 12-Aug-2006: we can parse CREATE RNG now, but don't
+-- actually try to use new RNG, because CREATE JAR above didn't
+-- mark the model extension
+create rng rng5 external '${FARRAGO_HOME}/testgen/rng5.dat' seed 999;
+
+-- drop our old stuff since test cleanup won't do it for us
+drop schema sys_boot.old_stuff cascade;
+
+-- drop plugin too
+drop rng rng5 cascade;
+alter session implementation set default;
+drop jar sys_boot.sys_boot.rngplugin options(0) cascade;
+
+-- this one WILL get dropped by the test framework, but that will
+-- cause a "negative catalog leak", so delete it explicitly here instead
+drop schema rngtest cascade;
=====================================
ext/mql/unitsql/connected.ref
=====================================
@@ -0,0 +1,279 @@
+> -- $Id: //open/dev/farrago/ext/mql/unitsql/connected.ref#1 $
+> -- Test MQL foreign data wrapper, including the parts
+> -- that actually access the web service
+> -- (so this should not run as part of checkin acceptance tests).
+> -- This test may fail if the Freebase contents have been
+> -- updated since the last time the .ref file was updated.
+>
+> create schema metaweb;
+>
+> create or replace foreign data wrapper mql_wrapper
+> library '${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+> language java;
+>
+> create or replace server mql_server
+> foreign data wrapper mql_wrapper;
+>
+> create or replace jar metaweb.mql_jar
+> library 'file:${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+> options(0);
+>
+> create or replace function metaweb.mql_query(
+> url varchar(4096),
+> mql varchar(65535),
+> row_type varchar(65535))
+> returns table(
+> objects varchar(128))
+> language java
+> parameter style system defined java
+> dynamic_function
+> no sql
+> external name 'metaweb.mql_jar:net.sf.farrago.namespace.mql.MedMqlUdx.execute';
+>
+> create or replace foreign table metaweb.artists(
+> "name" varchar(128), "id" varchar(128))
+> server mql_server
+> options (metaweb_type '/music/artist');
+>
+> select * from metaweb.artists order by "name";
++-----------------------------------+-----------------------------------------+
+| name | id |
++-----------------------------------+-----------------------------------------+
+| ABBA | /en/abba |
+| Aaliyah | /en/aaliyah |
+| Alban Berg | /en/alban_berg |
+| Alex Lifeson | /en/alex_lifeson |
+| Amr Diab | /en/amr_diab |
+| Amy Grant | /en/amy_grant |
+| Analog Brothers | /en/analog_brothers |
+| Ani DiFranco | /en/ani_difranco |
+| Antonio Diabelli | /en/anton_diabelli |
+| Antonio Salieri | /en/antonio_salieri |
+| Antonio Vivaldi | /en/antonio_vivaldi |
+| Aphex Twin | /en/aphex_twin |
+| Arlo Guthrie | /en/arlo_guthrie |
+| Articolo 31 | /en/articolo_31 |
+| Aztlan Underground | /en/aztlan_underground |
+| BT | /en/brian_transeau |
+| B\u00e9la Bart\u00f3k | /en/bela_bartok |
+| Bar\u0131\u015f Man\u00e7o | /authority/imdb/name/nm0541534 |
+| Beastie Boys | /en/beastie_boys |
+| Belle & Sebastian | /en/belle_sebastian |
+| Big Country | /en/big_country |
+| Bill Clinton | /en/bill_clinton |
+| Bill Haley | /en/bill_haley |
+| Billy Bob Thornton | /en/billy_bob_thornton |
+| Black Sabbath | /en/black_sabbath |
+| Blind Blake | /en/blind_blake |
+| Blind Lemon Jefferson | /en/blind_lemon_jefferson |
+| Blind Willie McTell | /en/blind_willie_mctell |
+| Blonde Redhead | /en/blonde_redhead |
+| Boney M. | /en/boney_m |
+| Bonzo Dog Doo-Dah Band | /en/bonzo_dog_doo-dah_band |
+| Boogie Down Productions | /en/boogie_down_productions |
+| Brian Eno | /en/brian_eno |
+| Brigitte Bardot | /en/brigitte_bardot |
+| Britney Spears | /en/britney_spears |
+| Bronski Beat | /en/bronski_beat |
+| Brownie McGhee | /en/brownie_mcghee |
+| Bruce Cockburn | /en/bruce_cockburn |
+| Buck Owens | /en/buck_owens |
+| Carmen Electra | /en/carmen_electra |
+| Charles Mingus | /en/charles_mingus |
+| Chet Atkins | /en/chet_atkins |
+| Chuck D | /en/chuck_d |
+| Claude Debussy | /en/claude_debussy |
+| Claudio Monteverdi | /en/claudio_monteverdi |
+| Cold Chisel | /en/cold_chisel |
+| Coldcut | /en/coldcut |
+| Commodores | /en/commodores |
+| Crowded House | /en/crowded_house |
+| Cypress Hill | /en/cypress_hill |
+| Danny Elfman | /en/danny_elfman |
+| Dave Brubeck | /en/dave_brubeck |
+| Dave Grohl | /en/dave_grohl |
+| Davy Jones | /en/davy_jones_1945 |
+| Dead Kennedys | /en/dead_kennedys |
+| Deicide | /guid/9202a8c04000641f8000000000013724 |
+| Depeche Mode | /en/depeche_mode |
+| Desi Arnaz | /en/desi_arnaz |
+| Devo | /en/devo |
+| Dimmu Borgir | /en/dimmu_borgir |
+| Django Reinhardt | /en/django_reinhardt |
+| Dmitri Shostakovich | /en/dmitri_shostakovich |
+| Dolly Parton | /en/dolly_parton |
+| Domenico Alberti | /en/domenico_alberti |
+| Don McLean | /en/don_mclean |
+| Donny the Punk | /en/donny_the_punk |
+| Doris Day | /en/doris_day |
+| Dwight Yoakam | /en/dwight_yoakam |
+| Edward Elgar | /en/edward_elgar |
+| Electric Light Orchestra | /en/electric_light_orchestra |
+| Elvis Costello | /en/elvis_costello |
+| Elvis Presley | /en/elvis_presley |
+| Emma Abbott | /en/emma_abbott |
+| Ennio Morricone | /en/ennio_morricone |
+| Eric Clapton | /en/eric_clapton |
+| Fleetwood Mac | /en/fleetwood_mac |
+| Frank Sinatra | /en/frank_sinatra |
+| Frank Zappa | /en/frank_zappa |
+| Frankie Goes to Hollywood | /en/frankie_goes_to_hollywood |
+| Garth Brooks | /en/garth_brooks |
+| Gene Kelly | /en/gene_kelly |
+| George Benson | /en/george_benson |
+| George Frideric Handel | /en/george_frideric_handel |
+| George Harrison | /en/george_harrison |
+| Gheorghe Zamfir | /en/gheorghe_zamfir |
+| Giacomo Puccini | /en/giacomo_puccini |
+| Gioacchino Rossini | /en/gioacchino_rossini |
+| Giovanni Pierluigi da Palestrina | /en/giovanni_pierluigi_da_palestrina |
+| Gloria Gaynor | /en/gloria_gaynor |
+| Goodness | /en/goodness |
+| Goran Bregovi\u0107 | /en/goran_bregovic |
+| Grateful Dead | /en/grateful_dead |
+| Gregorio Allegri | /en/gregorio_allegri |
+| Guitarist | /en/guitarist |
+| Kings of Leon | /en/kings_of_leon |
+| Led Zeppelin | /en/led_zeppelin |
+| The Alan Parsons Project | /en/the_alan_parsons_project |
+| The Beach Boys | /en/the_beach_boys |
+| The Elephant Six Collective | /en/the_elephant_six_collective |
++-----------------------------------+-----------------------------------------+
+| name | id |
++-----------------------------------+-----------------------------------------+
+| Yo La Tengo | /en/yo_la_tengo |
++-----------------------------------+-----------------------------------------+
+>
+> select "id" from metaweb.artists order by "id";
++-----------------------------------------+
+| id |
++-----------------------------------------+
+| /authority/imdb/name/nm0541534 |
+| /en/aaliyah |
+| /en/abba |
+| /en/alban_berg |
+| /en/alex_lifeson |
+| /en/amr_diab |
+| /en/amy_grant |
+| /en/analog_brothers |
+| /en/ani_difranco |
+| /en/anton_diabelli |
+| /en/antonio_salieri |
+| /en/antonio_vivaldi |
+| /en/aphex_twin |
+| /en/arlo_guthrie |
+| /en/articolo_31 |
+| /en/aztlan_underground |
+| /en/beastie_boys |
+| /en/bela_bartok |
+| /en/belle_sebastian |
+| /en/big_country |
+| /en/bill_clinton |
+| /en/bill_haley |
+| /en/billy_bob_thornton |
+| /en/black_sabbath |
+| /en/blind_blake |
+| /en/blind_lemon_jefferson |
+| /en/blind_willie_mctell |
+| /en/blonde_redhead |
+| /en/boney_m |
+| /en/bonzo_dog_doo-dah_band |
+| /en/boogie_down_productions |
+| /en/brian_eno |
+| /en/brian_transeau |
+| /en/brigitte_bardot |
+| /en/britney_spears |
+| /en/bronski_beat |
+| /en/brownie_mcghee |
+| /en/bruce_cockburn |
+| /en/buck_owens |
+| /en/carmen_electra |
+| /en/charles_mingus |
+| /en/chet_atkins |
+| /en/chuck_d |
+| /en/claude_debussy |
+| /en/claudio_monteverdi |
+| /en/cold_chisel |
+| /en/coldcut |
+| /en/commodores |
+| /en/crowded_house |
+| /en/cypress_hill |
+| /en/danny_elfman |
+| /en/dave_brubeck |
+| /en/dave_grohl |
+| /en/davy_jones_1945 |
+| /en/dead_kennedys |
+| /en/depeche_mode |
+| /en/desi_arnaz |
+| /en/devo |
+| /en/dimmu_borgir |
+| /en/django_reinhardt |
+| /en/dmitri_shostakovich |
+| /en/dolly_parton |
+| /en/domenico_alberti |
+| /en/don_mclean |
+| /en/donny_the_punk |
+| /en/doris_day |
+| /en/dwight_yoakam |
+| /en/edward_elgar |
+| /en/electric_light_orchestra |
+| /en/elvis_costello |
+| /en/elvis_presley |
+| /en/emma_abbott |
+| /en/ennio_morricone |
+| /en/eric_clapton |
+| /en/fleetwood_mac |
+| /en/frank_sinatra |
+| /en/frank_zappa |
+| /en/frankie_goes_to_hollywood |
+| /en/garth_brooks |
+| /en/gene_kelly |
+| /en/george_benson |
+| /en/george_frideric_handel |
+| /en/george_harrison |
+| /en/gheorghe_zamfir |
+| /en/giacomo_puccini |
+| /en/gioacchino_rossini |
+| /en/giovanni_pierluigi_da_palestrina |
+| /en/gloria_gaynor |
+| /en/goodness |
+| /en/goran_bregovic |
+| /en/grateful_dead |
+| /en/gregorio_allegri |
+| /en/guitarist |
+| /en/kings_of_leon |
+| /en/led_zeppelin |
+| /en/the_alan_parsons_project |
+| /en/the_beach_boys |
+| /en/the_elephant_six_collective |
+| /en/yo_la_tengo |
++-----------------------------------------+
+| id |
++-----------------------------------------+
+| /guid/9202a8c04000641f8000000000013724 |
++-----------------------------------------+
+>
+> select "name" from metaweb.artists
+> where "id"='/en/gene_kelly';
++-------------+
+| name |
++-------------+
+| Gene Kelly |
++-------------+
+>
+> select * from metaweb.artists
+> where "id"='/en/gene_kelly';
++-------------+-----------------+
+| name | id |
++-------------+-----------------+
+| Gene Kelly | /en/gene_kelly |
++-------------+-----------------+
+>
+> select count(*) from metaweb.artists;
++---------+
+| EXPR$0 |
++---------+
+| 100 |
++---------+
+>
+> !quit
=====================================
ext/mql/unitsql/connected.sql
=====================================
@@ -0,0 +1,48 @@
+-- $Id: //open/dev/farrago/ext/mql/unitsql/connected.sql#1 $
+-- Test MQL foreign data wrapper, including the parts
+-- that actually access the web service
+-- (so this should not run as part of checkin acceptance tests).
+-- This test may fail if the Freebase contents have been
+-- updated since the last time the .ref file was updated.
+
+create schema metaweb;
+
+create or replace foreign data wrapper mql_wrapper
+library '${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+language java;
+
+create or replace server mql_server
+foreign data wrapper mql_wrapper;
+
+create or replace jar metaweb.mql_jar
+library 'file:${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+options(0);
+
+create or replace function metaweb.mql_query(
+ url varchar(4096),
+ mql varchar(65535),
+ row_type varchar(65535))
+returns table(
+ objects varchar(128))
+language java
+parameter style system defined java
+dynamic_function
+no sql
+external name 'metaweb.mql_jar:net.sf.farrago.namespace.mql.MedMqlUdx.execute';
+
+create or replace foreign table metaweb.artists(
+ "name" varchar(128), "id" varchar(128))
+server mql_server
+options (metaweb_type '/music/artist');
+
+select * from metaweb.artists order by "name";
+
+select "id" from metaweb.artists order by "id";
+
+select "name" from metaweb.artists
+where "id"='/en/gene_kelly';
+
+select * from metaweb.artists
+where "id"='/en/gene_kelly';
+
+select count(*) from metaweb.artists;
=====================================
ext/mql/unitsql/disconnected.ref
=====================================
@@ -0,0 +1,59 @@
+> -- $Id: //open/dev/farrago/ext/mql/unitsql/disconnected.ref#1 $
+> -- Test MQL foreign data wrapper, but only the parts
+> -- that don't actually access the web service so
+> -- that this can run disconnected
+>
+> create schema metaweb;
+>
+> create or replace foreign data wrapper mql_wrapper
+> library '${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+> language java;
+>
+> create or replace server mql_server
+> foreign data wrapper mql_wrapper;
+>
+> create or replace jar metaweb.mql_jar
+> library 'file:${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+> options(0);
+>
+> create or replace function metaweb.mql_query(
+> url varchar(4096),
+> mql varchar(65535),
+> row_type varchar(65535))
+> returns table(
+> objects varchar(128))
+> language java
+> parameter style system defined java
+> dynamic_function
+> no sql
+> external name 'metaweb.mql_jar:net.sf.farrago.namespace.mql.MedMqlUdx.execute';
+>
+> create or replace foreign table metaweb.artists(
+> "name" varchar(128), "id" varchar(128))
+> server mql_server
+> options (metaweb_type '/music/artist');
+>
+> !set outputformat csv
+>
+> explain plan for select * from metaweb.artists;
+'column0'
+'FarragoJavaUdxRel(invocation=[CAST(MQL_QUERY(CAST('http://api.freebase.com/api/service/mqlread'):VARCHAR(4096) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('{"query":[{"type":"/music/artist","id":null,"name":null}]}'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('name|id'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary")):RecordType(VARCHAR(128) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" OBJECTS) NOT NULL])'
+>
+> explain plan for select "id" from metaweb.artists;
+'column0'
+'FarragoJavaUdxRel(invocation=[CAST(MQL_QUERY(CAST('http://api.freebase.com/api/service/mqlread'):VARCHAR(4096) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('{"query":[{"type":"/music/artist","id":null}]}'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('id'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary")):RecordType(VARCHAR(128) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" OBJECTS) NOT NULL])'
+>
+> explain plan for select "name" from metaweb.artists
+> where "id"='/en/gene_kelly';
+'column0'
+'FennelToIteratorConverter'
+' FennelReshapeRel(projection=[[0]], outputRowType=[RecordType(VARCHAR(128) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" name) NOT NULL])'
+' IteratorToFennelConverter'
+' FarragoJavaUdxRel(invocation=[CAST(MQL_QUERY(CAST('http://api.freebase.com/api/service/mqlread'):VARCHAR(4096) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('{"query":[{"type":"/music/artist","id":"/en/gene_kelly","name":null}]}'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('name|id'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary")):RecordType(VARCHAR(128) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" OBJECTS) NOT NULL])'
+>
+> explain plan for select * from metaweb.artists
+> where "id"='/en/gene_kelly';
+'column0'
+'FarragoJavaUdxRel(invocation=[CAST(MQL_QUERY(CAST('http://api.freebase.com/api/service/mqlread'):VARCHAR(4096) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('{"query":[{"type":"/music/artist","id":"/en/gene_kelly","name":null}]}'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary", CAST('name|id'):VARCHAR(65535) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary")):RecordType(VARCHAR(128) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" OBJECTS) NOT NULL])'
+>
+> !quit
=====================================
ext/mql/unitsql/disconnected.sql
=====================================
@@ -0,0 +1,46 @@
+-- $Id: //open/dev/farrago/ext/mql/unitsql/disconnected.sql#1 $
+-- Test MQL foreign data wrapper, but only the parts
+-- that don't actually access the web service so
+-- that this can run disconnected
+
+create schema metaweb;
+
+create or replace foreign data wrapper mql_wrapper
+library '${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+language java;
+
+create or replace server mql_server
+foreign data wrapper mql_wrapper;
+
+create or replace jar metaweb.mql_jar
+library 'file:${FARRAGO_HOME}/ext/mql/plugin/farrago-mql.jar'
+options(0);
+
+create or replace function metaweb.mql_query(
+ url varchar(4096),
+ mql varchar(65535),
+ row_type varchar(65535))
+returns table(
+ objects varchar(128))
+language java
+parameter style system defined java
+dynamic_function
+no sql
+external name 'metaweb.mql_jar:net.sf.farrago.namespace.mql.MedMqlUdx.execute';
+
+create or replace foreign table metaweb.artists(
+ "name" varchar(128), "id" varchar(128))
+server mql_server
+options (metaweb_type '/music/artist');
+
+!set outputformat csv
+
+explain plan for select * from metaweb.artists;
+
+explain plan for select "id" from metaweb.artists;
+
+explain plan for select "name" from metaweb.artists
+where "id"='/en/gene_kelly';
+
+explain plan for select * from metaweb.artists
+where "id"='/en/gene_kelly';
View it on GitLab: https://salsa.debian.org/java-team/eigenbase-farrago/-/commit/3d7f079bc84dff0ca4fa0fb5611a51215088bdfa
--
View it on GitLab: https://salsa.debian.org/java-team/eigenbase-farrago/-/commit/3d7f079bc84dff0ca4fa0fb5611a51215088bdfa
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250822/70abab2d/attachment.htm>
More information about the pkg-java-commits
mailing list