GROUP_CONCAT is unsupported - ignite

I have found GROUP_CONCAT doc on official docs https://apacheignite-sql.readme.io/docs (SQL REFERENCE / Aggregate Functions / GROUP_CONCAT), but it has not supported yet in ignite source code:
// GridSqlAggregateFunction.java:84
switch (type) {
case GROUP_CONCAT:
throw new UnsupportedOperationException();
Has plan to supporte it?
Thanks!

The function was added to the SQL reference by mistake and removed for now. To my knowledge Ignite community considers adding it in the future.

Related

go-redis does it have support for registering / executing lua functions

From its version 7.x onwards, Redis has introduced functions, as an alternative to script execution, as documented here.
I am looking for an example, or documentation on how to use redis functions using go-redis package. Not sure, if go-redis supports this feature yet.
Thanks for anyone letting me know about this.
I searched a bit more in the official documentation of go-redis, which has a way of executing unsupported commands using the Do, as mentioned here.
// Defind the function code..
fcode := `#!lua name=mylib
redis.register_function('myfunc',
function (keys, args)
return args[1]
end)`
// Load or replace the function
val, err := rdb.Do(ctx, "function", "load", "replace", "<function code text>").Result()
// later in the code... call the function
va, err := rdb.Do(ctx, "fcall", "myfunc", 0, "hello").Result()

Creating a Sequelize Dialect for new Database

I'm pretty new to sequelize, though I've worked on node previously I did not use any ORM framework. At present I'm using new SQL DB(which is not supported by sequelize ) and want to connect it using node.js and sequelize( popular ORM for node.js ) by prototyping the existing dialects
The configuration is correct as I've tried it wihtout ORM.
The problem is after configuring the connection with properties the
sequelize.authenticate() doesn't throw any error but doesn't return a promise back
/**
* Test the connection by trying to authenticate
*
* #error 'Invalid credentials' if the authentication failed (even if the database did not respond at all...)
* #return {Promise}
*/
authenticate(options) {
return this.query('SELECT 1+1 AS result', _.assign({ raw: true, plain: true }, options)).return();
}
The return statement doesn't return anything. I've read this post how to create a new dialect. Though it says it is not encouraged to create a new dialect and throws an error if we try to, I think there must be a way to create because if it can be created for other SQL databases then may be there should be a way to do it. This is an open source project on github. Did anyone previously work on this any help is appreciated. Thanks in Advance
Only the 5 dialects are supported and an error will be thrown if you try and use NewSQL.
There is a lot of code in Sequelize to construct queries based on the dialect, so even if you could get past the error (such as forking the repo and changing it) the likelihood of everything working as you expect (or as is documented) is low.
I suggest posting an issue on GitHub to bring that dialect to the project.

to_json not working with selectExpr in spark

I am reading a databricks blog link
and I find a problem with the built-in function to_json.
In the codes blew within this tutorial, it returns error:
org.apache.spark.sql.AnalysisException: Undefined function: 'to_json'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.
Does this means that this usage in the tutorial is wrong? and no udf could be used in selectExpr. Could I do something like register this to_json function into default database?
val deviceAlertQuery = notifydevicesDS
.selectExpr("CAST(dcId AS STRING) AS key", "to_json(struct(*)) AS value")
.writeStream
.format("kafka")
.option("kafka.bootstrap.servers", "host1:port1,host2:port2")
.option("toipic", "device_alerts")
.start()
You need to improt the to_json function as
import org.apache.spark.sql.functions.to_json
This should work rather than the selectExpr
data.withColumn("key", $"dcId".cast("string"))
.select(to_json(struct(data.columns.head, data.columns.tail:_*)).as("value")).show()
You must also use the spark 2.x
I hope this helps to solve your problem.
based on information I get from mail list. this function are not added into SQL from spark 2.2.0. Here is the commit link:commit.
Hope this will help. THX Hyukjin Kwon and Burak Yavuz.

How to convert certain C# code to VB.NET

I've been googling around around and read this article
C# How to get SQL Server installation path programatically?
and this is exactly what i need in VB.NET , however i'm not good in translating this code into VB.NET Code. So, any help would greatly appreciated. Thank you.
Note : I'm using SQL Server 2005 and Visual Basic 2008
While the question was originally titled about retrieving SQL Server's installation path, I felt it was more about a code translation problem (the solution already existed, just not in the right language).
But then I thought that the method in the original code was fairly blunt.
Evan provided you with what I assume is a workable translation of the existing solution. But probably a much easier way to perform this specific task - assuming you just need to find the installation path for an instance you're already connected to, and assuming that a user who can read the registry will also have VIEW SERVER STATE permissions - is to issue this simple query against the DMV sys.dm_os_loaded_modules from your program:
SELECT name
FROM sys.dm_os_loaded_modules
WHERE name LIKE '%sqlservr.exe';
This will give you something like this:
C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\Binn\sqlservr.exe
You have some parsing to do, depending on exactly what you're after (e.g. do you want to stop at MSSQL, or Binn?), but this is much easier than reading the registry or other methods that are out there IMHO.
I just used a code converter ... There are only basic things that need to be changed ..
Using sqlServerKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Microsoft SQL Server")
For Each subKeyName As String In sqlServerKey.GetSubKeyNames()
If subKeyName.StartsWith("MSSQL.") Then
Using instanceKey As RegistryKey = sqlServerKey.OpenSubKey(subKeyName)
Dim instanceName As String = instanceKey.GetValue("").ToString()
If instanceName = "MSSQLSERVER" Then
'say
Dim path__1 As String = instanceKey.OpenSubKey("Setup").GetValue("SQLBinRoot").ToString()
path__1 = Path.Combine(path__1, "sqlserver.exe")
Return path__1
End If
End Using
End If
Next
End Using
If you were to just read a quick article on C#, you would notice that strings are declared differently, and minor syntax discrepancies exist such as foreach vs for each
You can read here for some more common differences.
I use a very good (offline) tool, called Convert .NET Free
It's from www.fishcodelib.com
Here's a direct link to the latest release (as of 19/04/14) Size: 2.06MB, File: Zip :
[Direct Link]
Hope this is of some use ;)
P.S. This software requires .NET Framework 4.5.
This almost never fails! :) Good Luck
http://www.developerfusion.com/tools/convert/csharp-to-vb/

NHibernate: No persister for NHibernate.Criterion.SqlFunctionProjection

I am using NHibernate version 2.0.0.4000.
In one of my queries I wanted to make use of the sql function dateadd to add a number of days. This wasn't registered so I created my own dialect and registered the function as follows:
RegisterFunction("adddays",
new SQLFunctionTemplate(NHibernateUtil.DateTime,
"dateadd(dd, ?1, ?2)"));
The registration gets hit and seems to work fine. I use the function in a DetachedCriteria query as follows:
...
Restrictions.LtProperty("DateColumn1"
Projections.SqlFunction("adddays", NHibernateUtil.DateTime,
Projections.Constant(days),
Projections.Property("DateColumn2"))
...
The criteria is returned from a method and passed of to another query. Upon the execution of the final query I get the following exception:
NHibernate.MappingException was caught
Message="No persister for: NHibernate.Criterion.SqlFunctionProjection"
Source="NHibernate"
StackTrace:
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName,
Boolean throwIfNotFound)
at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName)
...
None of the blog posts that I have seen mention this problem. Can anybody help?
Cheers in advance.
Nige.
Solved it.
The problem was caused by my usage elsewhere of Restrictions.Eq rather than Restrictions.EqProperty. The former does not have an overload for (IProjection,IProjection) and so was treating the second projection as an object and passing it to a persister.
Thanks to anyone who investigated this.
Nigel.
For No Persister exception in nhibernet solution is
just give a right click on the respective hbm file ->Properties->change the type Build Action-> to Embedded Resource
with the above step application will working fine